resolve todos in core
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
import type { ISponsorshipRequestRepository } from '../../domain/repositories/ISponsorshipRequestRepository';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { SponsorshipRejectionNotificationPort } from '../ports/output/SponsorshipRejectionNotificationPort';
|
||||
|
||||
export interface RejectSponsorshipRequestDTO {
|
||||
requestId: string;
|
||||
@@ -24,6 +25,7 @@ export interface RejectSponsorshipRequestResultDTO {
|
||||
export class RejectSponsorshipRequestUseCase {
|
||||
constructor(
|
||||
private readonly sponsorshipRequestRepo: ISponsorshipRequestRepository,
|
||||
private readonly sponsorshipRejectionNotificationPort: SponsorshipRejectionNotificationPort,
|
||||
) {}
|
||||
|
||||
async execute(dto: RejectSponsorshipRequestDTO): Promise<Result<RejectSponsorshipRequestResultDTO, ApplicationErrorCode<'SPONSORSHIP_REQUEST_NOT_FOUND' | 'SPONSORSHIP_REQUEST_NOT_PENDING'>>> {
|
||||
@@ -41,7 +43,18 @@ export class RejectSponsorshipRequestUseCase {
|
||||
const rejectedRequest = request.reject(dto.respondedBy, dto.reason);
|
||||
await this.sponsorshipRequestRepo.update(rejectedRequest);
|
||||
|
||||
// TODO: In a real implementation, notify the sponsor
|
||||
await this.sponsorshipRejectionNotificationPort.notifySponsorshipRequestRejected({
|
||||
requestId: request.id,
|
||||
sponsorId: request.sponsorId,
|
||||
entityType: request.entityType,
|
||||
entityId: request.entityId,
|
||||
tier: request.tier,
|
||||
offeredAmountCents: request.offeredAmount.amount,
|
||||
currency: request.offeredAmount.currency,
|
||||
rejectedAt: rejectedRequest.respondedAt!,
|
||||
rejectedBy: dto.respondedBy,
|
||||
rejectionReason: rejectedRequest.rejectionReason,
|
||||
});
|
||||
|
||||
return Result.ok({
|
||||
requestId: rejectedRequest.id,
|
||||
|
||||
Reference in New Issue
Block a user