-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroute.ts
More file actions
24 lines (20 loc) · 852 Bytes
/
route.ts
File metadata and controls
24 lines (20 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { type NextRequest } from 'next/server';
import { handleError } from '@/lib/utils/errors.utils';
import { getSession } from '@/lib/utils/auth.utils';
import { assertRecruiterOrAbove } from '@/lib/utils/permissions.utils';
import AssessmentService from '@/lib/services/assessment.service';
export async function POST(request: NextRequest) {
try {
const session = await getSession();
await assertRecruiterOrAbove(request.headers);
const body = await request.json();
const { positionId } = body as { positionId: string };
const result = await AssessmentService.sendAssessmentInvitationsToPosition(
positionId,
session.activeOrganizationId
);
return Response.json({ data: result }, { status: 200 });
} catch (err) {
return handleError(err);
}
}