add: контракты записи расходов и доходов
This commit is contained in:
parent
f0bdffeb86
commit
27df19201a
10
back/Contracts/DTOs/ChangeRecordDto.cs
Normal file
10
back/Contracts/DTOs/ChangeRecordDto.cs
Normal file
@ -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; }
|
||||||
|
}
|
15
back/Contracts/Mappers/ChangeRecordMapper.cs
Normal file
15
back/Contracts/Mappers/ChangeRecordMapper.cs
Normal file
@ -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
|
||||||
|
};
|
||||||
|
}
|
13
back/Contracts/Repositories/IChangeRecordRepo.cs
Normal file
13
back/Contracts/Repositories/IChangeRecordRepo.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using Contracts.DTO;
|
||||||
|
using Contracts.SearchModels;
|
||||||
|
|
||||||
|
namespace Contracts.Repositories;
|
||||||
|
|
||||||
|
public interface IChangeRecordRepo
|
||||||
|
{
|
||||||
|
Task<ChangeRecordDto> Create(ChangeRecordDto changeRecord);
|
||||||
|
Task<ChangeRecordDto?> Get(ChangeRecordSearch search);
|
||||||
|
Task<IEnumerable<ChangeRecordDto>> GetList(ChangeRecordSearch? search = null);
|
||||||
|
Task<ChangeRecordDto?> Update(ChangeRecordDto changeRecord);
|
||||||
|
Task<ChangeRecordDto?> Delete(ChangeRecordSearch search);
|
||||||
|
}
|
9
back/Contracts/SearchModels/ChangeRecordSearch.cs
Normal file
9
back/Contracts/SearchModels/ChangeRecordSearch.cs
Normal file
@ -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; }
|
||||||
|
}
|
13
back/Contracts/Services/IChangeRecordService.cs
Normal file
13
back/Contracts/Services/IChangeRecordService.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using Contracts.DTO;
|
||||||
|
using Contracts.SearchModels;
|
||||||
|
using Contracts.ViewModels;
|
||||||
|
|
||||||
|
namespace Contracts.Services;
|
||||||
|
|
||||||
|
public interface IChangeRecordService
|
||||||
|
{
|
||||||
|
Task<ChangeRecordViewModel> Create(ChangeRecordDto model);
|
||||||
|
Task<ChangeRecordViewModel> Update(ChangeRecordDto model);
|
||||||
|
Task<ChangeRecordViewModel> Delete(ChangeRecordSearch search);
|
||||||
|
Task<IEnumerable<ChangeRecordViewModel>> GetList(ChangeRecordSearch search);
|
||||||
|
}
|
8
back/Contracts/ViewModels/ChangeRecordViewModel.cs
Normal file
8
back/Contracts/ViewModels/ChangeRecordViewModel.cs
Normal file
@ -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; }
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user