27 lines
1.0 KiB
TypeScript
27 lines
1.0 KiB
TypeScript
import { AcceptSponsorshipRequestMutation } from '@/lib/mutations/sponsors/AcceptSponsorshipRequestMutation';
|
|
import { RejectSponsorshipRequestMutation } from '@/lib/mutations/sponsors/RejectSponsorshipRequestMutation';
|
|
import type { AcceptSponsorshipRequestCommand } from '@/lib/services/sponsors/SponsorshipRequestsService';
|
|
import type { RejectSponsorshipRequestCommand } from '@/lib/services/sponsors/SponsorshipRequestsService';
|
|
|
|
export async function acceptSponsorshipRequest(
|
|
command: AcceptSponsorshipRequestCommand,
|
|
): Promise<void> {
|
|
const mutation = new AcceptSponsorshipRequestMutation();
|
|
const result = await mutation.execute(command);
|
|
|
|
if (result.isErr()) {
|
|
throw new Error('Failed to accept sponsorship request');
|
|
}
|
|
}
|
|
|
|
export async function rejectSponsorshipRequest(
|
|
command: RejectSponsorshipRequestCommand,
|
|
): Promise<void> {
|
|
const mutation = new RejectSponsorshipRequestMutation();
|
|
const result = await mutation.execute(command);
|
|
|
|
if (result.isErr()) {
|
|
throw new Error('Failed to reject sponsorship request');
|
|
}
|
|
}
|