| 12345678910111213141516171819202122232425262728293031323334353637 |
- using Application.Abstractions.Data;
- using Application.Abstractions.Messaging;
- using Microsoft.EntityFrameworkCore;
- using SharedKernel.Results;
- namespace Application.Features.Api.Developers.Profile.GetProfile;
- internal sealed class Handler(IAppDbContext db) : IQueryHandler<Query, Result<Response>>
- {
- public async Task<Result<Response>> Handle(Query request, CancellationToken ct)
- {
- var dev = await db.Developer
- .Where(c => c.MemberID == request.MemberID)
- .Select(c => new Response(
- c.ID,
- c.CompanyName,
- c.BusinessNumber,
- c.CeoName,
- c.ContactName,
- c.ContactPhone,
- (int)c.KycStatus,
- c.KycVerifiedAt,
- (int)c.ApprovalStatus,
- c.ApprovalReason,
- c.ApprovedAt,
- c.CreatedAt
- ))
- .FirstOrDefaultAsync(ct);
- if (dev is null)
- {
- return Result.Failure<Response>(Error.NotFound("Developer.NotFound", "개발자 정보가 등록되지 않았습니다."));
- }
- return Result.Success(dev);
- }
- }
|