const jetquery = @import("jetzig").jetquery; pub const Album = jetquery.Model( @This(), "albums", struct { id: i64, name: []const u8, length: ?f32, created_at: jetquery.DateTime, updated_at: jetquery.DateTime, }, .{ .relations = .{ .albumsongs = jetquery.hasMany(.Albumsong, .{}), .artistalbums = jetquery.hasMany(.Artistalbum, .{}), }, }, ); pub const Albumsong = jetquery.Model( @This(), "albumsongs", struct { id: i64, song_id: i64, album_id: i64, created_at: jetquery.DateTime, updated_at: jetquery.DateTime, }, .{ .relations = .{ .song = jetquery.belongsTo(.Song, .{}), .album = jetquery.belongsTo(.Album, .{}), .scrobbles = jetquery.hasMany(.Scrobble, .{ .foreign_key = "albumsong" }), .albumsongsartists = jetquery.hasMany(.Albumsongsartist, .{}), }, }, ); pub const Albumsongsartist = jetquery.Model( @This(), "albumsongsartists", struct { id: i64, albumsong_id: i64, artist_id: i64, created_at: jetquery.DateTime, updated_at: jetquery.DateTime, }, .{ .relations = .{ .albumsong = jetquery.belongsTo(.Albumsong, .{}), .artist = jetquery.belongsTo(.Artist, .{}), }, }, ); pub const Artistalbum = jetquery.Model( @This(), "artistalbums", struct { id: i64, album_id: i64, artist_id: i64, created_at: jetquery.DateTime, updated_at: jetquery.DateTime, }, .{ .relations = .{ .album = jetquery.belongsTo(.Album, .{}), .artist = jetquery.belongsTo(.Artist, .{}), }, }, ); pub const Artist = jetquery.Model( @This(), "artists", struct { id: i64, name: []const u8, disambiguation: ?[]const u8, created_at: jetquery.DateTime, updated_at: jetquery.DateTime, }, .{ .relations = .{ .albumsongsartists = jetquery.hasMany(.Albumsongsartist, .{}), .artistalbums = jetquery.hasMany(.Artistalbum, .{}), .artistsongs = jetquery.hasMany(.Artistsong, .{}), }, }, ); pub const Scrobble = jetquery.Model( @This(), "scrobbles", struct { id: i32, albumsong: i64, datetime: jetquery.DateTime, created_at: jetquery.DateTime, updated_at: jetquery.DateTime, }, .{ .relations = .{ .albumsong = jetquery.belongsTo(.Albumsong, .{ .foreign_key = "albumsong" }), }, }, ); pub const Song = jetquery.Model( @This(), "songs", struct { id: i64, name: []const u8, length: ?f32, hidden: bool, created_at: jetquery.DateTime, updated_at: jetquery.DateTime, }, .{ .relations = .{ .albumsongs = jetquery.hasMany(.Albumsong, .{}), .artistsongs = jetquery.hasMany(.Artistsong, .{}), }, }, ); pub const Artistsong = jetquery.Model( @This(), "artistsongs", struct { id: i64, artist_id: i64, song_id: i64, created_at: jetquery.DateTime, updated_at: jetquery.DateTime, }, .{ .relations = .{ .artist = jetquery.belongsTo(.Artist, .{}), .song = jetquery.belongsTo(.Song, .{}), }, }, ); 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" }), }, }, );