Refactoring
This commit is contained in:
+11
-11
@@ -9,17 +9,17 @@ namespace Icarus.Models
|
||||
public class Album
|
||||
{
|
||||
[JsonProperty("album_id")]
|
||||
public int AlbumID { get; set; }
|
||||
[JsonProperty("title")]
|
||||
public string Title { get; set; }
|
||||
[JsonProperty("album_artist")]
|
||||
public string AlbumArtist { get; set; }
|
||||
[JsonProperty("song_count")]
|
||||
[NotMapped]
|
||||
public int SongCount { get; set; }
|
||||
public int AlbumID { get; set; }
|
||||
[JsonProperty("title")]
|
||||
public string Title { get; set; }
|
||||
[JsonProperty("album_artist")]
|
||||
public string AlbumArtist { get; set; }
|
||||
[JsonProperty("song_count")]
|
||||
[NotMapped]
|
||||
public int SongCount { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[NotMapped]
|
||||
public List<Song> Songs { get; set; }
|
||||
[JsonIgnore]
|
||||
[NotMapped]
|
||||
public List<Song> Songs { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
+9
-9
@@ -9,15 +9,15 @@ namespace Icarus.Models
|
||||
public class Artist
|
||||
{
|
||||
[JsonProperty("artist_id")]
|
||||
public int ArtistID { get; set; }
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
[JsonProperty("song_count")]
|
||||
[NotMapped]
|
||||
public int SongCount { get; set; }
|
||||
public int ArtistID { get; set; }
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
[JsonProperty("song_count")]
|
||||
[NotMapped]
|
||||
public int SongCount { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[NotMapped]
|
||||
public List<Song> Songs { get; set; }
|
||||
[JsonIgnore]
|
||||
[NotMapped]
|
||||
public List<Song> Songs { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@ namespace Icarus.Models
|
||||
public class BaseResult
|
||||
{
|
||||
[JsonProperty("message")]
|
||||
public string Message { get; set; }
|
||||
public string Message { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -12,12 +12,12 @@ namespace Icarus.Models
|
||||
[JsonProperty("cover_art_id")]
|
||||
public int CoverArtID { get; set; }
|
||||
[JsonProperty("title")]
|
||||
public string SongTitle { get; set; }
|
||||
public string SongTitle { get; set; }
|
||||
[JsonIgnore]
|
||||
public string ImagePath { get; set; }
|
||||
public string ImagePath { get; set; }
|
||||
[JsonProperty("song_id")]
|
||||
public int SongId { get; set; }
|
||||
[JsonIgnore]
|
||||
[JsonIgnore]
|
||||
[NotMapped]
|
||||
public List<Song> Songs { get; set; }
|
||||
}
|
||||
|
||||
+9
-10
@@ -9,15 +9,14 @@ namespace Icarus.Models
|
||||
public class Genre
|
||||
{
|
||||
[JsonProperty("genre_id")]
|
||||
public int GenreID { get; set; }
|
||||
[JsonProperty("genre")]
|
||||
public string GenreName { get; set; }
|
||||
[JsonProperty("song_count")]
|
||||
[NotMapped]
|
||||
public int SongCount { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[NotMapped]
|
||||
public List<Song> Songs { get; set; }
|
||||
public int GenreID { get; set; }
|
||||
[JsonProperty("genre")]
|
||||
public string GenreName { get; set; }
|
||||
[JsonProperty("song_count")]
|
||||
[NotMapped]
|
||||
public int SongCount { get; set; }
|
||||
[JsonIgnore]
|
||||
[NotMapped]
|
||||
public List<Song> Songs { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,14 +7,14 @@ namespace Icarus.Models
|
||||
public class LoginResult : BaseResult
|
||||
{
|
||||
[JsonProperty("user_id")]
|
||||
public int UserID { get; set; }
|
||||
[JsonProperty("username")]
|
||||
public string Username { get; set; }
|
||||
[JsonProperty("token")]
|
||||
public string Token { get; set; }
|
||||
[JsonProperty("token_type")]
|
||||
public string TokenType { get; set; }
|
||||
[JsonProperty("expiration")]
|
||||
public int Expiration { get; set; }
|
||||
public int UserID { get; set; }
|
||||
[JsonProperty("username")]
|
||||
public string Username { get; set; }
|
||||
[JsonProperty("token")]
|
||||
public string Token { get; set; }
|
||||
[JsonProperty("token_type")]
|
||||
public string TokenType { get; set; }
|
||||
[JsonProperty("expiration")]
|
||||
public int Expiration { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ namespace Icarus.Models
|
||||
public class RegisterResult : BaseResult
|
||||
{
|
||||
[JsonProperty("username")]
|
||||
public string Username { get; set; }
|
||||
[JsonProperty("successfully_registered")]
|
||||
public bool SuccessfullyRegistered { get; set; }
|
||||
public string Username { get; set; }
|
||||
[JsonProperty("successfully_registered")]
|
||||
public bool SuccessfullyRegistered { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
+47
-50
@@ -7,60 +7,57 @@ namespace Icarus.Models
|
||||
{
|
||||
public class Song
|
||||
{
|
||||
#region Properties
|
||||
[JsonProperty("song_id")]
|
||||
public int SongID { get; set; }
|
||||
[JsonProperty("title")]
|
||||
public string Title { get; set; }
|
||||
[JsonProperty("album")]
|
||||
[Column("Album")]
|
||||
public string AlbumTitle { get; set; }
|
||||
[JsonProperty("artist")]
|
||||
public string Artist { get; set; }
|
||||
[JsonProperty("year")]
|
||||
public int? Year { get; set; }
|
||||
[JsonProperty("genre")]
|
||||
public string Genre { get; set; }
|
||||
[JsonProperty("duration")]
|
||||
public int Duration { get; set; }
|
||||
[JsonProperty("filename")]
|
||||
public string Filename { get; set; }
|
||||
[JsonProperty("song_path")]
|
||||
public string SongPath { get; set; }
|
||||
[JsonProperty("track")]
|
||||
public int Track { get; set; } = 0;
|
||||
[JsonProperty("disc")]
|
||||
public int Disc { get; set; } = 0;
|
||||
public int SongID { get; set; }
|
||||
[JsonProperty("title")]
|
||||
public string Title { get; set; }
|
||||
[JsonProperty("album")]
|
||||
[Column("Album")]
|
||||
public string AlbumTitle { get; set; }
|
||||
[JsonProperty("artist")]
|
||||
public string Artist { get; set; }
|
||||
[JsonProperty("year")]
|
||||
public int? Year { get; set; }
|
||||
[JsonProperty("genre")]
|
||||
public string Genre { get; set; }
|
||||
[JsonProperty("duration")]
|
||||
public int Duration { get; set; }
|
||||
[JsonProperty("filename")]
|
||||
public string Filename { get; set; }
|
||||
[JsonIgnore]
|
||||
public string SongDirectory { get; set; }
|
||||
[JsonProperty("track")]
|
||||
public int Track { get; set; } = 0;
|
||||
[JsonProperty("disc")]
|
||||
public int Disc { get; set; } = 0;
|
||||
[JsonIgnore]
|
||||
public int? AlbumID { get; set; }
|
||||
[JsonIgnore]
|
||||
public int? ArtistID { get; set; }
|
||||
[JsonIgnore]
|
||||
public int? GenreID { get; set; }
|
||||
[JsonIgnore]
|
||||
public int? CoverArtID { get; set; }
|
||||
[JsonProperty("date_created")]
|
||||
public DateTime DateCreated { get; set; }
|
||||
#endregion
|
||||
|
||||
// [JsonIgnore]
|
||||
// public Album Album { get; set; }
|
||||
[JsonIgnore]
|
||||
public int? AlbumID { get; set; }
|
||||
|
||||
/**
|
||||
[JsonIgnore]
|
||||
public Artist SongArtist { get; set; }
|
||||
*/
|
||||
[JsonIgnore]
|
||||
public int? ArtistID { get; set; }
|
||||
/**
|
||||
[JsonIgnore]
|
||||
public Genre SongGenre { get; set; }
|
||||
*/
|
||||
[JsonIgnore]
|
||||
public int? GenreID { get; set; }
|
||||
#region Methods
|
||||
public string SongPath()
|
||||
{
|
||||
var fullPath = SongDirectory;
|
||||
|
||||
// [JsonIgnore]
|
||||
// public Year SongYear { get; set; }
|
||||
// [JsonIgnore]
|
||||
// public int? YearId { get; set; }
|
||||
if (fullPath[fullPath.Length -1] != '/')
|
||||
{
|
||||
fullPath += "/";
|
||||
}
|
||||
|
||||
/**
|
||||
[JsonIgnore]
|
||||
public CoverArt SongCoverArt { get; set; }
|
||||
*/
|
||||
[JsonIgnore]
|
||||
public int? CoverArtID { get; set; }
|
||||
[JsonProperty("date_created")]
|
||||
public DateTime DateCreated { get; set; }
|
||||
fullPath += Filename;
|
||||
|
||||
return fullPath;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ namespace Icarus.Models
|
||||
public class SongData
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public byte[] Data { get; set; }
|
||||
public int SongID { get; set; }
|
||||
public byte[] Data { get; set; }
|
||||
public int SongID { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
+25
-25
@@ -6,34 +6,34 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace Icarus.Models
|
||||
{
|
||||
[Table("User")]
|
||||
[Table("User")]
|
||||
public class User
|
||||
{
|
||||
[JsonProperty("user_id")]
|
||||
[Column("UserID")]
|
||||
[Key]
|
||||
public int UserID { get; set; }
|
||||
[JsonProperty("username")]
|
||||
public string Username { get; set; }
|
||||
[JsonProperty("password")]
|
||||
public string Password { get; set; }
|
||||
[JsonProperty("email")]
|
||||
public string Email { get; set; }
|
||||
[JsonProperty("phone")]
|
||||
[Column("Phone")]
|
||||
public string Phone { get; set; }
|
||||
[JsonProperty("first_name")]
|
||||
public string Firstname { get; set; }
|
||||
[JsonProperty("last_name")]
|
||||
public string Lastname { get; set; }
|
||||
[JsonProperty("email_verified")]
|
||||
[NotMapped]
|
||||
public bool EmailVerified { get; set; }
|
||||
[Column("UserID")]
|
||||
[Key]
|
||||
public int UserID { get; set; }
|
||||
[JsonProperty("username")]
|
||||
public string Username { get; set; }
|
||||
[JsonProperty("password")]
|
||||
public string Password { get; set; }
|
||||
[JsonProperty("email")]
|
||||
public string Email { get; set; }
|
||||
[JsonProperty("phone")]
|
||||
[Column("Phone")]
|
||||
public string Phone { get; set; }
|
||||
[JsonProperty("first_name")]
|
||||
public string Firstname { get; set; }
|
||||
[JsonProperty("last_name")]
|
||||
public string Lastname { get; set; }
|
||||
[JsonProperty("email_verified")]
|
||||
[NotMapped]
|
||||
public bool EmailVerified { get; set; }
|
||||
[JsonProperty("date_created")]
|
||||
public DateTime DateCreated { get; set; }
|
||||
[JsonProperty("status")]
|
||||
public string Status { get; set; }
|
||||
[JsonProperty("last_login")]
|
||||
public DateTime? LastLogin { get; set; }
|
||||
public DateTime DateCreated { get; set; }
|
||||
[JsonProperty("status")]
|
||||
public string Status { get; set; }
|
||||
[JsonProperty("last_login")]
|
||||
public DateTime? LastLogin { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user