| 123456789101112131415161718192021222324252627282930313233 |
- using Application.Abstractions.Messaging;
- using Application.Abstractions.Data;
- using Microsoft.EntityFrameworkCore;
- namespace Application.Features.Admin.Member.List.Approve;
- public sealed class GetHandler(IAppDbContext db) : IQueryHandler<Query, Response>
- {
- public async Task<Response> Handle(Query request, CancellationToken ct)
- {
- var member = await db.Member.AsNoTracking().Include(x => x.MemberApprove).FirstOrDefaultAsync(x => x.ID == request.MemberID, ct);
- if (member is null)
- {
- throw new KeyNotFoundException("회원을 찾을 수 없습니다.");
- }
- var approve = member.MemberApprove;
- return new Response
- {
- MemberID = member.ID,
- IsReceiveSMS = approve.IsReceiveSMS,
- ReceiveSMSConsentAt = approve.ReceiveSMSConsentAt,
- IsReceiveEmail = approve.IsReceiveEmail,
- ReceiveEmailConsentAt = approve.ReceiveEmailConsentAt,
- IsReceiveNote = approve.IsReceiveNote,
- ReceiveNoteConsentAt = approve.ReceiveNoteConsentAt,
- IsDisclosureInvest = approve.IsDisclosureInvest,
- DisclosureInvestConsentAt = approve.DisclosureInvestConsentAt
- };
- }
- }
|