first commit

This commit is contained in:
2026-03-09 22:09:10 +01:00
commit 7b6b294b0f
269 changed files with 10338 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
using BookHive.DTO.Loan;
using BookHive.Models;
using BookHive.Repositories;
using FastEndpoints;
namespace BookHive.Endpoints.Loans;
public class CreateLoanEndpoint(LoanRepository loanRepository, AutoMapper.IMapper mapper) : Endpoint<CreateLoanDto>
{
public override void Configure()
{
Post("/loans/");
AllowAnonymous();
}
public override async Task HandleAsync(CreateLoanDto req, CancellationToken ct)
{
await loanRepository.AddAsync(mapper.Map<Loan>(req), ct);
await Send.OkAsync(cancellation: ct);
}
}