mirror of
https://github.com/sphildreth/roadie
synced 2024-11-25 13:40:22 +00:00
WIP
This commit is contained in:
parent
f8fb347f95
commit
382156d136
20 changed files with 291 additions and 6 deletions
|
@ -16,6 +16,8 @@ namespace Roadie.Library.Data
|
|||
[Column("artistType", TypeName = "enum")]
|
||||
public string ArtistType { get; set; }
|
||||
|
||||
public ICollection<ArtistAssociation> AssociatedArtists { get; set; }
|
||||
|
||||
[Column("bandStatus", TypeName = "enum")]
|
||||
public BandStatus? BandStatus { get; set; }
|
||||
|
||||
|
@ -30,6 +32,10 @@ namespace Roadie.Library.Data
|
|||
[MaxLength(50)]
|
||||
public string DiscogsId { get; set; }
|
||||
|
||||
public ICollection<ArtistGenre> Genres { get; set; }
|
||||
|
||||
public ICollection<Image> Images { get; set; }
|
||||
|
||||
[Column("isniList", TypeName = "text")]
|
||||
[MaxLength(65535)]
|
||||
public string ISNIList { get; set; }
|
||||
|
|
25
RoadieLibrary/Data/ArtistAssociation.cs
Normal file
25
RoadieLibrary/Data/ArtistAssociation.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Roadie.Library.Data
|
||||
{
|
||||
[Table("artistAssociation")]
|
||||
public partial class ArtistAssociation
|
||||
{
|
||||
public Artist Artist { get; set; }
|
||||
|
||||
[Column("artistId")]
|
||||
[Required]
|
||||
public int ArtistId { get; set; }
|
||||
|
||||
public Artist AssociatedArtist { get; set; }
|
||||
|
||||
[Column("associatedArtistId")]
|
||||
[Required]
|
||||
public int AssociatedArtistId { get; set; }
|
||||
|
||||
[Key]
|
||||
[Column("id")]
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
25
RoadieLibrary/Data/ArtistGenre.cs
Normal file
25
RoadieLibrary/Data/ArtistGenre.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Roadie.Library.Data
|
||||
{
|
||||
[Table("artistGenreTable")]
|
||||
public partial class ArtistGenre
|
||||
{
|
||||
public Artist Artist { get; set; }
|
||||
|
||||
[Column("artistId")]
|
||||
[Required]
|
||||
public int ArtistId { get; set; }
|
||||
|
||||
public Genre Genre { get; set; }
|
||||
|
||||
[Column("genreId")]
|
||||
[Required]
|
||||
public int GenreId { get; set; }
|
||||
|
||||
[Column("id")]
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
23
RoadieLibrary/Data/Bookmark.cs
Normal file
23
RoadieLibrary/Data/Bookmark.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using Roadie.Library.Enums;
|
||||
using Roadie.Library.Identity;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Roadie.Library.Data
|
||||
{
|
||||
[Table("bookmark")]
|
||||
public partial class Bookmark : EntityBase
|
||||
{
|
||||
[Column("bookmarkTargetId")]
|
||||
public int BookmarkTargetId { get; set; }
|
||||
|
||||
[Column("bookmarkType")]
|
||||
public BookmarkType? BookmarkType { get; set; }
|
||||
|
||||
[Column("userId")]
|
||||
[Required]
|
||||
public int UserId { get; set; }
|
||||
|
||||
public ApplicationUser User { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,17 +1,31 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using Roadie.Library.Identity;
|
||||
|
||||
namespace Roadie.Library.Data
|
||||
{
|
||||
public interface IRoadieDbContext
|
||||
{
|
||||
DbSet<ArtistAssociation> ArtistAssociations { get; set; }
|
||||
DbSet<ArtistGenre> ArtistGenres { get; set; }
|
||||
DbSet<Artist> Artists { get; set; }
|
||||
DbSet<Bookmark> Bookmarks { get; set; }
|
||||
DbSet<CollectionRelease> CollectionReleases { get; set; }
|
||||
DbSet<Collection> Collections { get; set; }
|
||||
DbSet<Genre> Genres { get; set; }
|
||||
DbSet<Image> Images { get; set; }
|
||||
DbSet<Label> Labels { get; set; }
|
||||
DbSet<Playlist> Playlists { get; set; }
|
||||
DbSet<PlaylistTrack> PlaylistTracks { get; set; }
|
||||
DbSet<ReleaseGenre> ReleaseGenres { get; set; }
|
||||
DbSet<ReleaseLabel> ReleaseLabels { get; set; }
|
||||
DbSet<ReleaseMedia> ReleaseMedias { get; set; }
|
||||
DbSet<Release> Releases { get; set; }
|
||||
DbSet<Request> Requests { get; set; }
|
||||
DbSet<Submission> Submissions { get; set; }
|
||||
DbSet<Track> Tracks { get; set; }
|
||||
DbSet<UserArtist> UserArtists { get; set; }
|
||||
DbSet<UserRelease> UserReleases { get; set; }
|
||||
DbSet<ApplicationUser> Users { get; set; }
|
||||
DbSet<UserTrack> UserTracks { get; set; }
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ namespace Roadie.Library.Data
|
|||
[Column("artistId")]
|
||||
public int? ArtistId { get; set; }
|
||||
|
||||
[Column("image", TypeName = "blob")]
|
||||
[Column("image", TypeName = "mediumblob")]
|
||||
public byte[] Bytes { get; set; }
|
||||
|
||||
[Column("caption")]
|
||||
|
|
|
@ -27,6 +27,8 @@ namespace Roadie.Library.Data
|
|||
|
||||
public ICollection<ReleaseGenre> Genres { get; set; }
|
||||
|
||||
public ICollection<Image> Images { get; set; }
|
||||
|
||||
[Column("isVirtual")]
|
||||
public bool? IsVirtual { get; set; }
|
||||
|
||||
|
|
21
RoadieLibrary/Data/Request.cs
Normal file
21
RoadieLibrary/Data/Request.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using Roadie.Library.Identity;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Roadie.Library.Data
|
||||
{
|
||||
[Table("request")]
|
||||
public partial class Request : EntityBase
|
||||
{
|
||||
[Column("description")]
|
||||
[MaxLength(500)]
|
||||
[Required]
|
||||
public string Description { get; set; }
|
||||
|
||||
public ApplicationUser User { get; set; }
|
||||
|
||||
[Column("userId")]
|
||||
[Required]
|
||||
public int UserId { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,20 +1,34 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using Roadie.Library.Enums;
|
||||
using Roadie.Library.Identity;
|
||||
using System;
|
||||
|
||||
namespace Roadie.Library.Data
|
||||
{
|
||||
public class RoadieDbContext : DbContext, IRoadieDbContext
|
||||
{
|
||||
public DbSet<ArtistAssociation> ArtistAssociations { get; set; }
|
||||
public DbSet<ArtistGenre> ArtistGenres { get; set; }
|
||||
public DbSet<Artist> Artists { get; set; }
|
||||
public DbSet<Bookmark> Bookmarks { get; set; }
|
||||
public DbSet<CollectionRelease> CollectionReleases { get; set; }
|
||||
public DbSet<Collection> Collections { get; set; }
|
||||
public DbSet<Genre> Genres { get; set; }
|
||||
public DbSet<Image> Images { get; set; }
|
||||
public DbSet<Label> Labels { get; set; }
|
||||
public DbSet<Playlist> Playlists { get; set; }
|
||||
public DbSet<PlaylistTrack> PlaylistTracks { get; set; }
|
||||
public DbSet<ReleaseGenre> ReleaseGenres { get; set; }
|
||||
public DbSet<ReleaseLabel> ReleaseLabels { get; set; }
|
||||
public DbSet<ReleaseMedia> ReleaseMedias { get; set; }
|
||||
public DbSet<Release> Releases { get; set; }
|
||||
public DbSet<Request> Requests { get; set; }
|
||||
public DbSet<Submission> Submissions { get; set; }
|
||||
public DbSet<Track> Tracks { get; set; }
|
||||
public DbSet<UserArtist> UserArtists { get; set; }
|
||||
public DbSet<UserRelease> UserReleases { get; set; }
|
||||
public DbSet<ApplicationUser> Users { get; set; }
|
||||
public DbSet<UserTrack> UserTracks { get; set; }
|
||||
|
||||
public RoadieDbContext(DbContextOptions<RoadieDbContext> options)
|
||||
: base(options)
|
||||
|
@ -47,6 +61,19 @@ namespace Roadie.Library.Data
|
|||
v => (CollectionType)Enum.Parse(typeof(CollectionType), v))
|
||||
.HasDefaultValue(CollectionType.Unknown);
|
||||
|
||||
builder
|
||||
.Entity<Bookmark>()
|
||||
.Property(e => e.BookmarkType)
|
||||
.HasConversion(
|
||||
v => v.ToString(),
|
||||
v => (BookmarkType)Enum.Parse(typeof(BookmarkType), v))
|
||||
.HasDefaultValue(BookmarkType.Unknown);
|
||||
|
||||
builder.Entity<ArtistAssociation>()
|
||||
.HasOne(aa => aa.Artist)
|
||||
.WithMany(a => a.AssociatedArtists)
|
||||
.HasForeignKey(aa => aa.AssociatedArtistId);
|
||||
|
||||
builder.Entity<ReleaseLabel>()
|
||||
.HasOne(rl => rl.Release)
|
||||
.WithMany(r => r.Labels)
|
||||
|
@ -89,6 +116,12 @@ namespace Roadie.Library.Data
|
|||
.HasOne(cr => cr.Collection)
|
||||
.WithMany(c => c.Releases)
|
||||
.HasForeignKey(cr => cr.CollectionId);
|
||||
|
||||
builder.Entity<Bookmark>()
|
||||
.HasOne(b => b.User)
|
||||
.WithMany(u => u.Bookmarks)
|
||||
.HasForeignKey(b => b.UserId);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
14
RoadieLibrary/Data/Submission.cs
Normal file
14
RoadieLibrary/Data/Submission.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using Roadie.Library.Identity;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Roadie.Library.Data
|
||||
{
|
||||
[Table("submission")]
|
||||
public partial class Submission : EntityBase
|
||||
{
|
||||
public ApplicationUser User { get; set; }
|
||||
|
||||
[Column("userId")]
|
||||
public int UserId { get; set; }
|
||||
}
|
||||
}
|
31
RoadieLibrary/Data/UserArtist.cs
Normal file
31
RoadieLibrary/Data/UserArtist.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using Roadie.Library.Identity;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Roadie.Library.Data
|
||||
{
|
||||
[Table("userartist")]
|
||||
public partial class UserArtist : EntityBase
|
||||
{
|
||||
public Artist Artist { get; set; }
|
||||
|
||||
[Column("artistId")]
|
||||
[Required]
|
||||
public int ArtistId { get; set; }
|
||||
|
||||
[Column("isDisliked")]
|
||||
public bool? IsDisliked { get; set; }
|
||||
|
||||
[Column("isFavorite")]
|
||||
public bool? IsFavorite { get; set; }
|
||||
|
||||
[Column("rating")]
|
||||
public short Rating { get; set; }
|
||||
|
||||
public ApplicationUser User { get; set; }
|
||||
|
||||
[Column("userId")]
|
||||
[Required]
|
||||
public int UserId { get; set; }
|
||||
}
|
||||
}
|
31
RoadieLibrary/Data/UserRelease.cs
Normal file
31
RoadieLibrary/Data/UserRelease.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using Roadie.Library.Identity;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Roadie.Library.Data
|
||||
{
|
||||
[Table("userrelease")]
|
||||
public partial class UserRelease : EntityBase
|
||||
{
|
||||
[Column("isDisliked")]
|
||||
public bool? IsDisliked { get; set; }
|
||||
|
||||
[Column("isFavorite")]
|
||||
public bool? IsFavorite { get; set; }
|
||||
|
||||
[Column("rating")]
|
||||
public short Rating { get; set; }
|
||||
|
||||
public Release Release { get; set; }
|
||||
|
||||
[Column("releaseId")]
|
||||
[Required]
|
||||
public int ReleaseId { get; set; }
|
||||
|
||||
public ApplicationUser User { get; set; }
|
||||
|
||||
[Column("userId")]
|
||||
[Required]
|
||||
public int UserId { get; set; }
|
||||
}
|
||||
}
|
38
RoadieLibrary/Data/UserTrack.cs
Normal file
38
RoadieLibrary/Data/UserTrack.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
using Roadie.Library.Identity;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Roadie.Library.Data
|
||||
{
|
||||
[Table("usertrack")]
|
||||
public partial class UserTrack : EntityBase
|
||||
{
|
||||
[Column("isDisliked")]
|
||||
public bool? IsDisliked { get; set; }
|
||||
|
||||
[Column("isFavorite")]
|
||||
public bool? IsFavorite { get; set; }
|
||||
|
||||
[Column("lastPlayed")]
|
||||
public DateTime? LastPlayed { get; set; }
|
||||
|
||||
[Column("playedCount")]
|
||||
public int? PlayedCount { get; set; }
|
||||
|
||||
[Column("rating")]
|
||||
public short Rating { get; set; }
|
||||
|
||||
public Track Track { get; set; }
|
||||
|
||||
[Column("trackId")]
|
||||
[Required]
|
||||
public int TrackId { get; set; }
|
||||
|
||||
public ApplicationUser User { get; set; }
|
||||
|
||||
[Column("userId")]
|
||||
[Required]
|
||||
public int UserId { get; set; }
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace Roadie.Library.Enums
|
||||
{
|
||||
public enum ArtistType : int
|
||||
public enum ArtistType : short
|
||||
{
|
||||
Unknown = 0,
|
||||
Person,
|
||||
|
|
|
@ -6,8 +6,9 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace Roadie.Library.Enums
|
||||
{
|
||||
public enum BandStatus
|
||||
public enum BandStatus : short
|
||||
{
|
||||
Unknown = 0,
|
||||
Active,
|
||||
OnHold,
|
||||
SplitUp,
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace Roadie.Library.Enums
|
|||
{
|
||||
public enum BookmarkType : short
|
||||
{
|
||||
Unknown = 0,
|
||||
Artist = 1,
|
||||
Release = 2,
|
||||
Track = 3,
|
||||
|
|
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace Roadie.Library.Enums
|
||||
{
|
||||
public enum RequestStatus
|
||||
public enum RequestStatus : short
|
||||
{
|
||||
New = 0,
|
||||
Processed = 1
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using Microsoft.AspNetCore.Identity;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
@ -36,5 +37,7 @@ namespace Roadie.Library.Identity
|
|||
|
||||
[Column("status")]
|
||||
public short? Status { get; set; }
|
||||
|
||||
public ICollection<UsersInRoles> Users { get; set; }
|
||||
}
|
||||
}
|
|
@ -14,9 +14,13 @@ namespace Roadie.Library.Identity
|
|||
[StringLength(100)]
|
||||
public string ApiToken { get; set; }
|
||||
|
||||
public ICollection<UserArtist> ArtistRatings { get; set; }
|
||||
|
||||
[Column("avatar", TypeName = "blob")]
|
||||
public byte[] Avatar { get; set; }
|
||||
|
||||
public ICollection<Bookmark> Bookmarks { get; set; }
|
||||
|
||||
[Column("createdDate")]
|
||||
public DateTime? CreatedDate { get; set; }
|
||||
|
||||
|
@ -74,6 +78,8 @@ namespace Roadie.Library.Identity
|
|||
[Column("playerTrackLimit")]
|
||||
public short? PlayerTrackLimit { get; set; }
|
||||
|
||||
public ICollection<Playlist> Playlists { get; set; }
|
||||
|
||||
[Column("profile", TypeName = "text")]
|
||||
[StringLength(65535)]
|
||||
public string Profile { get; set; }
|
||||
|
@ -87,13 +93,21 @@ namespace Roadie.Library.Identity
|
|||
[Column("registeredOn")]
|
||||
public DateTime? RegisteredOn { get; set; }
|
||||
|
||||
public ICollection<UserRelease> ReleaseRatings { get; set; }
|
||||
|
||||
public ICollection<Request> Requests { get; set; }
|
||||
|
||||
[Column("roadieId")]
|
||||
[StringLength(36)]
|
||||
public string RoadieId { get; set; }
|
||||
|
||||
public ICollection<UsersInRoles> Roles { get; set; }
|
||||
|
||||
[Column("status")]
|
||||
public short? Status { get; set; }
|
||||
|
||||
public ICollection<Submission> Submissions { get; set; }
|
||||
|
||||
[Column("timeformat")]
|
||||
[StringLength(50)]
|
||||
public string Timeformat { get; set; }
|
||||
|
@ -102,11 +116,11 @@ namespace Roadie.Library.Identity
|
|||
[StringLength(50)]
|
||||
public string Timezone { get; set; }
|
||||
|
||||
public ICollection<UserTrack> TrackRatings { get; set; }
|
||||
|
||||
[Column("username")]
|
||||
[Required]
|
||||
[StringLength(20)]
|
||||
public string Username { get; set; }
|
||||
|
||||
public ICollection<Playlist> Playlists { get; set; }
|
||||
}
|
||||
}
|
|
@ -16,5 +16,8 @@ namespace Roadie.Library.Identity
|
|||
public int UserId { get; set; }
|
||||
[Column("userRoleId")]
|
||||
public int UserRoleId { get; set; }
|
||||
|
||||
public ApplicationUser User { get; set; }
|
||||
public ApplicationRole Role { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue