Skip to content

Commit 422c93c

Browse files
committed
fix: API: Increase fields sizes, remove description validation on task updates
1 parent fbcdfcd commit 422c93c

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

api/models/projects.model.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const deleteTask = (taskId) => {
120120
const updateTask = (taskId, dataObject) => {
121121
const data = {
122122
...dataObject,
123-
finishDate: dataObject.isFinished ? Date.now() : undefined
123+
finishDate: dataObject.isFinished ? Date.now() : null
124124
};
125125

126126
helpers.removeUndefinedFields(data);

api/routes/projects.route.js

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ router.put('/project/:id',
2222
router.put('/project/:id/task/:taskId',
2323
projectsValidator.validateProjectIdParam(),
2424
projectsValidator.validateTaskIdParam(),
25-
projectsValidator.validateTaskParams(),
2625
projectsController.updateProjectTask);
2726

2827
router.delete('/project/:id', projectsValidator.validateProjectIdParam(), projectsController.deleteProject);

api/validators/constants.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ module.exports = {
4040
},
4141
PROJECT_NAME: {
4242
MAX_SIZE: {
43-
VALUE: 40,
44-
ERROR_CODE: ERROR_CODES_CONSTANTS.PROJECT_NAME_MAX_SIZE_40_EXCEEDED
43+
VALUE: 1024,
44+
ERROR_CODE: ERROR_CODES_CONSTANTS.PROJECT_NAME_MAX_SIZE_1024_EXCEEDED
4545
},
4646
INVALID: {
4747
ERROR_CODE: ERROR_CODES_CONSTANTS.INVALID_PROJECT_NAME_STRING
@@ -71,8 +71,8 @@ module.exports = {
7171
ERROR_CODE: ERROR_CODES_CONSTANTS.TASK_DESCRIPTION_REQUIRED
7272
},
7373
MAX_SIZE: {
74-
VALUE: 3000,
75-
ERROR_CODE: ERROR_CODES_CONSTANTS.TASK_DESCRIPTION_MAX_SIZE_3000_EXCEEDED
74+
VALUE: 2068,
75+
ERROR_CODE: ERROR_CODES_CONSTANTS.TASK_DESCRIPTION_MAX_SIZE_2068_EXCEEDED
7676
}
7777
}
7878
}

framework/constants/errorCodes.constants.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ module.exports = {
2525

2626
PROJECT_NAME_REQUIRED: 'PROJECT_NAME_REQUIRED',
2727
INVALID_PROJECT_NAME_STRING: 'INVALID_PROJECT_NAME_STRING',
28-
PROJECT_NAME_MAX_SIZE_40_EXCEEDED: 'PROJECT_NAME_MAX_SIZE_40_EXCEEDED',
28+
PROJECT_NAME_MAX_SIZE_1024_EXCEEDED: 'PROJECT_NAME_MAX_SIZE_1024_EXCEEDED',
2929
PROJECT_NOT_FOUND: 'PROJECT_NOT_FOUND',
3030
PROJECT_ID_REQUIRED: 'PROJECT_ID_REQUIRED',
3131

3232
TASK_ID_REQUIRED: 'PROJECT_ID_REQUIRED',
3333
TASK_NOT_FOUND: 'TASK_NOT_FOUND',
3434
TASK_DESCRIPTION_REQUIRED: 'TASK_DESCRIPTION_REQUIRED',
35-
TASK_DESCRIPTION_MAX_SIZE_3000_EXCEEDED: 'TASK_DESCRIPTION_MAX_SIZE_3000_EXCEEDED'
35+
TASK_DESCRIPTION_MAX_SIZE_2068_EXCEEDED: 'TASK_DESCRIPTION_MAX_SIZE_2068_EXCEEDED'
3636
};

0 commit comments

Comments
 (0)