Change id types (#114)
* Change id types * Updated more models * Saving changes * Should be it
This commit was merged in pull request #114.
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
# Top-most EditorConfig file
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.cs]
|
||||||
|
# Use 'var' when possible
|
||||||
|
csharp_style_var_for_built_in_types = true:suggestion
|
||||||
|
csharp_style_var_when_type_is_apparent = true:suggestion
|
||||||
|
csharp_style_var_elsewhere = true:suggestion
|
||||||
|
|
||||||
|
# Use expression body for methods
|
||||||
|
csharp_style_expression_bodied_methods = true:silent
|
||||||
@@ -149,7 +149,7 @@ public class TokenManager : BaseManager
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int? RetrieveUserIdFromToken(string token)
|
public Guid? RetrieveUserIdFromToken(string token)
|
||||||
{
|
{
|
||||||
var parsedToken = this.ContainsBearer(token) ? this.StripBearer(token) : token;
|
var parsedToken = this.ContainsBearer(token) ? this.StripBearer(token) : token;
|
||||||
var tokenHandler = new JwtSecurityTokenHandler();
|
var tokenHandler = new JwtSecurityTokenHandler();
|
||||||
@@ -159,7 +159,15 @@ public class TokenManager : BaseManager
|
|||||||
{
|
{
|
||||||
if (item.Key == "user_id")
|
if (item.Key == "user_id")
|
||||||
{
|
{
|
||||||
return Convert.ToInt32(item.Value);
|
if (item.Value != null)
|
||||||
|
{
|
||||||
|
var id = item.Value.ToString();
|
||||||
|
return Guid.Parse(id!);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ public class AccessLevelController : BaseController
|
|||||||
|
|
||||||
#region HTTP Routes
|
#region HTTP Routes
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult GetAccessLevels(int? id, int? songId)
|
public IActionResult GetAccessLevels(Guid? id, Guid? songId)
|
||||||
{
|
{
|
||||||
var accLevel = new Models.AccessLevel { Id = 0 };
|
var accLevel = new Models.AccessLevel { };
|
||||||
var accessLevelContext = new Database.Contexts.AccessLevelContext(_connectionString!);
|
var accessLevelContext = new Database.Contexts.AccessLevelContext(_connectionString!);
|
||||||
|
|
||||||
if (id != null)
|
if (id != null)
|
||||||
@@ -43,7 +43,7 @@ public class AccessLevelController : BaseController
|
|||||||
|
|
||||||
var response = new GetAccessLevelsResponse { Data = new List<Models.AccessLevel>() };
|
var response = new GetAccessLevelsResponse { Data = new List<Models.AccessLevel>() };
|
||||||
|
|
||||||
if (accLevel?.Id > 0)
|
if (accLevel?.Id.ToString().Length > 0)
|
||||||
{
|
{
|
||||||
response.Subject = "Successful";
|
response.Subject = "Successful";
|
||||||
response.Data.Add(accLevel);
|
response.Data.Add(accLevel);
|
||||||
@@ -57,7 +57,7 @@ public class AccessLevelController : BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPatch("{id}")]
|
[HttpPatch("{id}")]
|
||||||
public IActionResult UpdateAccessLevel(int id, [FromBody] Models.AccessLevel accessLevel)
|
public IActionResult UpdateAccessLevel(Guid id, [FromBody] Models.AccessLevel accessLevel)
|
||||||
{
|
{
|
||||||
var response = new UpdateAccessLevelResponse { Data = new List<Models.AccessLevel>() };
|
var response = new UpdateAccessLevelResponse { Data = new List<Models.AccessLevel>() };
|
||||||
var targetLevel = accessLevel.Level;
|
var targetLevel = accessLevel.Level;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class AlbumController : BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
public IActionResult GetAlbum(int id)
|
public IActionResult GetAlbum(Guid id)
|
||||||
{
|
{
|
||||||
Album album = new Album { Id = id };
|
Album album = new Album { Id = id };
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class ArtistController : BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
public IActionResult GetArtist(int id)
|
public IActionResult GetArtist(Guid id)
|
||||||
{
|
{
|
||||||
Artist artist = new Artist { Id = id };
|
Artist artist = new Artist { Id = id };
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class CoverArtController : BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
public IActionResult GetCoverArt(int id)
|
public IActionResult GetCoverArt(Guid id)
|
||||||
{
|
{
|
||||||
var coverArt = new CoverArt { Id = id };
|
var coverArt = new CoverArt { Id = id };
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ public class CoverArtController : BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("data/download/{id}")]
|
[HttpGet("data/download/{id}")]
|
||||||
public async Task<IActionResult> Download(int id, [FromQuery] bool? randomizeFilename)
|
public async Task<IActionResult> Download(Guid id, [FromQuery] bool? randomizeFilename)
|
||||||
{
|
{
|
||||||
var songContext = new SongContext(_connectionString!);
|
var songContext = new SongContext(_connectionString!);
|
||||||
var covMgr = new CoverArtManager(this._config!);
|
var covMgr = new CoverArtManager(this._config!);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class GenreController : BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
public IActionResult GetGenre(int id)
|
public IActionResult GetGenre(Guid id)
|
||||||
{
|
{
|
||||||
var genre = new Genre { Id = id };
|
var genre = new Genre { Id = id };
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class SongCompressedDataController : BaseController
|
|||||||
|
|
||||||
#region API Routes
|
#region API Routes
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
public async Task<IActionResult> DownloadCompressedSong(int id, [FromQuery] bool? randomizeFilename)
|
public async Task<IActionResult> DownloadCompressedSong(Guid id, [FromQuery] bool? randomizeFilename)
|
||||||
{
|
{
|
||||||
var context = new SongContext(_connectionString!);
|
var context = new SongContext(_connectionString!);
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class SongController : BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
public IActionResult GetSong(int id)
|
public IActionResult GetSong(Guid id)
|
||||||
{
|
{
|
||||||
var context = new SongContext(_connectionString!);
|
var context = new SongContext(_connectionString!);
|
||||||
|
|
||||||
@@ -65,14 +65,14 @@ public class SongController : BaseController
|
|||||||
|
|
||||||
Console.WriteLine("Here");
|
Console.WriteLine("Here");
|
||||||
|
|
||||||
if (song.Id != 0)
|
if (song.Id.ToString().Length != 0)
|
||||||
return Ok(song);
|
return Ok(song);
|
||||||
else
|
else
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
public IActionResult UpdateSong(int id, [FromBody] Song song)
|
public IActionResult UpdateSong(Guid id, [FromBody] Song song)
|
||||||
{
|
{
|
||||||
song.Id = id;
|
song.Id = id;
|
||||||
Console.WriteLine("Retrieving filepath of song");
|
Console.WriteLine("Retrieving filepath of song");
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class SongDataController : BaseController
|
|||||||
|
|
||||||
|
|
||||||
[HttpGet("download/{id}")]
|
[HttpGet("download/{id}")]
|
||||||
public IActionResult Download(int id, [FromQuery] bool? randomizeFilename)
|
public IActionResult Download(Guid id, [FromQuery] bool? randomizeFilename)
|
||||||
{
|
{
|
||||||
var tokenManager = new TokenManager(this._config!);
|
var tokenManager = new TokenManager(this._config!);
|
||||||
var songContext = new SongContext(this._connectionString!);
|
var songContext = new SongContext(this._connectionString!);
|
||||||
@@ -172,7 +172,7 @@ public class SongDataController : BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpDelete("delete/{id}")]
|
[HttpDelete("delete/{id}")]
|
||||||
public IActionResult DeleteSong(int id)
|
public IActionResult DeleteSong(Guid id)
|
||||||
{
|
{
|
||||||
var songContext = new SongContext(_connectionString!);
|
var songContext = new SongContext(_connectionString!);
|
||||||
var songMetaData = songContext.RetrieveRecord(new Song { Id = id });
|
var songMetaData = songContext.RetrieveRecord(new Song { Id = id });
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class SongStreamController : BaseController
|
|||||||
|
|
||||||
#region HTTP endpoints
|
#region HTTP endpoints
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
public async Task<IActionResult> StreamSong(int id)
|
public async Task<IActionResult> StreamSong(Guid id)
|
||||||
{
|
{
|
||||||
var context = new SongContext(_config!.GetConnectionString("DefaultConnection")!);
|
var context = new SongContext(_config!.GetConnectionString("DefaultConnection")!);
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class AccessLevelContext : DbContext
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
public Models.AccessLevel? GetAccessLevel(int songId)
|
public Models.AccessLevel? GetAccessLevel(Guid songId)
|
||||||
{
|
{
|
||||||
var accessLevel = this.AccessLevels!.FirstOrDefault(acc => acc.SongId == songId);
|
var accessLevel = this.AccessLevels!.FirstOrDefault(acc => acc.SongId == songId);
|
||||||
return accessLevel;
|
return accessLevel;
|
||||||
@@ -30,6 +30,14 @@ public class AccessLevelContext : DbContext
|
|||||||
{
|
{
|
||||||
modelBuilder.Entity<Models.AccessLevel>().ToTable("AccessLevel");
|
modelBuilder.Entity<Models.AccessLevel>().ToTable("AccessLevel");
|
||||||
|
|
||||||
|
modelBuilder.Entity<Models.AccessLevel>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => e.Id);
|
||||||
|
|
||||||
|
entity.Property(e => e.Id)
|
||||||
|
.HasColumnType("binary(16)");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<Models.AccessLevel>().Property(m => m.Level).IsRequired(true);
|
modelBuilder.Entity<Models.AccessLevel>().Property(m => m.Level).IsRequired(true);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -18,6 +18,14 @@ public class AlbumContext : DbContext
|
|||||||
{
|
{
|
||||||
modelBuilder.Entity<Album>()
|
modelBuilder.Entity<Album>()
|
||||||
.ToTable("Album");
|
.ToTable("Album");
|
||||||
|
|
||||||
|
modelBuilder.Entity<Album>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => e.Id);
|
||||||
|
|
||||||
|
entity.Property(e => e.Id)
|
||||||
|
.HasColumnType("binary(16)");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public Album RetrieveRecord(Album album)
|
public Album RetrieveRecord(Album album)
|
||||||
|
|||||||
@@ -18,6 +18,14 @@ public class ArtistContext : DbContext
|
|||||||
{
|
{
|
||||||
modelBuilder.Entity<Artist>()
|
modelBuilder.Entity<Artist>()
|
||||||
.ToTable("Artist");
|
.ToTable("Artist");
|
||||||
|
|
||||||
|
modelBuilder.Entity<Artist>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => e.Id);
|
||||||
|
|
||||||
|
entity.Property(e => e.Id)
|
||||||
|
.HasColumnType("binary(16)");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public Artist RetrieveRecord(Artist artist)
|
public Artist RetrieveRecord(Artist artist)
|
||||||
|
|||||||
@@ -20,6 +20,13 @@ public class CoverArtContext : DbContext
|
|||||||
{
|
{
|
||||||
modelBuilder.Entity<CoverArt>()
|
modelBuilder.Entity<CoverArt>()
|
||||||
.ToTable("CoverArt");
|
.ToTable("CoverArt");
|
||||||
|
modelBuilder.Entity<CoverArt>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => e.Id);
|
||||||
|
|
||||||
|
entity.Property(e => e.Id)
|
||||||
|
.HasColumnType("binary(16)");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoverArt RetrieveRecord(CoverArt cover)
|
public CoverArt RetrieveRecord(CoverArt cover)
|
||||||
|
|||||||
@@ -20,6 +20,14 @@ public class GenreContext : DbContext
|
|||||||
{
|
{
|
||||||
modelBuilder.Entity<Genre>()
|
modelBuilder.Entity<Genre>()
|
||||||
.ToTable("Genre");
|
.ToTable("Genre");
|
||||||
|
|
||||||
|
modelBuilder.Entity<Genre>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => e.Id);
|
||||||
|
|
||||||
|
entity.Property(e => e.Id)
|
||||||
|
.HasColumnType("binary(16)");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,14 @@ public class SongContext : DbContext
|
|||||||
modelBuilder.Entity<Song>()
|
modelBuilder.Entity<Song>()
|
||||||
.ToTable("Song");
|
.ToTable("Song");
|
||||||
|
|
||||||
|
modelBuilder.Entity<Song>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => e.Id);
|
||||||
|
|
||||||
|
entity.Property(e => e.Id)
|
||||||
|
.HasColumnType("binary(16)");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<Song>()
|
modelBuilder.Entity<Song>()
|
||||||
.Property(s => s.Year)
|
.Property(s => s.Year)
|
||||||
.IsRequired(false);
|
.IsRequired(false);
|
||||||
|
|||||||
@@ -23,6 +23,14 @@ public class UserContext : DbContext
|
|||||||
{
|
{
|
||||||
modelBuilder.Entity<User>()
|
modelBuilder.Entity<User>()
|
||||||
.ToTable("User");
|
.ToTable("User");
|
||||||
|
|
||||||
|
modelBuilder.Entity<User>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => e.Id);
|
||||||
|
|
||||||
|
entity.Property(e => e.Id)
|
||||||
|
.HasColumnType("binary(16)"); // **** Map Guid to BINARY(16) ****
|
||||||
|
});
|
||||||
modelBuilder.Entity<User>()
|
modelBuilder.Entity<User>()
|
||||||
.Property(u => u.LastLogin).IsRequired(false);
|
.Property(u => u.LastLogin).IsRequired(false);
|
||||||
modelBuilder.Entity<User>()
|
modelBuilder.Entity<User>()
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Top-most EditorConfig file
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.cs]
|
||||||
|
# Use 'var' when possible
|
||||||
|
csharp_style_var_for_built_in_types = true:suggestion
|
||||||
|
csharp_style_var_when_type_is_apparent = true:suggestion
|
||||||
|
csharp_style_var_elsewhere = true:suggestion
|
||||||
|
|
||||||
|
# Use expression body for methods
|
||||||
|
csharp_style_expression_bodied_methods = true:silent
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace Icarus.Models;
|
namespace Icarus.Models;
|
||||||
@@ -6,11 +7,12 @@ public class AccessLevel
|
|||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
[Newtonsoft.Json.JsonProperty("id")]
|
[Newtonsoft.Json.JsonProperty("id")]
|
||||||
public int Id { get; set; }
|
[Key]
|
||||||
|
public Guid Id { get; set; }
|
||||||
[Newtonsoft.Json.JsonProperty("level")]
|
[Newtonsoft.Json.JsonProperty("level")]
|
||||||
public string? Level { get; set; }
|
public string? Level { get; set; }
|
||||||
[Newtonsoft.Json.JsonProperty("song_id")]
|
[Newtonsoft.Json.JsonProperty("song_id")]
|
||||||
public int SongId { get; set; }
|
public Guid SongId { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
|||||||
+3
-1
@@ -1,3 +1,4 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -8,7 +9,8 @@ public class Album
|
|||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
[JsonProperty("id")]
|
[JsonProperty("id")]
|
||||||
public int Id { get; set; }
|
[Key]
|
||||||
|
public Guid Id { get; set; }
|
||||||
[JsonProperty("title")]
|
[JsonProperty("title")]
|
||||||
public string? Title { get; set; }
|
public string? Title { get; set; }
|
||||||
[JsonProperty("album_artist")]
|
[JsonProperty("album_artist")]
|
||||||
|
|||||||
+3
-1
@@ -1,3 +1,4 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -8,7 +9,8 @@ public class Artist
|
|||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
[JsonProperty("id")]
|
[JsonProperty("id")]
|
||||||
public int Id { get; set; }
|
[Key]
|
||||||
|
public Guid Id { get; set; }
|
||||||
[JsonProperty("name")]
|
[JsonProperty("name")]
|
||||||
[Column("Artist")]
|
[Column("Artist")]
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
|||||||
+4
-1
@@ -1,3 +1,5 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Icarus.Models;
|
namespace Icarus.Models;
|
||||||
@@ -6,7 +8,8 @@ public class CoverArt
|
|||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
[JsonProperty("id")]
|
[JsonProperty("id")]
|
||||||
public int Id { get; set; }
|
[Key]
|
||||||
|
public Guid Id { get; set; }
|
||||||
[JsonProperty("title")]
|
[JsonProperty("title")]
|
||||||
public string? SongTitle { get; set; }
|
public string? SongTitle { get; set; }
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Icarus.Models;
|
namespace Icarus.Models;
|
||||||
|
|
||||||
public enum CreateFileResult
|
public enum CreateFileResult
|
||||||
|
|||||||
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -8,7 +9,7 @@ public class Genre
|
|||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
[JsonProperty("id")]
|
[JsonProperty("id")]
|
||||||
public int Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
[JsonProperty("genre")]
|
[JsonProperty("genre")]
|
||||||
[Column("Category")]
|
[Column("Category")]
|
||||||
public string? GenreName { get; set; }
|
public string? GenreName { get; set; }
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ public class LoginResult : BaseResult
|
|||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
[JsonProperty("user_id")]
|
[JsonProperty("user_id")]
|
||||||
public int UserId { get; set; }
|
public Guid UserId { get; set; }
|
||||||
[JsonProperty("username")]
|
[JsonProperty("username")]
|
||||||
public string? Username { get; set; }
|
public string? Username { get; set; }
|
||||||
[JsonProperty("token")]
|
[JsonProperty("token")]
|
||||||
|
|||||||
+8
-6
@@ -1,3 +1,4 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -8,7 +9,8 @@ public class Song
|
|||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
[JsonProperty("id")]
|
[JsonProperty("id")]
|
||||||
public int Id { get; set; }
|
[Key]
|
||||||
|
public Guid Id { get; set; }
|
||||||
[JsonProperty("title")]
|
[JsonProperty("title")]
|
||||||
public string? Title { get; set; }
|
public string? Title { get; set; }
|
||||||
[JsonProperty("album")]
|
[JsonProperty("album")]
|
||||||
@@ -39,17 +41,17 @@ public class Song
|
|||||||
[JsonProperty("disc_count")]
|
[JsonProperty("disc_count")]
|
||||||
public int DiscCount { get; set; } = 0;
|
public int DiscCount { get; set; } = 0;
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public int? AlbumId { get; set; }
|
public Guid? AlbumId { get; set; }
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public int? ArtistId { get; set; }
|
public Guid? ArtistId { get; set; }
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public int? GenreId { get; set; }
|
public Guid? GenreId { get; set; }
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public int? CoverArtId { get; set; }
|
public Guid? CoverArtId { get; set; }
|
||||||
[JsonProperty("date_created")]
|
[JsonProperty("date_created")]
|
||||||
public DateTime DateCreated { get; set; }
|
public DateTime DateCreated { get; set; }
|
||||||
[JsonProperty("user_id")]
|
[JsonProperty("user_id")]
|
||||||
public int UserId { get; set; }
|
public Guid UserId { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ namespace Icarus.Models;
|
|||||||
public class SongData
|
public class SongData
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
public int ID { get; set; }
|
public Guid ID { get; set; }
|
||||||
public byte[]? Data { get; set; }
|
public byte[]? Data { get; set; }
|
||||||
public int SongID { get; set; }
|
public int SongID { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ public class User
|
|||||||
[JsonProperty("id")]
|
[JsonProperty("id")]
|
||||||
[Column("Id")]
|
[Column("Id")]
|
||||||
[Key]
|
[Key]
|
||||||
public int Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
[JsonProperty("username")]
|
[JsonProperty("username")]
|
||||||
public string? Username { get; set; }
|
public string? Username { get; set; }
|
||||||
[JsonProperty("password")]
|
[JsonProperty("password")]
|
||||||
|
|||||||
Reference in New Issue
Block a user