From 27df19201ae13a4843980386bc9f9a0c1eea5315 Mon Sep 17 00:00:00 2001 From: mfnefd Date: Tue, 26 Nov 2024 20:56:22 +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=B7=D0=B0=D0=BF=D0=B8=D1=81=D0=B8=20?= =?UTF-8?q?=D1=80=D0=B0=D1=81=D1=85=D0=BE=D0=B4=D0=BE=D0=B2=20=D0=B8=20?= =?UTF-8?q?=D0=B4=D0=BE=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/ChangeRecordDto.cs | 10 ++++++++++ back/Contracts/Mappers/ChangeRecordMapper.cs | 15 +++++++++++++++ back/Contracts/Repositories/IChangeRecordRepo.cs | 13 +++++++++++++ back/Contracts/SearchModels/ChangeRecordSearch.cs | 9 +++++++++ back/Contracts/Services/IChangeRecordService.cs | 13 +++++++++++++ .../Contracts/ViewModels/ChangeRecordViewModel.cs | 8 ++++++++ 6 files changed, 68 insertions(+) create mode 100644 back/Contracts/DTOs/ChangeRecordDto.cs create mode 100644 back/Contracts/Mappers/ChangeRecordMapper.cs create mode 100644 back/Contracts/Repositories/IChangeRecordRepo.cs create mode 100644 back/Contracts/SearchModels/ChangeRecordSearch.cs create mode 100644 back/Contracts/Services/IChangeRecordService.cs create mode 100644 back/Contracts/ViewModels/ChangeRecordViewModel.cs diff --git a/back/Contracts/DTOs/ChangeRecordDto.cs b/back/Contracts/DTOs/ChangeRecordDto.cs new file mode 100644 index 0000000..9950fb9 --- /dev/null +++ b/back/Contracts/DTOs/ChangeRecordDto.cs @@ -0,0 +1,10 @@ +namespace Contracts.DTO; + +public interface ChangeRecordDto +{ + public Guid Id { get; set; } + public Guid UserId { get; set; } + public Guid SpendingGroupId { get; set; } + public decimal Sum { get; set; } + public DateTime ChangedAt { get; set; } +} \ No newline at end of file diff --git a/back/Contracts/Mappers/ChangeRecordMapper.cs b/back/Contracts/Mappers/ChangeRecordMapper.cs new file mode 100644 index 0000000..a6075c4 --- /dev/null +++ b/back/Contracts/Mappers/ChangeRecordMapper.cs @@ -0,0 +1,15 @@ +using Contracts.DTO; +using Contracts.ViewModels; + +namespace Contracts.Mappers; + +public static class ChangeRecordMapper +{ + public static ChangeRecordViewModel ToView(this ChangeRecordDto changeRecord) + => new() + { + Id = changeRecord.Id, + Sum = changeRecord.Sum, + ChangedAt = changeRecord.ChangedAt + }; +} \ No newline at end of file diff --git a/back/Contracts/Repositories/IChangeRecordRepo.cs b/back/Contracts/Repositories/IChangeRecordRepo.cs new file mode 100644 index 0000000..d8e835e --- /dev/null +++ b/back/Contracts/Repositories/IChangeRecordRepo.cs @@ -0,0 +1,13 @@ +using Contracts.DTO; +using Contracts.SearchModels; + +namespace Contracts.Repositories; + +public interface IChangeRecordRepo +{ + Task Create(ChangeRecordDto changeRecord); + Task Get(ChangeRecordSearch search); + Task> GetList(ChangeRecordSearch? search = null); + Task Update(ChangeRecordDto changeRecord); + Task Delete(ChangeRecordSearch search); +} \ No newline at end of file diff --git a/back/Contracts/SearchModels/ChangeRecordSearch.cs b/back/Contracts/SearchModels/ChangeRecordSearch.cs new file mode 100644 index 0000000..65a5094 --- /dev/null +++ b/back/Contracts/SearchModels/ChangeRecordSearch.cs @@ -0,0 +1,9 @@ +namespace Contracts.SearchModels; + +public class ChangeRecordSearch +{ + public Guid? Id { get; set; } + public Guid? SpendingGroupId { get; set; } + public DateTime? From { get; set; } + public DateTime? To { get; set; } +} \ No newline at end of file diff --git a/back/Contracts/Services/IChangeRecordService.cs b/back/Contracts/Services/IChangeRecordService.cs new file mode 100644 index 0000000..9dd0832 --- /dev/null +++ b/back/Contracts/Services/IChangeRecordService.cs @@ -0,0 +1,13 @@ +using Contracts.DTO; +using Contracts.SearchModels; +using Contracts.ViewModels; + +namespace Contracts.Services; + +public interface IChangeRecordService +{ + Task Create(ChangeRecordDto model); + Task Update(ChangeRecordDto model); + Task Delete(ChangeRecordSearch search); + Task> GetList(ChangeRecordSearch search); +} \ No newline at end of file diff --git a/back/Contracts/ViewModels/ChangeRecordViewModel.cs b/back/Contracts/ViewModels/ChangeRecordViewModel.cs new file mode 100644 index 0000000..3a75eb3 --- /dev/null +++ b/back/Contracts/ViewModels/ChangeRecordViewModel.cs @@ -0,0 +1,8 @@ +namespace Contracts.ViewModels; + +public class ChangeRecordViewModel +{ + public Guid Id { get; set; } + public decimal Sum { get; set; } + public DateTime ChangedAt { get; set; } +} \ No newline at end of file