This pull request implements the functionalities for the ParcialTemplate. It includes a filter to search by state, restrictions to assign hours depending on the state and also includes validations for all registration and update fields, and validations of id - foreign keys.
Changes
Controller: Changed PartialTemplateControllerstatus was included in the @Get method.
Service: In the service PartialTemplateService the error messages were added (Spanish) and with the established structure. A filter by status was implemented, and what information would be displayed in the queries was also specified. Validations were added for the ID and foreign keys, in addition to implementing a restriction of hours by the type of position.
DTOs:CreatePartialTemplateDto and UpdatePartialTemplateDto were modified to establish validation of the data we expect to insert into the database.
Documentation: Some documentation at code level, such as JSDoc or dosctrings.
Details
Partial Template Controller
create(): Handles POST requests to create new partial template.
findAll(): Handles GET requests to retrieve all partial templates.
findOne(): Handles GET requests to retrieve partial template by ID.
update(): Handles PATCH requests to update a partial template by ID.
delete(): Remove a partial template by ID.
Partial Template Service
create(): Validates and creates a new partial template.
findAll(): Validates and recovers all partial templates, optionally be filtered by status.
findOne(): Validates and retrieves a partial template by ID, verifying that it exists.
update(): Validates and updates the information of a partial template by ID.
remove(): Remove a partial template by ID.
validateId(): Validate the id, to know if it exists.
validateForeignKeys(): Validate the existence of templateId.
validateTotalByPosition(): Validate the total entered with respect to the position.
DTOs
CreatePartialTemplate(): Defines the data structure to create a Partial Template. Including the type of data you expect, to implement data validation.
UpdatePartialTemplate(): Defines the data structure to update a Partial Template. Including the type of data you expect, to implement data validation.
JSDoc Documentation
Added detailed documentation to all methods and classes in the PartialTemplateController and PartialTemplateService for better understanding and maintenance.
Related Issues
Closes #7
Thank you for reviewing this pull request. I look forward to your feedback.
Overview
This pull request implements the functionalities for the
ParcialTemplate
. It includes a filter to search by state, restrictions to assign hours depending on the state and also includes validations for all registration and update fields, and validations of id - foreign keys.Changes
PartialTemplateController
status was included in the @Get method.PartialTemplateService
the error messages were added (Spanish) and with the established structure. A filter by status was implemented, and what information would be displayed in the queries was also specified. Validations were added for the ID and foreign keys, in addition to implementing a restriction of hours by the type of position.CreatePartialTemplateDto
andUpdatePartialTemplateDto
were modified to establish validation of the data we expect to insert into the database.Details
Partial Template Controller
create()
: Handles POST requests to create new partial template.findAll()
: Handles GET requests to retrieve all partial templates.findOne()
: Handles GET requests to retrieve partial template by ID.update()
: Handles PATCH requests to update a partial template by ID.delete()
: Remove a partial template by ID.Partial Template Service
create()
: Validates and creates a new partial template.findAll()
: Validates and recovers all partial templates, optionally be filtered by status.findOne()
: Validates and retrieves a partial template by ID, verifying that it exists.update()
: Validates and updates the information of a partial template by ID.remove()
: Remove a partial template by ID.validateId()
: Validate the id, to know if it exists.validateForeignKeys()
: Validate the existence oftemplateId
.validateTotalByPosition()
: Validate the total entered with respect to the position.DTOs
CreatePartialTemplate()
: Defines the data structure to create a Partial Template. Including the type of data you expect, to implement data validation.UpdatePartialTemplate()
: Defines the data structure to update a Partial Template. Including the type of data you expect, to implement data validation.JSDoc Documentation
PartialTemplateController
andPartialTemplateService
for better understanding and maintenance.Related Issues
Thank you for reviewing this pull request. I look forward to your feedback.