mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
feat: remove path alias.
feat: remove Webpack and depend on nodemon. feat: refactoring expenses. feat: optimize system users with caching. feat: architecture tenant optimize.
This commit is contained in:
70
server/src/api/controllers/Contacts/Contacts.ts
Normal file
70
server/src/api/controllers/Contacts/Contacts.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import { check, param, query } from 'express-validator';
|
||||
import BaseController from "api/controllers/BaseController";
|
||||
|
||||
export default class ContactsController extends BaseController {
|
||||
|
||||
/**
|
||||
* Contact DTO schema.
|
||||
*/
|
||||
get contactDTOSchema() {
|
||||
return [
|
||||
check('first_name').optional().trim().escape(),
|
||||
check('last_name').optional().trim().escape(),
|
||||
|
||||
check('company_name').optional().trim().escape(),
|
||||
check('display_name').exists().trim().escape(),
|
||||
|
||||
check('email').optional().isEmail().trim().escape(),
|
||||
check('work_phone').optional().trim().escape(),
|
||||
check('personal_phone').optional().trim().escape(),
|
||||
|
||||
check('billing_address_city').optional().trim().escape(),
|
||||
check('billing_address_country').optional().trim().escape(),
|
||||
check('billing_address_email').optional().isEmail().trim().escape(),
|
||||
check('billing_address_zipcode').optional().trim().escape(),
|
||||
check('billing_address_phone').optional().trim().escape(),
|
||||
check('billing_address_state').optional().trim().escape(),
|
||||
|
||||
check('shipping_address_city').optional().trim().escape(),
|
||||
check('shipping_address_country').optional().trim().escape(),
|
||||
check('shipping_address_email').optional().isEmail().trim().escape(),
|
||||
check('shipping_address_zip_code').optional().trim().escape(),
|
||||
check('shipping_address_phone').optional().trim().escape(),
|
||||
check('shipping_address_state').optional().trim().escape(),
|
||||
|
||||
check('note').optional().trim().escape(),
|
||||
check('active').optional().isBoolean().toBoolean(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Contact new DTO schema.
|
||||
*/
|
||||
get contactNewDTOSchema() {
|
||||
return [
|
||||
check('balance').optional().isNumeric().toInt(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Contact edit DTO schema.
|
||||
*/
|
||||
get contactEditDTOSchema() {
|
||||
return [
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
get specificContactSchema() {
|
||||
return [
|
||||
param('id').exists().isNumeric().toInt(),
|
||||
];
|
||||
}
|
||||
|
||||
get bulkContactsSchema() {
|
||||
return [
|
||||
query('ids').isArray({ min: 2 }),
|
||||
query('ids.*').isNumeric().toInt(),
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user