Initial import

This commit is contained in:
Stein Helge Riise
2025-11-17 08:32:46 +01:00
commit ede31fbb7e
129 changed files with 9514 additions and 0 deletions
@@ -0,0 +1,20 @@
using MediatR;
using Microsoft.EntityFrameworkCore;
using MinAttest.Application.Abstractions;
namespace MinAttest.Application.Features.Employers.Commands;
public record DeleteEmployerUserCommand(Guid EmployerId, Guid UserId) : IRequest<bool>;
public class DeleteEmployerUserCommandHandler(IAppDbContext db) : IRequestHandler<DeleteEmployerUserCommand, bool>
{
public async Task<bool> Handle(DeleteEmployerUserCommand request, CancellationToken cancellationToken)
{
var user = await db.EmployerUsers.FirstOrDefaultAsync(u => u.Id == request.UserId && u.EmployerId == request.EmployerId, cancellationToken);
if (user is null) return false;
db.EmployerUsers.Remove(user);
await db.SaveChangesAsync(cancellationToken);
return true;
}
}