Hire Employee

POST /employee

Hire client as an employee in gym. You can only hire an employee if you're ADMIN.

application/json

Body Required

  • Id of the client in database (you can get it via GET /client)

  • Employee's job posting

  • left_at string(date)

    Employee's firing date (can be undefined)

Responses

  • 200 application/json

    Successfully hired new employee.

    Hide response attributes Show response attributes object
    • success boolean

      Whether an employee is hired

    • employee object

      Additional properties are allowed.

      Hide employee attributes Show employee attributes object
      • Id of the client in database

      • Id of the employee in database

      • Employee's current job posting

        Values are ADMIN, INSTRUCTOR, or TRAINER.

      • left_at string(date)

        Employee's firing date (can be undefined)

      • hired_at string(date)

        Employee's hiring date

  • 400 application/json

    Validation error of given input.

    Hide response attributes Show response attributes object
  • 401 application/json

    User is not unauthorized or permissions are missing.

    Hide response attributes Show response attributes object
  • 429 application/json

    Rate limit exceeded - 100 queries per 15 minutes.

    Hide response attributes Show response attributes object
POST /employee
curl \
 -X POST http://63.141.232.244:25540/v0/employee \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"client_id":42.0,"employee_type":"string","left_at":"2024-05-04"}'
Request examples
{
  "client_id": 42.0,
  "employee_type": "string",
  "left_at": "2024-05-04"
}
Response examples (200)
{
  "success": true,
  "employee": {
    "client_id": 1,
    "employee_id": 1,
    "employee_type": "ADMIN",
    "left_at": "2024-10-15T19:12:03Z",
    "hired_at": "2024-10-10T18:36:47Z"
  }
}
Response examples (400)
{
  "success": false,
  "error": [
    {
      "code": "invalid_type",
      "expected": "string",
      "received": "undefined",
      "path": [
        "client_id"
      ],
      "message": "Required"
    }
  ]
}
Response examples (401)
{
  "success": false,
  "error": "Unauthorized"
}
Response examples (429)
{
  "success": false,
  "error": "Too many requests, please try again later"
}