Updated more models
This commit is contained in:
@@ -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 };
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ public class UserContext : DbContext
|
|||||||
.ToTable("User");
|
.ToTable("User");
|
||||||
|
|
||||||
modelBuilder.Entity<User>(entity =>
|
modelBuilder.Entity<User>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasKey(e => e.Id);
|
entity.HasKey(e => e.Id);
|
||||||
|
|
||||||
entity.Property(e => e.Id)
|
entity.Property(e => e.Id)
|
||||||
.HasColumnType("binary(16)"); // **** Map Guid to BINARY(16) ****
|
.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>()
|
||||||
|
|||||||
@@ -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,7 +7,7 @@ public class AccessLevel
|
|||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
[Newtonsoft.Json.JsonProperty("id")]
|
[Newtonsoft.Json.JsonProperty("id")]
|
||||||
public int Id { get; set; }
|
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")]
|
||||||
|
|||||||
+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; }
|
||||||
|
|||||||
+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 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")]
|
||||||
|
|||||||
+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
|
||||||
|
|||||||
Reference in New Issue
Block a user