openapi: 3.0.0 info: title: API de Verificación de Rostros y Usuarios description: API para la verificación de rostros, inicio de sesión y registro de usuarios. version: 1.0.1 servers: - url: http://localhost:5000 description: Servidor local - url: https://living-improved-ocelot.ngrok-free.app/ description: Servidor en linea tags: - name: Registro description: Operaciones relacionadas con el registro de usuarios. - name: Inicio de Sesión description: Operaciones relacionadas con el inicio de sesión de usuarios. - name: Rostros description: Operaciones relacionadas con la verificación de rostros. - name: Estudiantes description: Operaciones relacionadas con estudiantes. - name: Profesores description: Operaciones relacionadas con profesores. - name: Clases description: Operaciones relacionadas con las clases. - name: Exámenes description: Operaciones relacionadas con los exámenes. - name: Usuarios description: Operaciones relacionadas con la información del usuario. - name: Tareas description: Operaciones relacionadas con las tareas. - name: Asistencia description: Operaciones relacionadas con la asistencia. paths: /api/signup/student: post: summary: Registrar estudiante description: Registra un nuevo estudiante proporcionando los datos necesarios. tags: - Registro requestBody: required: true content: application/json: schema: type: object properties: name: type: string description: Nombre completo del estudiante. username: type: string description: Nombre de usuario. age: type: integer description: Edad del estudiante. faculty: type: string description: Facultad a la que pertenece el estudiante. matnum: type: string description: Número de matrícula. password: type: string description: Contraseña del estudiante. face_img: type: string format: base64 description: Imagen de rostro en base64. email: type: string format: email description: Correo electrónico del estudiante. required: - name - username - age - faculty - matnum - password - face_img - email responses: '201': description: Registro de estudiante exitoso content: application/json: schema: type: object properties: success: type: boolean data: type: object properties: message: type: string status_code: type: integer '400': description: Faltan campos en la solicitud content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '409': description: Estudiante ya registrado content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer duplicate_field: type: string description: Campo que causa la violación de unicidad (username, matnum o email). '500': description: Error interno del servidor content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/signup/student-duplicate: post: summary: Verificar duplicado de usuario description: Verifica si un usuario ya existe en la base de datos basado en email, matnum o username. tags: - Registro requestBody: required: true content: application/json: schema: type: object properties: email: type: string format: email description: Correo electrónico del usuario. matnum: type: string description: Número de matrícula del usuario. username: type: string description: Nombre de usuario. required: - email - matnum - username responses: '200': description: No se encontraron duplicados content: application/json: schema: type: object properties: success: type: boolean status_code: type: integer '400': description: Solicitud incorrecta, campos faltantes content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '409': description: Usuario ya registrado content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer duplicate_field: type: string description: Campo que causa la violación de unicidad (username, matnum o email). '500': description: Error interno del servidor content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/signup/teacher: post: summary: Registrar profesor description: Registra un nuevo profesor proporcionando los datos necesarios. tags: - Registro requestBody: required: true content: application/json: schema: type: object properties: name: type: string description: Nombre completo del profesor. username: type: string description: Nombre de usuario. age: type: integer description: Edad del profesor. faculty: type: string description: Facultad a la que pertenece el profesor. worknum: type: string description: Número de trabajo. password: type: string description: Contraseña del profesor. face_img: type: string format: base64 description: Imagen de rostro en base64. email: type: string format: email description: Correo electrónico del profesor. required: - name - username - age - faculty - worknum - password - face_img - email responses: '201': description: Registro de profesor exitoso content: application/json: schema: type: object properties: success: type: boolean data: type: object properties: message: type: string status_code: type: integer '400': description: Faltan campos en la solicitud content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '409': description: Profesor ya registrado content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer duplicate_field: type: string description: Campo que causa la violación de unicidad (username, worknum o email). '500': description: Error interno del servidor content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/login/student: post: summary: Iniciar sesión de estudiante description: Permite a un estudiante iniciar sesión proporcionando su número de matrícula y contraseña. tags: - Inicio de Sesión requestBody: required: true content: application/json: schema: type: object properties: matnum: type: string description: Número de matrícula del estudiante. password: type: string description: Contraseña del estudiante. required: - matnum - password responses: '200': description: Inicio de sesión exitoso content: application/json: schema: type: object properties: success: type: boolean data: type: object properties: message: type: string face_img: type: string format: base64 description: Imagen de rostro en base64. status_code: type: integer '400': description: Solicitud incorrecta, campos faltantes content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '402': description: Estudiante no encontrado content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '403': description: Contraseña incorrecta content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Error interno del servidor content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/login/teacher: get: description: New endpoint responses: 200: description: New response content: application/json: schema: : post: summary: Iniciar sesión de profesor description: Permite a un profesor iniciar sesión proporcionando su número de trabajo y contraseña. tags: - Inicio de Sesión requestBody: required: true content: application/json: schema: type: object properties: worknum: type: string description: Número de trabajo del profesor. password: type: string description: Contraseña del profesor. required: - worknum - password responses: '200': description: Inicio de sesión exitoso content: application/json: schema: type: object properties: success: type: boolean data: type: object properties: message: type: string face_img: type: string format: base64 description: Imagen de rostro en base64. status_code: type: integer '400': description: Solicitud incorrecta, campos faltantes content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '402': description: Profesor no encontrado content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '403': description: Contraseña incorrecta content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Error interno del servidor content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/face/verify: post: summary: Verificar coincidencia de rostros description: Compara dos imágenes de rostros y determina si coinciden. tags: - Rostros requestBody: required: true content: application/json: schema: type: object properties: cap_frame: type: string format: base64 description: Imagen capturada en formato base64. ref_frame: type: string format: base64 description: Imagen de referencia en formato base64. required: - cap_frame - ref_frame responses: '200': description: Coincidencia de rostros exitosa content: application/json: schema: type: object properties: success: type: boolean data: type: object properties: match: type: boolean status_code: type: integer '400': description: Solicitud incorrecta, falta alguna imagen o hay un error en los datos proporcionados. content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Error interno del servidor content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/face/check-existing: post: summary: Verificar existencia de rostro description: Verifica si existe un rostro en la imagen proporcionada en formato base64. tags: - Rostros requestBody: required: true content: application/json: schema: type: object properties: img: type: string format: base64 description: Imagen en formato base64. required: - img responses: '200': description: Verificación de rostro exitosa content: application/json: schema: type: object properties: success: type: boolean data: type: object properties: face_exists: type: boolean status_code: type: integer '400': description: Solicitud incorrecta, falta la imagen o hay un error en los datos proporcionados. content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Error interno del servidor content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/class/delete: delete: summary: Delete a class description: Deletes a class based on the provided class_id. tags: - Clases parameters: - in: query name: class_id required: true schema: type: string description: ID of the class to delete. responses: '200': description: Class deleted successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object status_code: type: integer '400': description: Missing class_id parameter content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/class/add-student: post: summary: Add a student to a class description: Registers a student into a class based on student_id and class_id. tags: - Clases requestBody: required: true content: application/json: schema: type: object properties: student_id: type: integer description: ID of the student. class_id: type: integer description: ID of the class. required: - student_id - class_id responses: '201': description: Student added to class successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object properties: message: type: string status_code: type: integer '400': description: Missing required fields content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/class/delete-student: get: description: New endpoint responses: 200: description: New response content: application/json: schema: type: object delete: summary: Delete a student from a class description: Deletes a student from a class based on student_id and class_id. tags: - Clases parameters: - in: query name: class_id required: true schema: type: string description: ID of the class. - in: query name: student_id required: true schema: type: string description: ID of the student. responses: '200': description: Student deleted from class successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object status_code: type: integer '400': description: Missing class_id or student_id parameter content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/class/register: post: summary: Register a new class description: Registers a new class with the provided details. tags: - Clases requestBody: required: true content: application/json: schema: type: object properties: class_name: type: string description: Name of the class. teacher_id: type: integer description: ID of the teacher. group_num: type: integer description: Group number. semester: type: string description: Semester. class_room: type: string description: Class room. start_time: type: string description: Start time. end_time: type: string description: End time. week_days: type: string description: Week days. required: - class_name - teacher_id - group_num - semester responses: '201': description: Class registered successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object properties: message: type: string status_code: type: integer '400': description: Missing required fields content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/class/exams: get: summary: Retrieve exams for a class description: Retrieves all exams for a class based on class_id. tags: - Clases parameters: - in: query name: class_id required: true schema: type: string description: ID of the class. responses: '200': description: Exams retrieved successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object status_code: type: integer '400': description: Missing class_id parameter content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/class/students: get: summary: Retrieve students for a class description: Retrieves all students for a class based on class_id. tags: - Clases parameters: - in: query name: class_id required: true schema: type: string description: ID of the class. responses: '200': description: Students retrieved successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object status_code: type: integer '400': description: Missing class_id parameter content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/student/classes: get: summary: Retrieve classes for a student description: Retrieves all classes for a student based on student_id. tags: - Estudiantes parameters: - in: query name: student_id required: true schema: type: string description: ID of the student. responses: '200': description: Classes retrieved successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object status_code: type: integer '400': description: Missing student_id parameter content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/teacher/classes: get: summary: Retrieve classes for a teacher description: Retrieves all classes for a teacher based on teacher_id. tags: - Profesores parameters: - in: query name: teacher_id required: true schema: type: string description: ID of the teacher. responses: '200': description: Classes retrieved successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object status_code: type: integer '400': description: Missing teacher_id parameter content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/class/update: put: summary: Update a class description: Updates a class with the provided details. tags: - Clases requestBody: required: true content: application/json: schema: type: object properties: class_id: type: integer description: ID of the class. class_name: type: string description: Name of the class. teacher_id: type: integer description: ID of the teacher. group_num: type: integer description: Group number. semester: type: string description: Semester. class_room: type: string description: Class room. start_time: type: string description: Start time. end_time: type: string description: End time. week_days: type: string description: Week days. required: - class_id responses: '200': description: Class updated successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object properties: message: type: string status_code: type: integer '400': description: Missing required fields content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/exam/create: post: summary: Create a new exam description: Creates a new exam with the provided details. tags: - Exámenes requestBody: required: true content: application/json: schema: type: object properties: exam_name: type: string description: Name of the exam. class_id: type: integer description: ID of the class. date: type: string description: Date of the exam. class_room: type: string description: Class room. hour: type: string description: Hour of the exam. required: - exam_name - class_id responses: '201': description: Exam created successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object properties: message: type: string status_code: type: integer '400': description: Missing required fields content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/exam/delete: delete: summary: Delete an exam description: Deletes an exam based on exam_id. tags: - Exámenes parameters: - in: query name: exam_id required: true schema: type: string description: ID of the exam to delete. responses: '200': description: Exam deleted successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object status_code: type: integer '400': description: Missing exam_id parameter content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/exam/results: get: summary: Retrieve exam results description: Retrieves all results for an exam based on exam_id. tags: - Exámenes parameters: - in: query name: exam_id required: true schema: type: string description: ID of the exam. responses: '200': description: Exam results retrieved successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object status_code: type: integer '400': description: Missing exam_id parameter content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/exam/modify-result: post: summary: Modify exam results description: Modifies multiple exam results with the provided details. tags: - Exámenes requestBody: required: true content: application/json: schema: type: object properties: results: type: array items: type: object properties: result_id: type: integer description: ID of the exam result (optional for new results). score: type: number format: float description: Score of the exam. Must be a number between 0 and 100. student_id: type: integer description: ID of the student (required for new results). exam_id: type: integer description: ID of the exam (required for new results). class_id: type: integer description: ID of the class (required for new results). required: - score responses: '200': description: All exam results processed successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object properties: message: type: string status_code: type: integer '400': description: Missing required fields or invalid score value. Score must be a number between 0 and 100. content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/exam/update: put: summary: Update an exam description: Updates an exam with the provided details. tags: - Exámenes requestBody: required: true content: application/json: schema: type: object properties: exam_id: type: integer description: ID of the exam. exam_name: type: string description: Name of the exam. class_id: type: integer description: ID of the class. date: type: string description: Date of the exam. class_room: type: string description: Class room. hour: type: string description: Hour of the exam. required: - exam_id responses: '200': description: Exam updated successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object properties: message: type: string status_code: type: integer '400': description: Missing required fields content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/student/teachers: get: summary: Retrieve teachers for a student description: Retrieve the list of teachers and their classes for a given student. tags: - Estudiantes parameters: - in: query name: student_id required: true schema: type: string description: The ID of the student. responses: '200': description: A list of teachers and their classes. content: application/json: schema: type: object properties: success: type: boolean data: type: array items: type: object properties: name: type: string email: type: string class_name: type: array items: type: string status_code: type: integer '400': description: Missing or invalid student_id parameter. content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error. content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/student/exams: get: summary: Retrieve exams for a student description: Retrieves all exams for a student based on student_id. tags: - Estudiantes parameters: - in: query name: student_id required: true schema: type: string description: The ID of the student. responses: '200': description: Exams retrieved successfully content: application/json: schema: type: object properties: success: type: boolean data: type: array items: type: object properties: exam_id: type: integer exam_name: type: string class_id: type: integer date: type: string format: date class_room: type: string hour: type: string format: time score: type: number format: float class_name: type: string teacher_name: type: string status_code: type: integer '400': description: Missing or invalid student_id parameter. content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error. content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/user/info: get: summary: Retrieve user information description: Retrieves information for a specific user based on user_id and user_type. tags: - Usuarios parameters: - in: query name: user_id required: true schema: type: integer description: ID of the user to retrieve information for. - in: query name: user_type required: true schema: type: string enum: [student, teacher] description: Type of the user (student or teacher). responses: '200': description: User information retrieved successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object description: User information fields status_code: type: integer '400': description: Missing required parameters or invalid user type content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/user/modify: put: summary: Modify user information description: Updates information for a specific user based on user_id and user_type. tags: - Usuarios requestBody: required: true content: application/json: schema: type: object properties: user_id: type: integer description: ID of the user to modify. user_type: type: string enum: [student, teacher] description: Type of the user (student or teacher). name: type: string description: Full name of the user. username: type: string description: Username for the user. password: type: string description: Password for the user. email: type: string format: email description: Email address of the user. matnum: type: string description: Matriculation number (7-digit number, only for students). worknum: type: string description: Work number (6-digit number, only for teachers). faculty: type: string description: Faculty the user belongs to. birthdate: type: string format: date description: Birth date of the user. required: - user_id - user_type responses: '200': description: User information updated successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object properties: message: type: string status_code: type: integer '400': description: Missing required fields, validation errors, or duplicate values content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '404': description: User not found content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/assignment/create: post: summary: Create a new assignment description: Creates a new assignment for a class with required details. tags: - Tareas requestBody: required: true content: application/json: schema: type: object properties: title: type: string description: Title of the assignment. class_id: type: string description: ID of the class. due_date: type: string description: Due date in format YYYY-MM-DD HH:MM:SS. description: type: string description: Description of the assignment (optional). required: - title - class_id - due_date responses: '201': description: Assignment created successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object properties: assignment_id: type: string status_code: type: integer '400': description: Missing required fields or invalid date format content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/assignment/update: put: summary: Update an assignment description: Updates an existing assignment with new details. tags: - Tareas requestBody: required: true content: application/json: schema: type: object properties: assignment_id: type: string description: ID of the assignment to update. title: type: string description: New title of the assignment. class_id: type: string description: New class ID for the assignment. due_date: type: string description: New due date in format YYYY-MM-DD HH:MM:SS. description: type: string description: New description of the assignment. required: - assignment_id responses: '200': description: Assignment updated successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object properties: assignment_id: type: string status_code: type: integer '400': description: Missing required fields, no fields to update, or invalid date format content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '404': description: Assignment not found content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/assignment/delete: delete: summary: Delete an assignment description: Deletes an existing assignment by ID. tags: - Tareas parameters: - in: query name: assignment_id required: true schema: type: string description: ID of the assignment to delete. responses: '200': description: Assignment deleted successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object properties: assignment_id: type: string status_code: type: integer '400': description: Missing assignment_id parameter content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '404': description: Assignment not found content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/class/assignments: get: summary: Get assignments for a class description: Retrieves all assignments for a specific class. tags: - Clases parameters: - in: query name: class_id required: true schema: type: string description: ID of the class. responses: '200': description: Assignments retrieved successfully content: application/json: schema: type: object properties: success: type: boolean data: type: array items: type: object status_code: type: integer '400': description: Missing class_id parameter content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '404': description: Class not found content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/assignment/evidence/upload: post: summary: Upload assignment evidence description: Uploads evidence for an assignment completion by a student. tags: - Tareas requestBody: required: true content: multipart/form-data: schema: type: object properties: assignment_id: type: string description: ID of the assignment. student_id: type: string description: ID of the student. class_id: type: string description: ID of the class. file: type: string format: binary description: File to upload as evidence. required: - assignment_id - student_id - class_id - file application/json: schema: type: object properties: assignment_id: type: string description: ID of the assignment. student_id: type: string description: ID of the student. class_id: type: string description: ID of the class. file_data: type: string format: base64 description: Base64-encoded file data. required: - assignment_id - student_id - class_id - file_data responses: '201': description: Evidence uploaded successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object properties: evidence_id: type: string status_code: type: integer '400': description: Missing required fields or no file provided content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '404': description: Assignment, student, or class not found content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/assignment/evidence/list: get: summary: Get evidences for an assignment description: Retrieves all submitted evidences for a specific assignment. tags: - Tareas parameters: - in: query name: assignment_id required: true schema: type: string description: ID of the assignment. responses: '200': description: Evidences retrieved successfully content: application/json: schema: type: object properties: success: type: boolean data: type: array items: type: object properties: evidence_id: type: string assignment_id: type: string student_id: type: string class_id: type: string file_data: type: string description: Base64 encoded file data grade: type: number nullable: true feedback: type: string nullable: true description: Teacher's feedback on the submission file_name: type: string nullable: true description: Original name of the uploaded file file_extension: type: string nullable: true description: Extension of the uploaded file student_name: type: string student_username: type: string status_code: type: integer '400': description: Missing assignment_id parameter content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '404': description: Assignment not found content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/assignment/evidence/grade: put: summary: Grade assignment evidence description: Assigns a grade and optional feedback to a submitted assignment evidence. tags: - Tareas requestBody: required: true content: application/json: schema: type: object properties: evidence_id: type: string description: ID of the evidence to grade. grade: type: number description: Grade to assign to the evidence. feedback: type: string description: Optional feedback text for the student. required: - evidence_id - grade responses: '200': description: Evidence graded successfully content: application/json: schema: type: object properties: success: type: boolean example: true data: type: object properties: evidence_id: type: string example: "12345" status_code: type: integer example: 200 '400': description: Missing required parameters content: application/json: schema: type: object properties: success: type: boolean example: false error: type: string example: "Missing required parameter: evidence_id is required." status_code: type: integer example: 400 '404': description: Evidence not found content: application/json: schema: type: object properties: success: type: boolean example: false error: type: string example: "Evidence not found." status_code: type: integer example: 404 '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean example: false error: type: string example: "Database error" status_code: type: integer example: 500 /api/assignment/evidence/remove: delete: summary: Remove assignment evidence description: Removes a submitted evidence for an assignment. tags: - Tareas parameters: - in: query name: evidence_id required: true schema: type: string description: ID of the evidence to remove. responses: '200': description: Evidence removed successfully content: application/json: schema: type: object properties: success: type: boolean data: type: object properties: evidence_id: type: string status_code: type: integer '400': description: Missing evidence_id parameter content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '404': description: Evidence not found content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer /api/teacher/assignments: get: summary: Retrieve assignments for a teacher description: Gets all assignments for classes taught by a specific teacher. tags: - Profesores parameters: - in: query name: teacher_id required: true schema: type: string description: ID of the teacher responses: '200': description: Assignments successfully retrieved content: application/json: schema: type: object properties: success: type: boolean example: true data: type: array items: type: object properties: assignment_id: type: integer example: 1 title: type: string example: "Homework 1" description: type: string example: "Complete exercises 1-10" due_date: type: string format: date-time example: "2023-12-15T23:59:59" class_id: type: integer example: 5 class_name: type: string example: "Mathematics" semester: type: string example: "Fall 2023" group_num: type: string example: "A" submissions_count: type: integer example: 15 status_code: type: integer example: 200 '400': description: Missing teacher_id parameter content: application/json: schema: type: object properties: success: type: boolean example: false error: type: string example: "Missing teacher_id parameter" status_code: type: integer example: 400 '404': description: Teacher not found content: application/json: schema: type: object properties: success: type: boolean example: false error: type: string example: "Teacher not found" status_code: type: integer example: 404 '500': description: Server error content: application/json: schema: type: object properties: success: type: boolean example: false error: type: string example: "Database error" status_code: type: integer example: 500 /api/student/assignments: get: summary: Retrieve assignments for a student description: Gets all assignments for classes a student is enrolled in. tags: - Estudiantes parameters: - in: query name: student_id required: true schema: type: string description: ID of the student responses: '200': description: Assignments successfully retrieved content: application/json: schema: type: object properties: success: type: boolean example: true data: type: array items: type: object properties: assignment_id: type: integer example: 1 title: type: string example: "Homework 1" description: type: string example: "Complete exercises 1-10" due_date: type: string format: date-time example: "2023-12-15T23:59:59" class_id: type: integer example: 5 class_name: type: string example: "Mathematics" semester: type: string example: "Fall 2023" teacher_name: type: string example: "John Smith" submitted: type: boolean example: true status_code: type: integer example: 200 '400': description: Missing student_id parameter content: application/json: schema: type: object properties: success: type: boolean example: false error: type: string example: "Missing student_id parameter" status_code: type: integer example: 400 '404': description: Student not found content: application/json: schema: type: object properties: success: type: boolean example: false error: type: string example: "Student not found" status_code: type: integer example: 404 '500': description: Server error content: application/json: schema: type: object properties: success: type: boolean example: false error: type: string example: "Database error" status_code: type: integer example: 500 /api/attendance/modify: put: summary: Create or update attendance records description: Creates new attendance records or updates existing ones if records already exist for the student(s), class, and date. tags: - Asistencia requestBody: required: true content: application/json: schema: type: object properties: class_id: type: integer description: ID of the class for the attendance record. student_id: oneOf: - type: integer - type: array items: type: integer description: ID of a single student or an array of student IDs. student_ids: type: array items: type: integer description: Alternative parameter for multiple student IDs. attendance_date: type: string format: date description: Date of attendance (YYYY-MM-DD). attendance_time: type: string format: time description: Optional time of attendance (HH:MM:SS). present: type: boolean description: Attendance status (true = present, false = absent). default: true required: - class_id - attendance_date example: class_id: 4 student_id: [102, 103] attendance_date: "2023-10-10" attendance_time: "09:00:00" present: true examples: singleStudent: summary: Single student attendance value: class_id: 4 student_id: 102 attendance_date: "2023-10-10" attendance_time: "09:00:00" present: true multipleStudents: summary: Multiple students attendance value: class_id: 4 student_id: [102, 103, 104] attendance_date: "2023-10-10" attendance_time: "09:00:00" present: true responses: '201': description: Attendance records created or updated successfully content: application/json: schema: type: object properties: success: type: boolean description: Indicates if the operation was successful. example: true data: type: object properties: created_attendance_ids: type: array items: type: integer description: IDs of newly created attendance records. updated_attendance_ids: type: array items: type: integer description: IDs of updated attendance records. example: created_attendance_ids: [501, 502] updated_attendance_ids: [] status_code: type: integer description: HTTP status code. example: 201 '400': description: Missing required fields or invalid student IDs format content: application/json: schema: type: object properties: success: type: boolean example: false error: type: string example: "Missing required field: class_id" status_code: type: integer example: 400 '404': description: One or more student IDs not found content: application/json: schema: type: object properties: success: type: boolean example: false error: type: string example: "The following student IDs do not exist: 999, 998" status_code: type: integer example: 404 '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean example: false error: type: string example: "Database error" status_code: type: integer example: 500 post: summary: Create or update attendance records description: Creates new attendance records or updates existing ones if records already exist for the student(s), class, and date. tags: - Asistencia /api/attendance/class: get: summary: Retrieve attendance records for a class description: Gets all attendance records for a specific class, including student names and registration numbers. tags: - Asistencia parameters: - in: query name: class_id required: true schema: type: string description: ID of the class to get attendance records for. responses: '200': description: Attendance records retrieved successfully content: application/json: schema: type: object properties: success: type: boolean example: true data: type: array items: type: object properties: attendance_id: type: integer example: 42 student_id: type: integer example: 102 class_id: type: integer example: 4 date: type: string format: date example: "2023-10-15" time: type: string format: time example: "09:00:00" present: type: boolean example: true student_name: type: string example: "Juan Perez" student_matnum: type: string example: "A012345" status_code: type: integer example: 200 example: success: true data: [ { "attendance_id": 42, "student_id": 102, "class_id": 4, "date": "2023-10-15", "time": "09:00:00", "present": true, "student_name": "Juan Perez", "student_matnum": "A012345" }, { "attendance_id": 43, "student_id": 103, "class_id": 4, "date": "2023-10-15", "time": "09:00:00", "present": false, "student_name": "Maria Rodriguez", "student_matnum": "A012346" } ] status_code: 200 /api/teacher/exams: get: summary: Retrieve exams for a teacher description: Gets all exams for classes taught by a specific teacher. tags: - Profesores parameters: - in: query name: teacher_id required: true schema: type: string description: ID of the teacher responses: '200': description: Exams retrieved successfully content: application/json: schema: type: object properties: success: type: boolean data: type: array items: type: object properties: exam_id: type: integer exam_name: type: string class_id: type: integer class_room: type: string date: type: string format: date-time hour: type: string format: time error: type: string nullable: true status_code: type: integer example: success: true data: [ { "exam_id": 6, "exam_name": "Medio Curso", "class_id": 7, "class_room": "1101", "date": "Thu, 16 Jan 2025 00:00:00 GMT", "hour": "13:40:00" }, { "exam_id": 4, "exam_name": "Medio Curso", "class_id": 4, "class_room": "1101", "date": "Thu, 23 Jan 2025 00:00:00 GMT", "hour": "12:00:00" } ] error: null status_code: 200 '400': description: Missing teacher_id parameter content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '404': description: Teacher not found or no exams found content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer '500': description: Internal server error content: application/json: schema: type: object properties: success: type: boolean error: type: string status_code: type: integer