|
3 | 3 | using AdvancedTodoList.Core.Models.TodoLists.Members; |
4 | 4 | using Mapster; |
5 | 5 |
|
6 | | -namespace AdvancedTodoList.Core.Mapping; |
| 6 | +namespace AdvancedTodoList.Application.Mapping; |
7 | 7 |
|
8 | 8 | /// <summary> |
9 | 9 | /// Class that defines global mapping settings. |
10 | 10 | /// </summary> |
11 | 11 | public static class MappingGlobalSettings |
12 | 12 | { |
13 | | - /// <summary> |
14 | | - /// Apply global mapping settings. |
15 | | - /// </summary> |
16 | | - public static void Apply() |
17 | | - { |
18 | | - // Ignore null IDs |
19 | | - TypeAdapterConfig<TodoListMember, TodoListMemberPreviewDto>.NewConfig() |
20 | | - .IgnoreIf((src, dest) => src.RoleId == null, dest => dest.Role!); |
21 | | - TypeAdapterConfig<TodoItem, TodoItemGetByIdDto>.NewConfig() |
22 | | - .IgnoreIf((src, dest) => src.CategoryId == null, dest => dest.Category!); |
23 | | - TypeAdapterConfig<TodoItem, TodoItemPreviewDto>.NewConfig() |
24 | | - .IgnoreIf((src, dest) => src.CategoryId == null, dest => dest.Category!); |
| 13 | + /// <summary> |
| 14 | + /// Apply global mapping settings. |
| 15 | + /// </summary> |
| 16 | + public static void Apply() |
| 17 | + { |
| 18 | + // Ignore null IDs |
| 19 | + TypeAdapterConfig<TodoListMember, TodoListMemberPreviewDto>.NewConfig() |
| 20 | + .IgnoreIf((src, dest) => src.RoleId == null, dest => dest.Role!); |
| 21 | + TypeAdapterConfig<TodoItem, TodoItemGetByIdDto>.NewConfig() |
| 22 | + .IgnoreIf((src, dest) => src.CategoryId == null, dest => dest.Category!); |
| 23 | + TypeAdapterConfig<TodoItem, TodoItemPreviewDto>.NewConfig() |
| 24 | + .IgnoreIf((src, dest) => src.CategoryId == null, dest => dest.Category!); |
25 | 25 |
|
26 | | - // Convert null strings into empty strings and trim strings |
27 | | - TypeAdapterConfig.GlobalSettings.Default |
28 | | - .AddDestinationTransform((string? dest) => dest != null ? dest.Trim() : string.Empty); |
29 | | - } |
| 26 | + // Convert null strings into empty strings and trim strings |
| 27 | + TypeAdapterConfig.GlobalSettings.Default |
| 28 | + .AddDestinationTransform((string? dest) => dest != null ? dest.Trim() : string.Empty); |
| 29 | + } |
30 | 30 | } |
0 commit comments