mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
19 lines
1.2 KiB
JavaScript
19 lines
1.2 KiB
JavaScript
/***********************************************************************************************************************************************************************
|
|
* File Name: profile.validator.js
|
|
* Type of Program: Validator
|
|
* Description: express-validator rule chains for profile update endpoints.
|
|
* Author: rgrgogu
|
|
* Date Created: Oct. 6, 2025
|
|
***********************************************************************************************************************************************************************/
|
|
const { body } = require('express-validator');
|
|
|
|
const updateProfileValidator = [
|
|
body('personal_info').optional().isObject().withMessage('personal_info must be an object.'),
|
|
body('personal_info.name').optional().isObject(),
|
|
body('personal_info.name.given_name').optional().isString().trim().isLength({ max: 100 }),
|
|
body('personal_info.name.last_name').optional().isString().trim().isLength({ max: 100 }),
|
|
body('personal_info.occupation').optional().isString().trim().isLength({ max: 150 }),
|
|
body('personal_info.date_of_birth').optional().isDate().withMessage('date_of_birth must be a valid date.'),
|
|
];
|
|
|
|
module.exports = { updateProfileValidator }; |