import { SponsorshipRequestsService } from '@/lib/services/sponsors/SponsorshipRequestsService'; import type { Mutation } from '@/lib/contracts/mutations/Mutation'; import { Result } from '@/lib/contracts/Result'; export interface AcceptSponsorshipRequestCommand { requestId: string; actorDriverId: string; } export type AcceptSponsorshipRequestMutationError = | 'ACCEPT_SPONSORSHIP_REQUEST_FAILED'; export class AcceptSponsorshipRequestMutation implements Mutation { private readonly service: SponsorshipRequestsService; constructor() { this.service = new SponsorshipRequestsService(); } async execute( command: AcceptSponsorshipRequestCommand, ): Promise> { try { const result = await this.service.acceptRequest(command); if (result.isErr()) { return Result.err('ACCEPT_SPONSORSHIP_REQUEST_FAILED'); } return Result.ok(undefined); } catch (error) { return Result.err('ACCEPT_SPONSORSHIP_REQUEST_FAILED'); } } }