Backend: Add deleteJobSeekerInvitation Mutation
Date: 2026-04-21
Problem
The frontend calls deleteJobSeekerInvitation but the backend doesn't have this mutation yet. The error returned is:
Cannot query field "deleteJobSeekerInvitation" on type "Mutation".
Did you mean "declineJobSeekerInvitation", "resendJobSeekerInvitation",
"acceptJobSeekerInvitation", "sendJobSeekerInvitation", or "cancelJobSeekerInvitation"?
What the Frontend Expects
GraphQL Signature
type Mutation {
deleteJobSeekerInvitation(invitationId: String!): JobSeekerInvitation
}
Return Fields
{
id
status
}
When It's Called
The frontend uses this mutation to permanently delete invitations that are already in a terminal state:
CANCELLEDDECLINEDEXPIRED
This is different from cancelJobSeekerInvitation, which transitions an active/accepted invitation to cancelled status (used for disconnecting a partner).
Flow
- Job seeker views their sent invitations on
/jobseeker/connections/collaboratingpartner - For invitations in a terminal state, the UI shows a delete/remove action
- Clicking it calls
deleteJobSeekerInvitationto clean up the record - Bulk delete also uses this — iterates over selected IDs calling the same mutation
Implementation Notes
- Authorization: Only the job seeker who sent the invitation should be able to delete it. Verify
invitation.jobSeekerId === currentUser.id. - Status guard: Only allow deletion when
statusisCANCELLED,DECLINED, orEXPIRED. Return an error if the invitation is stillPENDINGorACCEPTED(those should usecancelJobSeekerInvitationinstead). - Action: Hard-delete the record from the database (or soft-delete if that's the existing pattern for other entities).
- Return: The deleted invitation's
idandstatusso the frontend can confirm success.
Existing Mutations for Reference
| Mutation | Purpose | Called by |
|---|---|---|
sendJobSeekerInvitation | Create new invitation | Job seeker |
cancelJobSeekerInvitation | Cancel active/accepted invitation (disconnect) | Job seeker |
resendJobSeekerInvitation | Resend a pending invitation | Job seeker |
deleteJobSeekerInvitation | Remove terminal invitation (NEW) | Job seeker |
acceptJobSeekerInvitation | Accept an invitation | Employer |
declineJobSeekerInvitation | Decline an invitation | Employer |