0.1.0 #2

Merged
mfnefd merged 38 commits from dev into main 2024-12-09 04:27:05 +04:00
6 changed files with 68 additions and 0 deletions
Showing only changes of commit 27df19201a - Show all commits

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

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

View 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);
}

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

View 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);
}

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