add: контракты плана расходов

This commit is contained in:
mfnefd 2024-11-27 01:46:33 +04:00
parent ba8c4a76d8
commit b35cd64e80
6 changed files with 68 additions and 0 deletions

View File

@ -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; }
}

View File

@ -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
};
}

View File

@ -0,0 +1,13 @@
using Contracts.DTO;
using Contracts.SearchModels;
namespace Contracts.Repositories;
public interface ISpendingPlanRepo
{
Task<SpendingPlanDto> Create(SpendingPlanDto dto);
Task<SpendingPlanDto?> Update(SpendingPlanDto dto);
Task<SpendingPlanDto?> Delete(SpendingPlanSearch search);
Task<SpendingPlanDto?> GetDetails(SpendingPlanSearch search);
Task<IEnumerable<SpendingPlanDto>> GetList(SpendingGroupSearch? search = null);
}

View File

@ -0,0 +1,6 @@
namespace Contracts.SearchModels;
public class SpendingPlanSearch
{
public Guid? Id { get; set; }
}

View File

@ -0,0 +1,14 @@
using Contracts.DTO;
using Contracts.SearchModels;
using Contracts.ViewModels;
namespace Contracts.Services;
public interface ISpendingPlan
{
Task<SpendingPlanView?> GetDetails(SpendingPlanSearch search);
Task<IEnumerable<SpendingPlanView>> GetList(SpendingPlanSearch? search = null);
Task<SpendingPlanView> Create(SpendingPlanDto spendingPlan);
Task<SpendingPlanView?> Delete(SpendingPlanSearch search);
Task<SpendingPlanView> Update(SpendingPlanDto spendingPlan);
}

View File

@ -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; }
}