From 08a3b74d587e6dc48ed9d22911246244668654fe Mon Sep 17 00:00:00 2001 From: mfnefd Date: Mon, 25 Nov 2024 23:46:53 +0400 Subject: [PATCH] =?UTF-8?q?add:=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=B0?= =?UTF-8?q?=D0=BA=D1=82=D1=8B=20=D0=B3=D1=80=D1=83=D0=BF=D0=BF=20=D1=80?= =?UTF-8?q?=D0=B0=D1=81=D1=85=D0=BE=D0=B4=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/Contracts/DTOs/SpendingGroupDto.cs | 8 ++++++++ back/Contracts/Mappers/SpendingGroupMapper.cs | 14 ++++++++++++++ back/Contracts/Repositories/ISpendingGroupRepo.cs | 13 +++++++++++++ back/Contracts/SearchModels/SpendingGroupSearch.cs | 7 +++++++ back/Contracts/Services/ISpendingGroupService.cs | 14 ++++++++++++++ .../Contracts/ViewModels/SpendingGroupViewModel.cs | 7 +++++++ 6 files changed, 63 insertions(+) create mode 100644 back/Contracts/DTOs/SpendingGroupDto.cs create mode 100644 back/Contracts/Mappers/SpendingGroupMapper.cs create mode 100644 back/Contracts/Repositories/ISpendingGroupRepo.cs create mode 100644 back/Contracts/SearchModels/SpendingGroupSearch.cs create mode 100644 back/Contracts/Services/ISpendingGroupService.cs create mode 100644 back/Contracts/ViewModels/SpendingGroupViewModel.cs diff --git a/back/Contracts/DTOs/SpendingGroupDto.cs b/back/Contracts/DTOs/SpendingGroupDto.cs new file mode 100644 index 0000000..cf03704 --- /dev/null +++ b/back/Contracts/DTOs/SpendingGroupDto.cs @@ -0,0 +1,8 @@ +namespace Contracts.DTO; + +public class SpendingGroupDto +{ + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public Guid UserId { get; set; } +} \ No newline at end of file diff --git a/back/Contracts/Mappers/SpendingGroupMapper.cs b/back/Contracts/Mappers/SpendingGroupMapper.cs new file mode 100644 index 0000000..7eca2d3 --- /dev/null +++ b/back/Contracts/Mappers/SpendingGroupMapper.cs @@ -0,0 +1,14 @@ +using Contracts.DTO; +using Contracts.ViewModels; + +namespace Contracts.Mappers; + +public static class SpendingGroupMapper +{ + public static SpendingGroupViewModel ToView(this SpendingGroupDto spendingGroup) + => new() + { + Id = spendingGroup.Id, + Name = spendingGroup.Name + }; +} \ No newline at end of file diff --git a/back/Contracts/Repositories/ISpendingGroupRepo.cs b/back/Contracts/Repositories/ISpendingGroupRepo.cs new file mode 100644 index 0000000..f8f7999 --- /dev/null +++ b/back/Contracts/Repositories/ISpendingGroupRepo.cs @@ -0,0 +1,13 @@ +using Contracts.DTO; +using Contracts.SearchModels; + +namespace Contracts.Repositories; + +public interface ISpendingGroupRepo +{ + Task Get(SpendingGroupSearch search); + Task> GetList(SpendingGroupSearch? search = null); + Task Create(SpendingGroupDto spendingGroup); + Task Delete(SpendingGroupSearch search); + Task Update(SpendingGroupDto spendingGroup); +} diff --git a/back/Contracts/SearchModels/SpendingGroupSearch.cs b/back/Contracts/SearchModels/SpendingGroupSearch.cs new file mode 100644 index 0000000..927a206 --- /dev/null +++ b/back/Contracts/SearchModels/SpendingGroupSearch.cs @@ -0,0 +1,7 @@ +namespace Contracts.SearchModels; + +public class SpendingGroupSearch +{ + public Guid? Id { get; set; } + public string? Name { get; set; } +} \ No newline at end of file diff --git a/back/Contracts/Services/ISpendingGroupService.cs b/back/Contracts/Services/ISpendingGroupService.cs new file mode 100644 index 0000000..e6664ee --- /dev/null +++ b/back/Contracts/Services/ISpendingGroupService.cs @@ -0,0 +1,14 @@ +using Contracts.DTO; +using Contracts.SearchModels; +using Contracts.ViewModels; + +namespace Contracts.Services; + +public interface ISpendingGroupService +{ + Task GetDetails(SpendingGroupSearch search); + Task> GetList(SpendingGroupSearch search); + Task Create(SpendingGroupDto model); + Task Update(SpendingGroupDto model); + Task Delete(SpendingGroupSearch search); +} \ No newline at end of file diff --git a/back/Contracts/ViewModels/SpendingGroupViewModel.cs b/back/Contracts/ViewModels/SpendingGroupViewModel.cs new file mode 100644 index 0000000..12cba2d --- /dev/null +++ b/back/Contracts/ViewModels/SpendingGroupViewModel.cs @@ -0,0 +1,7 @@ +namespace Contracts.ViewModels; + +public class SpendingGroupViewModel +{ + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; +} \ No newline at end of file