From b35cd64e80cc0e292469a476782399c7a84cb446 Mon Sep 17 00:00:00 2001 From: mfnefd Date: Wed, 27 Nov 2024 01:46:33 +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=BF=D0=BB=D0=B0=D0=BD=D0=B0=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/SpendingPlanDto.cs | 10 ++++++++++ back/Contracts/Mappers/SpendingPlanMapper.cs | 16 ++++++++++++++++ back/Contracts/Repositories/ISpendingPlanRepo.cs | 13 +++++++++++++ .../Contracts/SearchModels/SpendingPlanSearch.cs | 6 ++++++ back/Contracts/Services/ISpendingPlan.cs | 14 ++++++++++++++ back/Contracts/ViewModels/SpendingPlanView.cs | 9 +++++++++ 6 files changed, 68 insertions(+) create mode 100644 back/Contracts/DTOs/SpendingPlanDto.cs create mode 100644 back/Contracts/Mappers/SpendingPlanMapper.cs create mode 100644 back/Contracts/Repositories/ISpendingPlanRepo.cs create mode 100644 back/Contracts/SearchModels/SpendingPlanSearch.cs create mode 100644 back/Contracts/Services/ISpendingPlan.cs create mode 100644 back/Contracts/ViewModels/SpendingPlanView.cs diff --git a/back/Contracts/DTOs/SpendingPlanDto.cs b/back/Contracts/DTOs/SpendingPlanDto.cs new file mode 100644 index 0000000..fc88578 --- /dev/null +++ b/back/Contracts/DTOs/SpendingPlanDto.cs @@ -0,0 +1,10 @@ +namespace Contracts.DTO; + +public class SpendingPlanDto +{ + public Guid Id { get; set; } + public Guid SpendingGroupId { get; set; } + public decimal Sum { get; set; } + public DateTime StartAt { get; set; } + public DateTime EndAt { get; set; } +} \ No newline at end of file diff --git a/back/Contracts/Mappers/SpendingPlanMapper.cs b/back/Contracts/Mappers/SpendingPlanMapper.cs new file mode 100644 index 0000000..4e4e144 --- /dev/null +++ b/back/Contracts/Mappers/SpendingPlanMapper.cs @@ -0,0 +1,16 @@ +using Contracts.DTO; +using Contracts.ViewModels; + +namespace Contracts.Mappers; + +public static class SpendingPlanMapper +{ + public static SpendingPlanView ToView(this SpendingPlanDto dto) + => new() + { + Id = dto.Id, + StartAt = dto.StartAt, + EndAt = dto.EndAt, + Sum = dto.Sum + }; +} \ No newline at end of file diff --git a/back/Contracts/Repositories/ISpendingPlanRepo.cs b/back/Contracts/Repositories/ISpendingPlanRepo.cs new file mode 100644 index 0000000..229bb7f --- /dev/null +++ b/back/Contracts/Repositories/ISpendingPlanRepo.cs @@ -0,0 +1,13 @@ +using Contracts.DTO; +using Contracts.SearchModels; + +namespace Contracts.Repositories; + +public interface ISpendingPlanRepo +{ + Task Create(SpendingPlanDto dto); + Task Update(SpendingPlanDto dto); + Task Delete(SpendingPlanSearch search); + Task GetDetails(SpendingPlanSearch search); + Task> GetList(SpendingGroupSearch? search = null); +} \ No newline at end of file diff --git a/back/Contracts/SearchModels/SpendingPlanSearch.cs b/back/Contracts/SearchModels/SpendingPlanSearch.cs new file mode 100644 index 0000000..0b53198 --- /dev/null +++ b/back/Contracts/SearchModels/SpendingPlanSearch.cs @@ -0,0 +1,6 @@ +namespace Contracts.SearchModels; + +public class SpendingPlanSearch +{ + public Guid? Id { get; set; } +} \ No newline at end of file diff --git a/back/Contracts/Services/ISpendingPlan.cs b/back/Contracts/Services/ISpendingPlan.cs new file mode 100644 index 0000000..932c4ca --- /dev/null +++ b/back/Contracts/Services/ISpendingPlan.cs @@ -0,0 +1,14 @@ +using Contracts.DTO; +using Contracts.SearchModels; +using Contracts.ViewModels; + +namespace Contracts.Services; + +public interface ISpendingPlan +{ + Task GetDetails(SpendingPlanSearch search); + Task> GetList(SpendingPlanSearch? search = null); + Task Create(SpendingPlanDto spendingPlan); + Task Delete(SpendingPlanSearch search); + Task Update(SpendingPlanDto spendingPlan); +} \ No newline at end of file diff --git a/back/Contracts/ViewModels/SpendingPlanView.cs b/back/Contracts/ViewModels/SpendingPlanView.cs new file mode 100644 index 0000000..74ed725 --- /dev/null +++ b/back/Contracts/ViewModels/SpendingPlanView.cs @@ -0,0 +1,9 @@ +namespace Contracts.ViewModels; + +public class SpendingPlanView +{ + public Guid Id { get; set; } + public DateTime StartAt { get; set; } + public DateTime EndAt { get; set; } + public decimal Sum { get; set; } +} \ No newline at end of file