diff --git a/static/openapi.yaml b/static/openapi.yaml index 0b30ca9..28d1e7c 100644 --- a/static/openapi.yaml +++ b/static/openapi.yaml @@ -6,296 +6,385 @@ info: servers: - url: / paths: - /api/v1/logs: + /api/v1/appointments: get: tags: - - Logs - summary: Fetch list of log entries - description: Retrieves a list of logs stored in the S3 bucket, ordered by timestamp in descending order. Requires admin authentication. + - Appointments + summary: Get all appointments + description: Retrieve a list of all appointments in the system. responses: '200': - description: A list of logs - content: - application/json: - schema: - type: object - properties: - logs: - type: array - items: - type: object - properties: - requestId: - description: Unique identifier for the request log. - type: string - timestamp: - description: The timestamp when the log was created. - type: string - format: date-time - '401': - description: Unauthorized - No token provided - content: - application/json: - schema: - type: object - properties: - error: - description: Error message indicating access was denied due to missing token. - type: string - '403': - description: Forbidden - Insufficient permissions + description: List of appointments content: application/json: schema: - type: object - properties: - error: - description: Error message indicating insufficient permissions. - type: string + type: array + items: + $ref: '#/components/schemas/Appointment' '500': - description: Internal server error + description: Error retrieving appointments + security: + - cookieAuth: [] + post: + tags: + - Appointments + summary: Create a new appointment + description: Schedule a new appointment for a patient with specified details. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AppointmentCreate' + required: true + responses: + '201': + description: Appointment created successfully content: application/json: schema: - type: object - properties: - error: - description: Error message describing the issue. - type: string + $ref: '#/components/schemas/Appointment' + '500': + description: Error creating the appointment security: - cookieAuth: [] - /api/v1/logs/{requestId}: + /api/v1/appointments/available: get: tags: - - Logs - summary: Fetch logs for a specific request - description: Retrieves the logs for a specific request ID stored in the S3 bucket. Requires admin authentication. + - Appointments + summary: Get available appointment slots + description: Retrieve available appointment slots for a specific clinic, doctor, and date. parameters: - - in: path - name: requestId - description: The unique identifier of the request log to retrieve. + - in: query + name: clinicId + description: The ID of the clinic to check for available appointments required: true schema: type: string - style: simple + style: form + - in: query + name: doctorId + description: The ID of the doctor to check for available appointments + required: true + schema: + type: string + style: form + - in: query + name: date + description: The date to check for available appointments (in YYYY-MM-DD format) + required: true + schema: + type: string + format: date + style: form responses: '200': - description: Logs for the specified request ID + description: List of available appointment slots content: application/json: schema: - type: object - properties: - requestId: - description: The unique identifier of the request. - type: string - logs: - type: object - additionalProperties: - description: Log details for the request. + type: array + items: + type: object + properties: + startTime: + description: Start time of the available appointment slot type: string - '401': - description: Unauthorized - No token provided - content: - application/json: - schema: - type: object - properties: - error: - description: Error message indicating access was denied due to missing token. - type: string - '403': - description: Forbidden - Insufficient permissions - content: - application/json: - schema: - type: object - properties: - error: - description: Error message indicating insufficient permissions. - type: string - '404': - description: Logs not found for the specified request ID - content: - application/json: - schema: - type: object - properties: - error: - description: Error message indicating the logs were not found. - type: string + format: time + endTime: + description: End time of the available appointment slot + type: string + format: time '500': - description: Internal server error + description: Error obtaining clinic appointments content: application/json: schema: type: object properties: error: - description: Error message describing the issue. + example: Error obtaining clinic appointments + type: string + message: + example: Detailed error message type: string security: - cookieAuth: [] - /api/v1/patients/: + /api/v1/appointments/{id}: get: tags: - - Patients - summary: Retrieve all patients - description: Fetch a list of all patients. + - Appointments + summary: Get appointment by ID + description: Retrieve details of a specific appointment by its ID. + parameters: + - in: path + name: id + description: The ID of the appointment to retrieve + required: true + schema: + type: string + style: simple responses: '200': - description: List of patients retrieved successfully. + description: Appointment details retrieved successfully content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/Patient' + $ref: '#/components/schemas/Appointment' + '404': + description: Appointment not found '500': - description: Internal server error. - content: - application/json: - example: - message: An unexpected error occurred + description: Error retrieving the appointment security: - cookieAuth: [] - post: + put: tags: - - Patients - summary: Register a new patient - description: Creates a new patient record in the system. + - Appointments + summary: Update an appointment + description: Modify details of an existing appointment by ID. + parameters: + - in: path + name: id + description: The ID of the appointment to update + required: true + schema: + type: string + style: simple requestBody: content: application/json: schema: - $ref: '#/components/schemas/Patient' + $ref: '#/components/schemas/AppointmentUpdate' required: true responses: - '201': - description: Patient created successfully. + '200': + description: Appointment updated successfully content: application/json: schema: - $ref: '#/components/schemas/Patient' - '400': - description: Missing fields in the request body. - content: - application/json: - example: - message: Missing fields + $ref: '#/components/schemas/Appointment' + '404': + description: Appointment not found '500': - description: Internal server error. - content: - application/json: - example: - message: An unexpected error occurred + description: Error updating the appointment security: - cookieAuth: [] - /api/v1/patients/{id}: - get: + delete: tags: - - Patients - summary: Get patient by ID - description: Fetch a specific patient using their unique ID. + - Appointments + summary: Delete an appointment + description: Remove an appointment from the system by its ID. parameters: - in: path name: id + description: The ID of the appointment to delete required: true schema: type: string style: simple responses: '200': - description: Patient retrieved successfully. + description: Appointment deleted successfully content: application/json: schema: - $ref: '#/components/schemas/Patient' + type: object + properties: + message: + example: Appointment deleted successfully + type: string '404': - description: Patient not found. - content: - application/json: - example: - message: Patient not found + description: Appointment not found '500': - description: Internal server error. - content: - application/json: - example: - message: An unexpected error occurred + description: Error deleting the appointment security: - cookieAuth: [] - put: + /api/v1/appointments/{id}/weather: + get: tags: - - Patients - summary: Update a patient by ID - description: Modify the details of a specific patient. + - Appointments + summary: Get weather forecast for appointment + description: Retrieve weather forecast for the location and date of a specific appointment by ID. parameters: - in: path name: id + description: The ID of the appointment for which to retrieve weather information required: true schema: type: string style: simple - requestBody: - content: - application/json: - schema: - type: object - additionalProperties: true + responses: + '200': + description: Weather forecast for the appointment date and location + '404': + description: Appointment or weather data not found + '500': + description: Error retrieving the weather information + /api/v1/appointments/{id}/cancel: + put: + tags: + - Appointments + summary: Cancel an appointment + description: Change the status of an appointment to "cancelled" by its ID. + parameters: + - in: path + name: id + description: The ID of the appointment to cancel required: true + schema: + type: string + style: simple responses: '200': - description: Patient updated successfully. + description: Appointment cancelled successfully content: application/json: schema: - $ref: '#/components/schemas/Patient' + $ref: '#/components/schemas/Appointment' + '400': + description: Appointment ID not provided '404': - description: Patient not found. - content: - application/json: - example: - message: Patient not found + description: Appointment not found '500': - description: Internal server error. + description: Error cancelling the appointment + security: + - cookieAuth: [] + /api/v1/appointments/{id}/complete: + put: + tags: + - Appointments + summary: Complete an appointment + description: Change the status of an appointment to "completed" by its ID. + parameters: + - in: path + name: id + description: The ID of the appointment to complete + required: true + schema: + type: string + style: simple + responses: + '200': + description: Appointment completed successfully content: application/json: - example: - message: An unexpected error occurred + schema: + $ref: '#/components/schemas/Appointment' + '400': + description: Appointment ID not provided + '404': + description: Appointment not found + '500': + description: Error completing the appointment security: - cookieAuth: [] - delete: + /api/v1/appointments/{id}/noshow: + put: tags: - - Patients - summary: Delete a patient by ID - description: Remove a specific patient from the system. + - Appointments + summary: Mark an appointment as no_show + description: Change the status of an appointment to "no_show" by its ID. parameters: - in: path name: id + description: The ID of the appointment to mark as no_show required: true schema: type: string style: simple responses: '200': - description: Patient deleted successfully. + description: Appointment marked as no_show successfully content: application/json: schema: - $ref: '#/components/schemas/Patient' + $ref: '#/components/schemas/Appointment' + '400': + description: Appointment ID not provided '404': - description: Patient not found. + description: Appointment not found + '500': + description: Error marking appointment as no_show + security: + - cookieAuth: [] + /api/v1/appointments/patient/{patientId}: + get: + tags: + - Appointments + summary: Get all appointments for a patient + description: Retrieve a list of all appointments for a specific patient by their ID. + parameters: + - in: path + name: patientId + description: The ID of the patient whose appointments to retrieve + required: true + schema: + type: string + style: simple + responses: + '200': + description: List of appointments for the patient content: application/json: - example: - message: Patient not found + schema: + type: array + items: + $ref: '#/components/schemas/Appointment' '500': - description: Internal server error. + description: Error retrieving appointments for the patient + security: + - cookieAuth: [] + /api/v1/appointments/doctor/{doctorId}: + get: + tags: + - Appointments + summary: Get all appointments for a doctor + description: Retrieve a list of all appointments for a specific doctor by their ID. + parameters: + - in: path + name: doctorId + description: The ID of the doctor whose appointments to retrieve + required: true + schema: + type: string + style: simple + responses: + '200': + description: List of appointments for the doctor content: application/json: - example: - message: An unexpected error occurred + schema: + type: array + items: + $ref: '#/components/schemas/Appointment' + '500': + description: Error retrieving appointments for the doctor + security: + - cookieAuth: [] + /api/v1/appointments/clinic/{clinicId}: + get: + tags: + - Appointments + summary: Get all appointments for a clinic + description: Retrieve a list of all appointments for a specific clinic by its ID. + parameters: + - in: path + name: clinicId + description: The ID of the clinic whose appointments to retrieve + required: true + schema: + type: string + style: simple + responses: + '200': + description: List of appointments for the clinic + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Appointment' + '500': + description: Error retrieving appointments for the clinic security: - cookieAuth: [] /api/v1/plans: @@ -553,438 +642,702 @@ paths: description: Clinic successfully deleted security: - cookieAuth: [] - /api/v1/appointments: + /api/v1/logs: get: tags: - - Appointments - summary: Get all appointments - description: Retrieve a list of all appointments in the system. + - Logs + summary: Fetch list of log entries + description: Retrieves a list of logs stored in the S3 bucket, ordered by timestamp in descending order. Requires admin authentication. responses: '200': - description: List of appointments + description: A list of logs content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/Appointment' - '500': - description: Error retrieving appointments - security: - - cookieAuth: [] - post: - tags: - - Appointments - summary: Create a new appointment - description: Schedule a new appointment for a patient with specified details. - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AppointmentCreate' - required: true - responses: - '201': - description: Appointment created successfully + type: object + properties: + logs: + type: array + items: + type: object + properties: + requestId: + description: Unique identifier for the request log. + type: string + timestamp: + description: The timestamp when the log was created. + type: string + format: date-time + '401': + description: Unauthorized - No token provided content: application/json: schema: - $ref: '#/components/schemas/Appointment' + type: object + properties: + error: + description: Error message indicating access was denied due to missing token. + type: string + '403': + description: Forbidden - Insufficient permissions + content: + application/json: + schema: + type: object + properties: + error: + description: Error message indicating insufficient permissions. + type: string '500': - description: Error creating the appointment - security: - - cookieAuth: [] - /api/v1/appointments/available: - get: - tags: - - Appointments - summary: Get available appointment slots - description: Retrieve available appointment slots for a specific clinic, doctor, and date. + description: Internal server error + content: + application/json: + schema: + type: object + properties: + error: + description: Error message describing the issue. + type: string + security: + - cookieAuth: [] + /api/v1/logs/{requestId}: + get: + tags: + - Logs + summary: Fetch logs for a specific request + description: Retrieves the logs for a specific request ID stored in the S3 bucket. Requires admin authentication. parameters: - - in: query - name: clinicId - description: The ID of the clinic to check for available appointments - required: true - schema: - type: string - style: form - - in: query - name: doctorId - description: The ID of the doctor to check for available appointments - required: true - schema: - type: string - style: form - - in: query - name: date - description: The date to check for available appointments (in YYYY-MM-DD format) + - in: path + name: requestId + description: The unique identifier of the request log to retrieve. required: true schema: type: string - format: date - style: form + style: simple responses: '200': - description: List of available appointment slots + description: Logs for the specified request ID content: application/json: schema: - type: array - items: - type: object - properties: - startTime: - description: Start time of the available appointment slot - type: string - format: time - endTime: - description: End time of the available appointment slot + type: object + properties: + requestId: + description: The unique identifier of the request. + type: string + logs: + type: object + additionalProperties: + description: Log details for the request. type: string - format: time - '500': - description: Error obtaining clinic appointments + '401': + description: Unauthorized - No token provided content: application/json: schema: type: object properties: error: - example: Error obtaining clinic appointments + description: Error message indicating access was denied due to missing token. type: string - message: - example: Detailed error message + '403': + description: Forbidden - Insufficient permissions + content: + application/json: + schema: + type: object + properties: + error: + description: Error message indicating insufficient permissions. + type: string + '404': + description: Logs not found for the specified request ID + content: + application/json: + schema: + type: object + properties: + error: + description: Error message indicating the logs were not found. + type: string + '500': + description: Internal server error + content: + application/json: + schema: + type: object + properties: + error: + description: Error message describing the issue. type: string security: - cookieAuth: [] - /api/v1/appointments/{id}: + /api/v1/workshifts: get: tags: - - Appointments - summary: Get appointment by ID - description: Retrieve details of a specific appointment by its ID. - parameters: - - in: path - name: id - description: The ID of the appointment to retrieve - required: true - schema: - type: string - style: simple + - Workshifts + summary: Get all workshifts responses: '200': - description: Appointment details retrieved successfully + description: Retrieve a list of workshifts content: application/json: schema: - $ref: '#/components/schemas/Appointment' - '404': - description: Appointment not found + type: array + items: + $ref: '#/components/schemas/Workshift' '500': - description: Error retrieving the appointment + description: Server error security: - cookieAuth: [] - put: + post: tags: - - Appointments - summary: Update an appointment - description: Modify details of an existing appointment by ID. - parameters: - - in: path - name: id - description: The ID of the appointment to update - required: true - schema: - type: string - style: simple + - Workshifts + summary: Create a new workshift requestBody: content: application/json: schema: - $ref: '#/components/schemas/AppointmentUpdate' + $ref: '#/components/schemas/WorkshiftInput' required: true responses: - '200': - description: Appointment updated successfully + '201': + description: Workshift created content: application/json: schema: - $ref: '#/components/schemas/Appointment' - '404': - description: Appointment not found - '500': - description: Error updating the appointment + $ref: '#/components/schemas/Workshift' + '400': + description: Validation error security: - cookieAuth: [] - delete: + /api/v1/workshifts/week: + post: tags: - - Appointments - summary: Delete an appointment - description: Remove an appointment from the system by its ID. - parameters: - - in: path - name: id - description: The ID of the appointment to delete + - Workshifts + summary: Create a new workshift for a week + requestBody: + content: + application/json: + schema: + type: object + properties: + doctorId: + description: Unique identifier for the doctor + type: string + clinicId: + description: Unique identifier for the clinic + type: string + duration: + example: 480 + description: Duration of each work shift in minutes + type: integer + periodStartDate: + description: Start date of the week, must be a Monday + type: string + format: date-time + periodEndDate: + description: End date of the week, must be a Sunday within the same week as weekStartDate + type: string + format: date + required: + - doctorId + - clinicId + - duration + - weekStartDate + - weekEndDate required: true - schema: - type: string - style: simple responses: - '200': - description: Appointment deleted successfully + '201': + description: Workshifts created successfully + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Workshift' + '400': + description: Invalid input or validation error content: application/json: schema: type: object properties: message: - example: Appointment deleted successfully + example: weekStartDate must be a Monday and weekEndDate a Sunday of the same week + description: Error message explaining the issue type: string - '404': - description: Appointment not found - '500': - description: Error deleting the appointment security: - cookieAuth: [] - /api/v1/appointments/{id}/weather: + /api/v1/workshifts/{id}: get: tags: - - Appointments - summary: Get weather forecast for appointment - description: Retrieve weather forecast for the location and date of a specific appointment by ID. + - Workshifts + summary: Get a workshift by ID parameters: - in: path name: id - description: The ID of the appointment for which to retrieve weather information + description: Workshift ID required: true schema: type: string style: simple responses: '200': - description: Weather forecast for the appointment date and location + description: Retrieve a workshift + content: + application/json: + schema: + $ref: '#/components/schemas/Workshift' '404': - description: Appointment or weather data not found + description: Workshift not found '500': - description: Error retrieving the weather information - /api/v1/appointments/{id}/cancel: + description: Server error + security: + - cookieAuth: [] put: tags: - - Appointments - summary: Cancel an appointment - description: Change the status of an appointment to "cancelled" by its ID. + - Workshifts + summary: Update a workshift by ID parameters: - in: path name: id - description: The ID of the appointment to cancel + description: Workshift ID required: true schema: type: string style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WorkshiftInput' + required: true responses: '200': - description: Appointment cancelled successfully + description: Workshift updated content: application/json: schema: - $ref: '#/components/schemas/Appointment' - '400': - description: Appointment ID not provided + $ref: '#/components/schemas/Workshift' '404': - description: Appointment not found - '500': - description: Error cancelling the appointment + description: Workshift not found + '400': + description: Validation error security: - cookieAuth: [] - /api/v1/appointments/{id}/complete: - put: + delete: tags: - - Appointments - summary: Complete an appointment - description: Change the status of an appointment to "completed" by its ID. + - Workshifts + summary: Delete a workshift by ID parameters: - in: path name: id - description: The ID of the appointment to complete + description: Workshift ID required: true schema: type: string style: simple responses: - '200': - description: Appointment completed successfully - content: - application/json: - schema: - $ref: '#/components/schemas/Appointment' - '400': - description: Appointment ID not provided + '204': + description: Workshift deleted '404': - description: Appointment not found + description: Workshift not found '500': - description: Error completing the appointment + description: Server error security: - cookieAuth: [] - /api/v1/appointments/{id}/noshow: - put: + /api/v1/workshifts/doctor/{doctorId}: + get: tags: - - Appointments - summary: Mark an appointment as no_show - description: Change the status of an appointment to "no_show" by its ID. + - Workshifts + summary: Get workshifts by doctor ID parameters: - in: path - name: id - description: The ID of the appointment to mark as no_show + name: doctorId + description: Doctor ID required: true schema: type: string style: simple responses: '200': - description: Appointment marked as no_show successfully + description: Lista de workshifts content: application/json: schema: - $ref: '#/components/schemas/Appointment' + type: array + items: + $ref: '#/components/schemas/Workshift' + '500': + description: Error del servidor + security: + - cookieAuth: [] + /api/v1/patients/: + get: + tags: + - Patients + summary: Retrieve all patients + description: Fetch a list of all patients. + responses: + '200': + description: List of patients retrieved successfully. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Patient' + '500': + description: Internal server error. + content: + application/json: + example: + message: An unexpected error occurred + security: + - cookieAuth: [] + post: + tags: + - Patients + summary: Register a new patient + description: Creates a new patient record in the system. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Patient' + required: true + responses: + '201': + description: Patient created successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/Patient' '400': - description: Appointment ID not provided - '404': - description: Appointment not found + description: Missing fields in the request body. + content: + application/json: + example: + message: Missing fields '500': - description: Error marking appointment as no_show + description: Internal server error. + content: + application/json: + example: + message: An unexpected error occurred security: - cookieAuth: [] - /api/v1/appointments/patient/{patientId}: + /api/v1/patients/{id}: get: tags: - - Appointments - summary: Get all appointments for a patient - description: Retrieve a list of all appointments for a specific patient by their ID. + - Patients + summary: Get patient by ID + description: Fetch a specific patient using their unique ID. parameters: - in: path - name: patientId - description: The ID of the patient whose appointments to retrieve + name: id required: true schema: type: string style: simple responses: '200': - description: List of appointments for the patient + description: Patient retrieved successfully. content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/Appointment' + $ref: '#/components/schemas/Patient' + '404': + description: Patient not found. + content: + application/json: + example: + message: Patient not found '500': - description: Error retrieving appointments for the patient + description: Internal server error. + content: + application/json: + example: + message: An unexpected error occurred security: - cookieAuth: [] - /api/v1/appointments/doctor/{doctorId}: - get: + put: tags: - - Appointments - summary: Get all appointments for a doctor - description: Retrieve a list of all appointments for a specific doctor by their ID. + - Patients + summary: Update a patient by ID + description: Modify the details of a specific patient. parameters: - in: path - name: doctorId - description: The ID of the doctor whose appointments to retrieve + name: id required: true schema: type: string style: simple + requestBody: + content: + application/json: + schema: + type: object + additionalProperties: true + required: true responses: '200': - description: List of appointments for the doctor + description: Patient updated successfully. content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/Appointment' + $ref: '#/components/schemas/Patient' + '404': + description: Patient not found. + content: + application/json: + example: + message: Patient not found '500': - description: Error retrieving appointments for the doctor + description: Internal server error. + content: + application/json: + example: + message: An unexpected error occurred security: - cookieAuth: [] - /api/v1/appointments/clinic/{clinicId}: - get: + delete: tags: - - Appointments - summary: Get all appointments for a clinic - description: Retrieve a list of all appointments for a specific clinic by its ID. + - Patients + summary: Delete a patient by ID + description: Remove a specific patient from the system. parameters: - in: path - name: clinicId - description: The ID of the clinic whose appointments to retrieve + name: id required: true schema: type: string style: simple responses: '200': - description: List of appointments for the clinic + description: Patient deleted successfully. content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/Appointment' + $ref: '#/components/schemas/Patient' + '404': + description: Patient not found. + content: + application/json: + example: + message: Patient not found '500': - description: Error retrieving appointments for the clinic + description: Internal server error. + content: + application/json: + example: + message: An unexpected error occurred security: - cookieAuth: [] - /api/v1/users: + /api/v1/staff/register: post: tags: - - Users - summary: Create User - description: Creates a new user with specified roles, email, and associated IDs for doctor or patient. + - staff + summary: Register a new doctor requestBody: content: application/json: schema: type: object properties: - email: - example: new_user@example.com - description: Email address of the user. + name: type: string - password: - example: securepassword123 - description: User's password. + surname: type: string - roles: - example: - - admin - - doctor - description: List of roles assigned to the user. - type: array - items: - type: string - doctorid: - nullable: true - example: doctor123 - description: Unique ID if the user is a doctor. + specialty: type: string - patientid: - nullable: true - example: patient456 - description: Unique ID if the user is a patient. + dni: + type: string + clinicId: + type: string + password: + type: string + email: type: string - required: - - email - - password required: true responses: '201': - description: User created successfully - content: - application/json: - schema: - type: object - properties: - email: + description: Doctor created successfully + '400': + description: Bad request + security: + - cookieAuth: [] + /api/v1/staff/{doctorId}: + get: + tags: + - staff + summary: Get doctor by ID + parameters: + - in: path + name: doctorId + required: true + schema: + type: string + style: simple + responses: + '200': + description: Doctor retrieved successfully + '404': + description: Doctor not found + put: + tags: + - staff + summary: Update doctor speciality + parameters: + - in: path + name: doctorId + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + type: object + properties: + specialty: + type: string + required: true + responses: + '200': + description: Speciality updated successfully + '404': + description: Doctor not found + security: + - cookieAuth: [] + delete: + tags: + - staff + summary: Delete a doctor + parameters: + - in: path + name: doctorId + required: true + schema: + type: string + style: simple + responses: + '204': + description: Doctor deleted successfully + '404': + description: Doctor not found + security: + - cookieAuth: [] + /api/v1/staff/clinic/{clinicId}/speciality/{speciality}: + get: + tags: + - staff + summary: Get doctors by speciality in a clinic + parameters: + - in: path + name: clinicId + required: true + schema: + type: string + style: simple + - in: path + name: speciality + schema: + type: string + style: simple + responses: + '200': + description: List of doctors + '404': + description: No doctors found + /api/v1/staff/me: + get: + tags: + - staff + summary: Get authenticated doctor + responses: + '200': + description: Authenticated doctor retrieved successfully + content: + application/json: + schema: + type: object + properties: + _id: + type: string + name: + type: string + surname: + type: string + specialty: + type: string + dni: + type: string + clinicId: + type: string + email: + type: string + userId: + type: string + '404': + description: Authenticated doctor not found + '400': + description: Error retrieving authenticated doctor + security: + - cookieAuth: [] + /api/v1/users: + post: + tags: + - Users + summary: Create User + description: Creates a new user with specified roles, email, and associated IDs for doctor or patient. + requestBody: + content: + application/json: + schema: + type: object + properties: + email: + example: new_user@example.com + description: Email address of the user. + type: string + password: + example: securepassword123 + description: User's password. + type: string + roles: + example: + - admin + - doctor + description: List of roles assigned to the user. + type: array + items: + type: string + doctorid: + nullable: true + example: doctor123 + description: Unique ID if the user is a doctor. + type: string + patientid: + nullable: true + example: patient456 + description: Unique ID if the user is a patient. + type: string + required: + - email + - password + required: true + responses: + '201': + description: User created successfully + content: + application/json: + schema: + type: object + properties: + email: example: new_user@example.com type: string roles: @@ -1657,6 +2010,8 @@ paths: type: string /api/v1/histories: get: + tags: + - Clinical Histories summary: Get all clinical histories responses: '200': @@ -1672,6 +2027,8 @@ paths: security: - jwt: [] post: + tags: + - Clinical Histories summary: Create a new clinical history requestBody: content: @@ -1694,6 +2051,8 @@ paths: - jwt: [] /api/v1/histories/{id}: get: + tags: + - Clinical Histories summary: Get a clinical history by its ID parameters: - in: path @@ -1720,6 +2079,8 @@ paths: security: - jwt: [] delete: + tags: + - Clinical Histories summary: Delete a clinical history by its ID parameters: - in: path @@ -1739,6 +2100,8 @@ paths: - jwt: [] /api/v1/histories/{id}/report: get: + tags: + - Clinical Histories summary: Get a clinical history report by its ID parameters: - in: path @@ -1767,6 +2130,8 @@ paths: - jwt: [] /api/v1/histories/patient/{patientId}: get: + tags: + - Clinical Histories summary: Get a clinical history by patient ID parameters: - in: path @@ -1793,6 +2158,8 @@ paths: security: - jwt: [] delete: + tags: + - Clinical Histories summary: Delete a clinical history by patient ID parameters: - in: path @@ -1812,6 +2179,8 @@ paths: - jwt: [] /api/v1/histories/{id}/allergy: post: + tags: + - Clinical Histories summary: Add an allergy to a clinical history description: Adds an allergy to the allergies set in a specific clinical history. parameters: @@ -1879,6 +2248,8 @@ paths: - jwt: [] /api/v1/histories/{id}/allergy/{allergy}: delete: + tags: + - Clinical Histories summary: Remove an allergy from a clinical history description: Removes an allergy from the allergies set in a specific clinical history. parameters: @@ -1941,6 +2312,8 @@ paths: - jwt: [] /api/v1/histories/{id}/treatment: post: + tags: + - Clinical Histories summary: Add a new treatment to a clinical history parameters: - in: path @@ -1972,6 +2345,8 @@ paths: - jwt: [] /api/v1/histories/{id}/treatment/{treatmentId}: put: + tags: + - Clinical Histories summary: Update a treatment in a clinical history parameters: - in: path @@ -2008,6 +2383,8 @@ paths: security: - jwt: [] delete: + tags: + - Clinical Histories summary: Delete a treatment from a clinical history parameters: - in: path @@ -2039,6 +2416,8 @@ paths: - jwt: [] /api/v1/histories/{id}/condition: post: + tags: + - Clinical Histories summary: Add a new current condition to a clinical history parameters: - in: path @@ -2070,6 +2449,8 @@ paths: - jwt: [] /api/v1/histories/{id}/condition/{currentConditionId}: put: + tags: + - Clinical Histories summary: Update a current condition in a clinical history parameters: - in: path @@ -2106,6 +2487,8 @@ paths: security: - jwt: [] delete: + tags: + - Clinical Histories summary: Delete a current condition from a clinical history parameters: - in: path @@ -2137,6 +2520,8 @@ paths: - jwt: [] /api/v1/histories/{id}/image: post: + tags: + - Clinical Histories summary: Upload an image to a clinical history record description: Allows uploading an image to an existing clinical history record. parameters: @@ -2206,6 +2591,8 @@ paths: - jwt: [] /api/v1/histories/{id}/image/{imageId}: delete: + tags: + - Clinical Histories summary: Delete an image from a clinical history record description: Deletes a specific image associated with a clinical history record by its ID. Also removes the file from Azure Blob Storage. parameters: @@ -2271,6 +2658,8 @@ paths: - jwt: [] /api/v1/histories/{id}/analytic: post: + tags: + - Clinical Histories summary: Upload an analytic to a clinical history record description: Allows uploading an analytic to an existing clinical history record. parameters: @@ -2336,539 +2725,77 @@ paths: message: example: Internal server error occurred. type: string - security: - - jwt: [] - /api/v1/histories/{id}/analytic/{analyticId}: - delete: - summary: Delete an analytic from a clinical history record - description: Deletes a specific analytic associated with a clinical history record by its ID. Also removes the file from Azure Blob Storage. - parameters: - - in: path - name: id - description: The ID of the clinical history record. - required: true - schema: - type: string - style: simple - - in: path - name: analyticId - description: The ID of the analytic to delete. - required: true - schema: - type: string - style: simple - responses: - '200': - description: Analytic deleted successfully - content: - application/json: - schema: - type: object - properties: - message: - example: Analytic deleted successfully - type: string - '400': - description: Bad Request - Missing or invalid parameters. - content: - application/json: - schema: - type: object - properties: - message: - example: clinicalHistoryId and analyticId are required - type: string - '404': - description: Not Found - Clinical history or analytic not found. - content: - application/json: - schema: - type: object - properties: - message: - example: Clinical history or analytic not found - type: string - '500': - description: Internal Server Error - content: - application/json: - schema: - type: object - properties: - message: - example: Error deleting analytic - type: string - error: - example: Detailed error message. - type: string - security: - - jwt: [] - /api/v1/staff/register: - post: - tags: - - staff - summary: Register a new doctor - requestBody: - content: - application/json: - schema: - type: object - properties: - name: - type: string - surname: - type: string - specialty: - type: string - dni: - type: string - clinicId: - type: string - password: - type: string - email: - type: string - required: true - responses: - '201': - description: Doctor created successfully - '400': - description: Bad request - security: - - cookieAuth: [] - /api/v1/staff/{doctorId}: - get: - tags: - - staff - summary: Get doctor by ID - parameters: - - in: path - name: doctorId - required: true - schema: - type: string - style: simple - responses: - '200': - description: Doctor retrieved successfully - '404': - description: Doctor not found - put: - tags: - - staff - summary: Update doctor speciality - parameters: - - in: path - name: doctorId - required: true - schema: - type: string - style: simple - requestBody: - content: - application/json: - schema: - type: object - properties: - specialty: - type: string - required: true - responses: - '200': - description: Speciality updated successfully - '404': - description: Doctor not found - security: - - cookieAuth: [] - delete: - tags: - - staff - summary: Delete a doctor - parameters: - - in: path - name: doctorId - required: true - schema: - type: string - style: simple - responses: - '204': - description: Doctor deleted successfully - '404': - description: Doctor not found - security: - - cookieAuth: [] - /api/v1/staff/clinic/{clinicId}/speciality/{speciality}: - get: - tags: - - staff - summary: Get doctors by speciality in a clinic - parameters: - - in: path - name: clinicId - required: true - schema: - type: string - style: simple - - in: path - name: speciality - schema: - type: string - style: simple - responses: - '200': - description: List of doctors - '404': - description: No doctors found - /api/v1/staff/me: - get: - tags: - - staff - summary: Get authenticated doctor - responses: - '200': - description: Authenticated doctor retrieved successfully - content: - application/json: - schema: - type: object - properties: - _id: - type: string - name: - type: string - surname: - type: string - specialty: - type: string - dni: - type: string - clinicId: - type: string - email: - type: string - userId: - type: string - '404': - description: Authenticated doctor not found - '400': - description: Error retrieving authenticated doctor - security: - - cookieAuth: [] - /api/v1/workshifts: - get: - tags: - - Workshifts - summary: Get all workshifts - responses: - '200': - description: Retrieve a list of workshifts - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/Workshift' - '500': - description: Server error - security: - - cookieAuth: [] - post: - tags: - - Workshifts - summary: Create a new workshift - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/WorkshiftInput' - required: true - responses: - '201': - description: Workshift created - content: - application/json: - schema: - $ref: '#/components/schemas/Workshift' - '400': - description: Validation error - security: - - cookieAuth: [] - /api/v1/workshifts/week: - post: - tags: - - Workshifts - summary: Create a new workshift for a week - requestBody: - content: - application/json: - schema: - type: object - properties: - doctorId: - description: Unique identifier for the doctor - type: string - clinicId: - description: Unique identifier for the clinic - type: string - duration: - example: 480 - description: Duration of each work shift in minutes - type: integer - periodStartDate: - description: Start date of the week, must be a Monday - type: string - format: date-time - periodEndDate: - description: End date of the week, must be a Sunday within the same week as weekStartDate - type: string - format: date - required: - - doctorId - - clinicId - - duration - - weekStartDate - - weekEndDate - required: true - responses: - '201': - description: Workshifts created successfully - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/Workshift' - '400': - description: Invalid input or validation error - content: - application/json: - schema: - type: object - properties: - message: - example: weekStartDate must be a Monday and weekEndDate a Sunday of the same week - description: Error message explaining the issue - type: string - security: - - cookieAuth: [] - /api/v1/workshifts/{id}: - get: - tags: - - Workshifts - summary: Get a workshift by ID - parameters: - - in: path - name: id - description: Workshift ID - required: true - schema: - type: string - style: simple - responses: - '200': - description: Retrieve a workshift - content: - application/json: - schema: - $ref: '#/components/schemas/Workshift' - '404': - description: Workshift not found - '500': - description: Server error - security: - - cookieAuth: [] - put: - tags: - - Workshifts - summary: Update a workshift by ID - parameters: - - in: path - name: id - description: Workshift ID - required: true - schema: - type: string - style: simple - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/WorkshiftInput' - required: true - responses: - '200': - description: Workshift updated - content: - application/json: - schema: - $ref: '#/components/schemas/Workshift' - '404': - description: Workshift not found - '400': - description: Validation error - security: - - cookieAuth: [] - delete: - tags: - - Workshifts - summary: Delete a workshift by ID - parameters: - - in: path - name: id - description: Workshift ID - required: true - schema: - type: string - style: simple - responses: - '204': - description: Workshift deleted - '404': - description: Workshift not found - '500': - description: Server error - security: - - cookieAuth: [] - /api/v1/workshifts/doctor/{doctorId}: - get: - tags: - - Workshifts - summary: Get workshifts by doctor ID - parameters: - - in: path - name: doctorId - description: Doctor ID - required: true - schema: - type: string - style: simple - responses: - '200': - description: Lista de workshifts - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/Workshift' - '500': - description: Error del servidor - security: - - cookieAuth: [] -components: - schemas: - LogEntry: - type: object - properties: - requestId: - description: Unique identifier for the request log. - type: string - timestamp: - description: The timestamp when the log was created. - type: string - format: date-time - Patient: - type: object - properties: - name: - type: string - surname: - type: string - birthdate: - type: string - format: date - dni: - type: string - city: - type: string - email: - type: string - password: - type: string - required: - - name - - surname - - birthdate - - dni - - city - - username - - email - ErrorResponse: - type: object - properties: - message: - type: string - Clinic: - type: object - properties: - id: - type: string - name: - type: string - city: - type: string - district: - type: string - plan: - type: string - active: - type: boolean - postalCode: - type: string - countryCode: - type: string - ClinicRequest: - type: object - properties: - name: - type: string - city: - type: string - district: - type: string - plan: - type: string - active: - type: boolean - postalCode: - type: string - countryCode: - type: string - Payment: - type: object - properties: - id: - type: string - date: - type: string - format: date-time - clinicId: - type: string - status: - type: string - planId: - type: string - PaymentRequest: - type: object - properties: - planId: - type: string - clinicId: - type: string - Plan: - type: object - properties: - id: + security: + - jwt: [] + /api/v1/histories/{id}/analytic/{analyticId}: + delete: + tags: + - Clinical Histories + summary: Delete an analytic from a clinical history record + description: Deletes a specific analytic associated with a clinical history record by its ID. Also removes the file from Azure Blob Storage. + parameters: + - in: path + name: id + description: The ID of the clinical history record. + required: true + schema: type: string - name: + style: simple + - in: path + name: analyticId + description: The ID of the analytic to delete. + required: true + schema: type: string - price: - type: number - features: - type: array - items: - type: string + style: simple + responses: + '200': + description: Analytic deleted successfully + content: + application/json: + schema: + type: object + properties: + message: + example: Analytic deleted successfully + type: string + '400': + description: Bad Request - Missing or invalid parameters. + content: + application/json: + schema: + type: object + properties: + message: + example: clinicalHistoryId and analyticId are required + type: string + '404': + description: Not Found - Clinical history or analytic not found. + content: + application/json: + schema: + type: object + properties: + message: + example: Clinical history or analytic not found + type: string + '500': + description: Internal Server Error + content: + application/json: + schema: + type: object + properties: + message: + example: Error deleting analytic + type: string + error: + example: Detailed error message. + type: string + security: + - jwt: [] +components: + schemas: Appointment: type: object properties: @@ -3009,6 +2936,152 @@ components: - completed - cancelled - no_show + Clinic: + type: object + properties: + id: + type: string + name: + type: string + city: + type: string + district: + type: string + plan: + type: string + active: + type: boolean + postalCode: + type: string + countryCode: + type: string + ClinicRequest: + type: object + properties: + name: + type: string + city: + type: string + district: + type: string + plan: + type: string + active: + type: boolean + postalCode: + type: string + countryCode: + type: string + Payment: + type: object + properties: + id: + type: string + date: + type: string + format: date-time + clinicId: + type: string + status: + type: string + planId: + type: string + PaymentRequest: + type: object + properties: + planId: + type: string + clinicId: + type: string + Plan: + type: object + properties: + id: + type: string + name: + type: string + price: + type: number + features: + type: array + items: + type: string + LogEntry: + type: object + properties: + requestId: + description: Unique identifier for the request log. + type: string + timestamp: + description: The timestamp when the log was created. + type: string + format: date-time + Workshift: + type: object + properties: + id: + example: 850154d5-6617-4128-b76b-88979b1cbc44 + type: string + doctorId: + example: 850154d5-6617-4128-b76b-88979b1cbc46 + type: string + clinicId: + example: ea12fd3d-4d3c-4ba2-b871-673c29fb69d3 + type: string + startDate: + example: 2024-11-01T09:00:00Z + type: string + format: date-time + duration: + example: 120 + type: integer + WorkshiftInput: + type: object + properties: + doctorId: + example: 850154d5-6617-4128-b76b-88979b1cbc46 + type: string + clinicId: + example: ea12fd3d-4d3c-4ba2-b871-673c29fb69d3 + type: string + startDate: + example: 2024-11-01T09:00:00Z + type: string + format: date-time + duration: + example: 30 + type: integer + Patient: + type: object + properties: + name: + type: string + surname: + type: string + birthdate: + type: string + format: date + dni: + type: string + city: + type: string + email: + type: string + password: + type: string + required: + - name + - surname + - birthdate + - dni + - city + - username + - email + ErrorResponse: + type: object + properties: + message: + type: string User: description: Schema for the User model, including fields for unique ID, email, password, role, and optional associations with patient and clinic. type: object @@ -3157,41 +3230,6 @@ components: description: Date the file was uploaded type: string format: date-time - Workshift: - type: object - properties: - id: - example: 850154d5-6617-4128-b76b-88979b1cbc44 - type: string - doctorId: - example: 850154d5-6617-4128-b76b-88979b1cbc46 - type: string - clinicId: - example: ea12fd3d-4d3c-4ba2-b871-673c29fb69d3 - type: string - startDate: - example: 2024-11-01T09:00:00Z - type: string - format: date-time - duration: - example: 120 - type: integer - WorkshiftInput: - type: object - properties: - doctorId: - example: 850154d5-6617-4128-b76b-88979b1cbc46 - type: string - clinicId: - example: ea12fd3d-4d3c-4ba2-b871-673c29fb69d3 - type: string - startDate: - example: 2024-11-01T09:00:00Z - type: string - format: date-time - duration: - example: 30 - type: integer securitySchemes: cookieAuth: type: apiKey