Create ratings tables

This commit is contained in:
mitteneer 2025-06-22 14:37:10 -04:00
parent 9c90c683c6
commit 77a9c24dab
4 changed files with 130 additions and 1 deletions

View file

@ -97,7 +97,7 @@ pub const Scrobble = jetquery.Model(
@This(),
"scrobbles",
struct {
id: i64,
id: i32,
albumsong: i64,
datetime: jetquery.DateTime,
created_at: jetquery.DateTime,
@ -146,3 +146,66 @@ pub const Artistsong = jetquery.Model(
},
},
);
pub const Albumrating = jetquery.Model(
@This(),
"albumratings",
struct {
id: i32,
album: i64,
rating: i16,
rating_text: []const u8,
date: jetquery.DateTime,
created_at: jetquery.DateTime,
updated_at: jetquery.DateTime,
},
.{
.relations = .{
.album = jetquery.belongsTo(.Album, .{
.foreign_key = "album",
}),
},
},
);
pub const Artistrating = jetquery.Model(
@This(),
"artistratings",
struct {
id: i32,
artist: i64,
rating: i16,
rating_text: []const u8,
date: jetquery.DateTime,
created_at: jetquery.DateTime,
updated_at: jetquery.DateTime,
},
.{
.relations = .{
.artist = jetquery.belongsTo(.Artist, .{
.foreign_key = "artist",
}),
},
},
);
pub const Songrating = jetquery.Model(
@This(),
"songratings",
struct {
id: i32,
song: i64,
rating: i16,
rating_text: []const u8,
date: jetquery.DateTime,
created_at: jetquery.DateTime,
updated_at: jetquery.DateTime,
},
.{
.relations = .{
.albumsong = jetquery.belongsTo(.Albumsong, .{
.foreign_key = "song",
}),
},
},
);