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