diff options
| author | ivar <i@oiee.no> | 2024-03-19 01:02:22 +0100 |
|---|---|---|
| committer | ivar <i@oiee.no> | 2024-03-19 01:02:22 +0100 |
| commit | 5f604b3052dab1d51dc130df2470bf330b283ec6 (patch) | |
| tree | ae00e1fe4542850467555b4e3af41964ba8d878b /code/api/Models | |
| parent | 63cf177e8cf22e349534664d59a6926f8b36863d (diff) | |
| download | storage-5f604b3052dab1d51dc130df2470bf330b283ec6.tar.xz storage-5f604b3052dab1d51dc130df2470bf330b283ec6.zip | |
Max lenghts on db schema
Use latest temporal from cdn
Implement majority of translation functionality
Major refinements/bugs
Diffstat (limited to 'code/api/Models')
| -rw-r--r-- | code/api/Models/FileSystemEntry.cs | 4 | ||||
| -rw-r--r-- | code/api/Models/KnownProblem.cs | 20 | ||||
| -rw-r--r-- | code/api/Models/LoggedInUserModel.cs | 8 | ||||
| -rw-r--r-- | code/api/Models/StorageBlobId.cs | 2 |
4 files changed, 14 insertions, 20 deletions
diff --git a/code/api/Models/FileSystemEntry.cs b/code/api/Models/FileSystemEntry.cs index cdb1213..ee57f96 100644 --- a/code/api/Models/FileSystemEntry.cs +++ b/code/api/Models/FileSystemEntry.cs @@ -1,4 +1,4 @@ -namespace I2R.Storage.Api.Models; +namespace Quality.Storage.Api.Models; public class FileSystemEntry { @@ -7,4 +7,4 @@ public class FileSystemEntry public string MimeType { get; set; } public long SizeInBytes { get; set; } public List<FileSystemEntry> Files { get; set; } -}
\ No newline at end of file +} diff --git a/code/api/Models/KnownProblem.cs b/code/api/Models/KnownProblem.cs index 007f79a..c92872f 100644 --- a/code/api/Models/KnownProblem.cs +++ b/code/api/Models/KnownProblem.cs @@ -1,17 +1,11 @@ -namespace I2R.Storage.Api.Models; +namespace Quality.Storage.Api.Models; -public class KnownProblemModel +public class KnownProblemModel(string title = default, string subtitle = default, Dictionary<string, string[]> errors = default) { - public KnownProblemModel(string title = default, string subtitle = default, Dictionary<string, string[]> errors = default) { - Title = title; - Subtitle = subtitle; - Errors = errors ?? new Dictionary<string, string[]>(); - } - - public string Title { get; set; } - public string Subtitle { get; set; } - public Dictionary<string, string[]> Errors { get; set; } - public string TraceId { get; set; } + public string Title { get; set; } = title; + public string Subtitle { get; set; } = subtitle; + public Dictionary<string, string[]> Errors { get; set; } = errors ?? new Dictionary<string, string[]>(); + public string TraceId { get; set; } public void AddError(string field, string errorText) { if (!Errors.ContainsKey(field)) { @@ -23,4 +17,4 @@ public class KnownProblemModel Errors.Add(field, newErrors.ToArray()); } } -}
\ No newline at end of file +} diff --git a/code/api/Models/LoggedInUserModel.cs b/code/api/Models/LoggedInUserModel.cs index 9d9b944..46cea50 100644 --- a/code/api/Models/LoggedInUserModel.cs +++ b/code/api/Models/LoggedInUserModel.cs @@ -1,4 +1,4 @@ -namespace I2R.Storage.Api.Models; +namespace Quality.Storage.Api.Models; public class LoggedInUserModel { @@ -7,12 +7,12 @@ public class LoggedInUserModel public LoggedInUserModel(ClaimsPrincipal user) { Username = user.FindFirstValue(AppClaims.USERNAME); Id = user.FindFirstValue(AppClaims.USER_ID).AsGuid(); - Role = UserRole.FromString(user.FindFirstValue(AppClaims.USER_ROLE)); + Role = UserRoleHelper.FromString(user.FindFirstValue(AppClaims.USER_ROLE)); } public string Username { get; set; } public Guid Id { get; set; } - public EUserRole Role { get; set; } + public UserRole Role { get; set; } public class Public { @@ -22,7 +22,7 @@ public class LoggedInUserModel } public static Public ForThePeople(HttpContext httpContext) { - return new Public() { + return new Public { Id = httpContext.User.FindFirstValue(AppClaims.USER_ID), Username = httpContext.User.FindFirstValue(AppClaims.USERNAME), Role = httpContext.User.FindFirstValue(AppClaims.USER_ROLE) diff --git a/code/api/Models/StorageBlobId.cs b/code/api/Models/StorageBlobId.cs index 12a5157..323d91f 100644 --- a/code/api/Models/StorageBlobId.cs +++ b/code/api/Models/StorageBlobId.cs @@ -1,4 +1,4 @@ -namespace I2R.Storage.Api.Models; +namespace Quality.Storage.Api.Models; public struct StorageBlobId { |
