Trabajo
BASE: /api/trabajos
GET BASE
GET BASE /:id
POST BASE
PUT BASE /:id
DELETE BASE /:id
GET BASE /pendientes
GET BASE /sinTrabajador
GET BASE /completados
GET BASE /:id/trabajador
PUT BASE /asignar/:codTrabajo/:idTrabajador
PUT BASE /finalizar/:id
Marks a task as completed by setting the completion date and the duration of the task. Checks if the task exists. Checks if the task has a worker assigned. Checks that tiempo is not greater than 8 hours per day. Checks that fec_fin is not before fecIni. Checks that fec_fin is not after the current date. If fec_fin is not provided, it will set the current date. If tiempo is not provided, it will set the duration to 8 hours per day (not the best algorithm, as no one works 8 hours every day). If the task is already completed, just updates following the same rules mentioned above.
/api/trabajos/finalizar/J8
/api/trabajos/finalizar/J8?fec_fin=2024-01-09
/api/trabajos/finalizar/J8?fec_fin=2024-01-10
/api/trabajos/finalizar/J8?tiempo=10
/api/trabajos/finalizar/J8?fec_fin=2024-01-10&tiempo=10
/api/trabajos/finalizar/J009
/api/trabajos/finalizar/J008
/api/trabajos/finalizar/J8?fec_fin=2024-01-04
/api/trabajos/finalizar/J8?fec_fin=2094-01-10
/api/trabajos/finalizar/J8?fec_fin=2024-01-10&tiempo=200
/api/trabajos/finalizar/J8?fec_fin=2024-01-10&tiempo=-2
PUT BASE /editarFechaFin/:id
This endpoint is necessary, as simple PUT BASE /:id does not check anything, and PUT BASE /finalizar/:id will calculate tiempo when it's not provided.
Same as PUT BASE /finalizar/:id but only for the completion date.
/api/trabajos/editarFechaFin/J8?fec_fin=2024-01-10
/api/trabajos/editarFechaFin/J8
/api/trabajos/editarFechaFin/J8?fec_fin=2024-01-05
/api/trabajos/editarFechaFin/J8?fec_fin=2094-01-10
PUT BASE /editarTiempo/:id
This endpoint is necessary, as simple PUT BASE /:id does not check anything, and PUT BASE /finalizar/:id will assume today's date when fec_fin is not provided.
Same as PUT BASE /finalizar/:id but only for the duration of the task. Also checks that fec_fin is not null
/api/trabajos/editarTiempo/J8?tiempo=4
/api/trabajos/editarTiempo/J8
/api/trabajos/editarTiempo/J8?fec_fin=2024-01-05
/api/trabajos/editarTiempo/J8?fec_fin=2094-01-10
/api/trabajos/editarFechaFin/J8?tiempo=3
Assuming fec_fin is null