-
Notifications
You must be signed in to change notification settings - Fork 219
Description
Description
Extend the job application model to include a status field representing the various stages of a job application (e.g., Applied, Interview Scheduled, Offer Extended, Hired, etc.). This will allow clients to track and update job application statuses dynamically.Additionally, update the API endpoints to expose and modify job statuses efficiently.
Acceptance Criteria
✅ A status field should be added to the job application model with predefined values.
✅ The status should be displayed in relevant API responses.
✅ A PUT request should be available at /job-applications/{id}/status to update job statuses dynamically.
✅ If the job application does not exist, return a 404 Not Found response.
✅ If an invalid status is provided, return a 400 Bad Request response.
✅ Ensure the response contains the updated job status.
Purpose
🎯 Allow clients to track and manage job application statuses efficiently.
🎯 Prevent duplicate or inconsistent status updates.
🎯 Maintain a structured and standardized status system for job applications.
Requirements
📌 Implement a status field in the job application model.
📌 Validate that only predefined statuses can be assigned.
📌 Add a PUT route /job-applications/{id}/status to update the job status.
📌 Ensure that the endpoint handles errors properly (404 Not Found, 400 Bad Request).
📌Test the endpoint for correctness and accuracy.
Testing
📌 Update Job Status Request
bash
curl -X PUT {rootdomain}/job-applications/{id}/status \
-H "Content-Type: application/json" \
-d '{
"status": "Interview Scheduled"
}'
curl -X PUT {rootdomain}/job-applications/{id}/status \
-H "Content-Type: application/json" \
-d '{
"status": "Interview Scheduled"
}'
📌 Response body [Success - 200 OK]
{
"status": "success",
"status_code": 200,
"message": "Job application status updated successfully",
"data": {
"id": "integer",
"status": "string"
}
}
📌 Response body [Failure - 404 Not Found]
{
"status": "error",
"status_code": 404,
"message": "Job application not found",
"data": null
}
📌 Response body [Failure - 400 Bad Request] (Invalid Status Provided)
{
"status": "error",
"status_code": 400,
"message": "Invalid job application status",
"data": null
}
📌 Test Cases
✅ Ensure that the endpoint correctly updates the job status when a valid status is provided.
✅ Ensure that the endpoint returns the updated data in the format { "status": "success", "status_code": 200, "message": "string", "data": {} }.
✅ Ensure that the endpoint returns a 404 error when the specified job application ID does not exist.
✅ Ensure that the endpoint returns a 400 error when an invalid status is provided.
✅ Test with partial updates (e.g., only updating status) to ensure all fields are handled properly and the response adheres to the specified structure.