Добавлен playlist shared
This commit is contained in:
10
PlaylistShared/Data/Entities/ApplicationUser.cs
Normal file
10
PlaylistShared/Data/Entities/ApplicationUser.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace PlaylistShared.Data.Entities;
|
||||
|
||||
public class ApplicationUser : IdentityUser
|
||||
{
|
||||
public string? YandexId { get; set; }
|
||||
public string? AccessToken { get; set; }
|
||||
public string? RefreshToken { get; set; }
|
||||
public DateTime? AccessTokenExpiresAt { get; set; }
|
||||
public string? AvatarUrl { get; set; }
|
||||
}
|
||||
14
PlaylistShared/Data/Entities/PlaylistPermissions.cs
Normal file
14
PlaylistShared/Data/Entities/PlaylistPermissions.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace PlaylistShared.Data.Entities;
|
||||
|
||||
public enum AccessLevel { All, Authorized, None }
|
||||
public enum DeleteAccessLevel { All, Authorized, AdderOnly, OwnerOnly }
|
||||
|
||||
[Owned]
|
||||
public class PlaylistPermissions
|
||||
{
|
||||
public AccessLevel View { get; set; } = AccessLevel.All;
|
||||
public AccessLevel Add { get; set; } = AccessLevel.Authorized;
|
||||
public DeleteAccessLevel Delete { get; set; } = DeleteAccessLevel.OwnerOnly;
|
||||
}
|
||||
23
PlaylistShared/Data/Entities/PlaylistTrack.cs
Normal file
23
PlaylistShared/Data/Entities/PlaylistTrack.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PlaylistShared.Data.Entities;
|
||||
|
||||
public class PlaylistTrack
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid PlaylistId { get; set; }
|
||||
public SharedPlaylist Playlist { get; set; } = null!;
|
||||
|
||||
public string YandexTrackId { get; set; } = null!;
|
||||
public string Title { get; set; } = null!;
|
||||
public string? Artist { get; set; }
|
||||
public string? AlbumTitle { get; set; }
|
||||
public int DurationMs { get; set; }
|
||||
|
||||
public string? AddedByUserId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(AddedByUserId))]
|
||||
public ApplicationUser? AddedByUser { get; set; }
|
||||
|
||||
public DateTime AddedAt { get; set; }
|
||||
}
|
||||
28
PlaylistShared/Data/Entities/SharedPlaylist.cs
Normal file
28
PlaylistShared/Data/Entities/SharedPlaylist.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PlaylistShared.Data.Entities;
|
||||
|
||||
public class SharedPlaylist
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public string OwnerUserId { get; set; } = null!;
|
||||
[ForeignKey(nameof(OwnerUserId))]
|
||||
public ApplicationUser Owner { get; set; } = null!;
|
||||
|
||||
public string YandexPlaylistId { get; set; } = null!;
|
||||
public string Title { get; set; } = null!;
|
||||
public string? Description { get; set; }
|
||||
|
||||
[Required]
|
||||
public string ShareSlug { get; set; } = null!;
|
||||
|
||||
public PlaylistPermissions Permissions { get; set; } = new();
|
||||
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
|
||||
public List<PlaylistTrack> Tracks { get; set; } = new();
|
||||
}
|
||||
Reference in New Issue
Block a user