initial commit

This commit is contained in:
2026-07-21 14:22:06 +07:00
commit 2d7959f202
572 changed files with 45295 additions and 0 deletions
@@ -0,0 +1,47 @@
using Indotalent.Infrastructure.Database;
using MediatR;
using Microsoft.EntityFrameworkCore;
namespace Indotalent.Features.Multitenant.TenantUser.Cqrs;
public class GetTenantUserByIdResponse
{
public string? Id { get; set; }
public string? TenantId { get; set; }
public string? UserId { get; set; }
public string? Summary { get; set; }
public bool IsActive { get; set; }
public DateTimeOffset? CreatedAt { get; set; }
public string? CreatedBy { get; set; }
public DateTimeOffset? UpdatedAt { get; set; }
public string? UpdatedBy { get; set; }
}
public record GetTenantUserByIdQuery(string Id) : IRequest<GetTenantUserByIdResponse?>;
public class GetTenantUserByIdHandler : IRequestHandler<GetTenantUserByIdQuery, GetTenantUserByIdResponse?>
{
private readonly AppDbContext _context;
public GetTenantUserByIdHandler(AppDbContext context) => _context = context;
public async Task<GetTenantUserByIdResponse?> Handle(GetTenantUserByIdQuery request, CancellationToken cancellationToken)
{
return await _context.TenantUser
.AsNoTracking()
.Where(x => x.Id == request.Id)
.Select(x => new GetTenantUserByIdResponse
{
Id = x.Id,
TenantId = x.TenantId,
UserId = x.UserId,
Summary = x.Summary,
IsActive = x.IsActive,
CreatedAt = x.CreatedAt,
CreatedBy = x.CreatedBy,
UpdatedAt = x.UpdatedAt,
UpdatedBy = x.UpdatedBy,
})
.FirstOrDefaultAsync(cancellationToken);
}
}