-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reduce data size of custom properties in category view model;
- Loading branch information
Showing
6 changed files
with
126 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System.Linq; | ||
using Bakabase.Abstractions.Models.Domain; | ||
using Bakabase.Service.Models.View; | ||
|
||
namespace Bakabase.Service.Extensions; | ||
|
||
public static class CategoryExtensions | ||
{ | ||
public static CategoryViewModel ToViewModel(this Category model) | ||
{ | ||
return new CategoryViewModel | ||
{ | ||
Id = model.Id, | ||
Name = model.Name, | ||
Color = model.Color, | ||
ComponentsData = model.ComponentsData, | ||
CoverSelectionOrder = model.CoverSelectionOrder, | ||
CreateDt = model.CreateDt, | ||
GenerateNfo = model.GenerateNfo, | ||
EnhancerOptions = model.EnhancerOptions, | ||
Order = model.Order, | ||
ResourceDisplayNameTemplate = model.ResourceDisplayNameTemplate, | ||
CustomProperties = model.CustomProperties?.Select(c => new CategoryViewModel.CustomPropertyViewModel | ||
{Id = c.Id, Name = c.Name}).ToList() | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Bakabase.InsideWorld.Models.Constants; | ||
using System.Collections.Generic; | ||
using System; | ||
using Bakabase.Abstractions.Models.Db; | ||
using CategoryEnhancerOptions = Bakabase.Abstractions.Models.Domain.CategoryEnhancerOptions; | ||
|
||
namespace Bakabase.Service.Models.View; | ||
|
||
public record CategoryViewModel | ||
{ | ||
public int Id { get; set; } | ||
public string Name { get; set; } = null!; | ||
public string? Color { get; set; } | ||
public DateTime CreateDt { get; set; } | ||
|
||
public int Order { get; set; } | ||
public CategoryComponent[]? ComponentsData { get; set; } | ||
public CoverSelectOrder CoverSelectionOrder { get; set; } | ||
public bool GenerateNfo { get; set; } | ||
public string? ResourceDisplayNameTemplate { get; set; } | ||
|
||
public List<CustomPropertyViewModel>? CustomProperties { get; set; } | ||
public List<CategoryEnhancerOptions>? EnhancerOptions { get; set; } | ||
|
||
public record CustomPropertyViewModel | ||
{ | ||
public int Id { get; set; } | ||
public string Name { get; set; } = null!; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters