#93: Reduce build errors
This commit is contained in:
+4
-2
@@ -6,16 +6,18 @@ namespace Icarus.Models;
|
||||
|
||||
public class Album
|
||||
{
|
||||
#region Properties
|
||||
[JsonProperty("id")]
|
||||
public int Id { get; set; }
|
||||
[JsonProperty("title")]
|
||||
public string Title { get; set; }
|
||||
public string? Title { get; set; }
|
||||
[JsonProperty("album_artist")]
|
||||
[Column("Artist")]
|
||||
public string AlbumArtist { get; set; }
|
||||
public string? AlbumArtist { get; set; }
|
||||
[JsonProperty("song_count")]
|
||||
[NotMapped]
|
||||
public int SongCount { get; set; }
|
||||
[JsonProperty("year")]
|
||||
public int Year { get; set; }
|
||||
#endregion
|
||||
}
|
||||
|
||||
+3
-1
@@ -6,12 +6,14 @@ namespace Icarus.Models;
|
||||
|
||||
public class Artist
|
||||
{
|
||||
#region Properties
|
||||
[JsonProperty("id")]
|
||||
public int Id { get; set; }
|
||||
[JsonProperty("name")]
|
||||
[Column("Artist")]
|
||||
public string Name { get; set; }
|
||||
public string? Name { get; set; }
|
||||
[JsonProperty("song_count")]
|
||||
[NotMapped]
|
||||
public int SongCount { get; set; }
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ namespace Icarus.Models;
|
||||
public class BaseResult
|
||||
{
|
||||
[JsonProperty("message")]
|
||||
public string Message { get; set; }
|
||||
public string? Message { get; set; }
|
||||
}
|
||||
|
||||
+5
-5
@@ -8,13 +8,13 @@ public class CoverArt
|
||||
[JsonProperty("id")]
|
||||
public int Id { get; set; }
|
||||
[JsonProperty("title")]
|
||||
public string SongTitle { get; set; }
|
||||
public string? SongTitle { get; set; }
|
||||
[JsonIgnore]
|
||||
public string Directory { get; set; }
|
||||
public string? Directory { get; set; }
|
||||
[JsonProperty("filename")]
|
||||
public string Filename { get; set; }
|
||||
public string? Filename { get; set; }
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; }
|
||||
public string? Type { get; set; }
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class CoverArt
|
||||
{
|
||||
var fullPath = this.Directory;
|
||||
|
||||
if (fullPath[fullPath.Length -1] != '/')
|
||||
if (fullPath![fullPath.Length -1] != '/')
|
||||
{
|
||||
fullPath += "/";
|
||||
}
|
||||
|
||||
+3
-1
@@ -6,12 +6,14 @@ namespace Icarus.Models;
|
||||
|
||||
public class Genre
|
||||
{
|
||||
#region Properties
|
||||
[JsonProperty("id")]
|
||||
public int Id { get; set; }
|
||||
[JsonProperty("genre")]
|
||||
[Column("Category")]
|
||||
public string GenreName { get; set; }
|
||||
public string? GenreName { get; set; }
|
||||
[JsonProperty("song_count")]
|
||||
[NotMapped]
|
||||
public int SongCount { get; set; }
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -4,14 +4,16 @@ namespace Icarus.Models;
|
||||
|
||||
public class LoginResult : BaseResult
|
||||
{
|
||||
#region Properties
|
||||
[JsonProperty("user_id")]
|
||||
public int UserId { get; set; }
|
||||
[JsonProperty("username")]
|
||||
public string Username { get; set; }
|
||||
public string? Username { get; set; }
|
||||
[JsonProperty("token")]
|
||||
public string Token { get; set; }
|
||||
public string? Token { get; set; }
|
||||
[JsonProperty("token_type")]
|
||||
public string TokenType { get; set; }
|
||||
public string? TokenType { get; set; }
|
||||
[JsonProperty("expiration")]
|
||||
public int Expiration { get; set; }
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -4,8 +4,10 @@ namespace Icarus.Models;
|
||||
|
||||
public class RegisterResult : BaseResult
|
||||
{
|
||||
#region Properties
|
||||
[JsonProperty("username")]
|
||||
public string Username { get; set; }
|
||||
public string? Username { get; set; }
|
||||
[JsonProperty("successfully_registered")]
|
||||
public bool SuccessfullyRegistered { get; set; }
|
||||
#endregion
|
||||
}
|
||||
|
||||
+1
-3
@@ -80,7 +80,7 @@ public class Song
|
||||
{
|
||||
var fullPath = SongDirectory;
|
||||
|
||||
if (fullPath[fullPath.Length -1] != '/')
|
||||
if (fullPath![fullPath.Length -1] != '/')
|
||||
{
|
||||
fullPath += "/";
|
||||
}
|
||||
@@ -95,7 +95,6 @@ public class Song
|
||||
int length = Constants.DirectoryPaths.FILENAME_LENGTH;
|
||||
string chars = Constants.DirectoryPaths.FILENAME_CHARACTERS;
|
||||
var filename = this.Generate(length, chars);
|
||||
// var extension = Icarus.Constants.FileExtensions.DEFAULT_AUDIO_EXTENSION;
|
||||
var extension = this.DetermineFileExtension(flag);
|
||||
|
||||
return includeExtension ? $"{filename}{extension}" : filename;
|
||||
@@ -104,7 +103,6 @@ public class Song
|
||||
{
|
||||
int length = Constants.DirectoryPaths.FILENAME_LENGTH;
|
||||
string chars = Constants.DirectoryPaths.FILENAME_CHARACTERS;
|
||||
// var extension = Icarus.Constants.FileExtensions.DEFAULT_AUDIO_EXTENSION;
|
||||
var extension = this.DetermineFileExtension(flag);
|
||||
var filename = await Task.Run(() =>
|
||||
{
|
||||
|
||||
+3
-1
@@ -2,7 +2,9 @@ namespace Icarus.Models;
|
||||
|
||||
public class SongData
|
||||
{
|
||||
#region Properties
|
||||
public int ID { get; set; }
|
||||
public byte[] Data { get; set; }
|
||||
public byte[]? Data { get; set; }
|
||||
public int SongID { get; set; }
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -4,8 +4,10 @@ namespace Icarus.Models;
|
||||
|
||||
public class SongResult
|
||||
{
|
||||
#region Properties
|
||||
[JsonProperty("message")]
|
||||
public string Message { get; set; }
|
||||
public string? Message { get; set; }
|
||||
[JsonProperty("song_title")]
|
||||
public string SongTitle { get; set; }
|
||||
public string? SongTitle { get; set; }
|
||||
#endregion
|
||||
}
|
||||
|
||||
+6
-14
@@ -1,6 +1,3 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
@@ -10,13 +7,13 @@ public class Token
|
||||
{
|
||||
#region Properties
|
||||
[JsonProperty("scope")]
|
||||
public string Scope { get; set; }
|
||||
public string? Scope { get; set; }
|
||||
[JsonProperty("exp")]
|
||||
public int Expiration { get; set; }
|
||||
[JsonProperty("aud")]
|
||||
public string Audience { get; set; }
|
||||
public string? Audience { get; set; }
|
||||
[JsonProperty("iss")]
|
||||
public string Issuer { get; set; }
|
||||
public string? Issuer { get; set; }
|
||||
[JsonProperty("iat")]
|
||||
public int Issued { get; set; }
|
||||
#endregion
|
||||
@@ -24,29 +21,24 @@ public class Token
|
||||
#region Methods
|
||||
public bool TokenExpired()
|
||||
{
|
||||
var result = false;
|
||||
var currentDate = DateTime.Now;
|
||||
|
||||
var currentDateInSeconds = Math.Floor((currentDate - DateTime.UnixEpoch).TotalSeconds);
|
||||
|
||||
result = (currentDateInSeconds >= Expiration) ? true : false;
|
||||
var result = (currentDateInSeconds >= Expiration) ? true : false;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool ContainsScope(string desiredScope)
|
||||
{
|
||||
var result = false;
|
||||
result = Scope.Contains(desiredScope);
|
||||
var result = Scope!.Contains(desiredScope);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool Erroneous()
|
||||
{
|
||||
var result = true;
|
||||
Func<string, bool> isEmpty = a => string.IsNullOrEmpty(a);
|
||||
result = (!isEmpty(Scope) && !isEmpty(Audience) && !isEmpty(Issuer) &&
|
||||
var result = (!isEmpty(Scope!) && !isEmpty(Audience!) && !isEmpty(Issuer!) &&
|
||||
Expiration > 0 && Issued > 0) ? false : true;
|
||||
|
||||
return result;
|
||||
|
||||
+10
-10
@@ -14,39 +14,39 @@ public class User
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
[JsonProperty("username")]
|
||||
public string Username { get; set; }
|
||||
public string? Username { get; set; }
|
||||
[JsonProperty("password")]
|
||||
public string Password { get; set; }
|
||||
public string? Password { get; set; }
|
||||
[JsonProperty("email")]
|
||||
public string Email { get; set; }
|
||||
public string? Email { get; set; }
|
||||
[JsonProperty("phone")]
|
||||
[Column("Phone")]
|
||||
public string Phone { get; set; }
|
||||
public string? Phone { get; set; }
|
||||
[JsonProperty("firstname")]
|
||||
public string Firstname { get; set; }
|
||||
public string? Firstname { get; set; }
|
||||
[JsonProperty("lastname")]
|
||||
public string Lastname { get; set; }
|
||||
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; }
|
||||
public string? Status { get; set; }
|
||||
[JsonProperty("last_login")]
|
||||
public DateTime? LastLogin { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[NotMapped]
|
||||
public System.Collections.Generic.IEnumerable<string> Roles { get; set; }
|
||||
public System.Collections.Generic.IEnumerable<string>? Roles { get; set; }
|
||||
#endregion
|
||||
|
||||
|
||||
#region Methods
|
||||
public System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> Claims()
|
||||
{
|
||||
var claims = new System.Collections.Generic.List<System.Security.Claims.Claim> { new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Name, Username) };
|
||||
claims.AddRange(Roles.Select(role => new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Role, role)));
|
||||
var claims = new System.Collections.Generic.List<System.Security.Claims.Claim> { new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Name, Username!) };
|
||||
claims.AddRange(Roles!.Select(role => new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Role, role)));
|
||||
|
||||
return claims;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user