mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
fix: account name unique validation.
This commit is contained in:
@@ -204,9 +204,7 @@ export default class AccountsController extends BaseController{
|
||||
try {
|
||||
const account = await this.accountsService.editAccount(tenantId, accountId, accountDTO);
|
||||
return res.status(200).send({ id: account.id });
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
if (error instanceof ServiceError) {
|
||||
this.transformServiceErrorToResponse(res, error);
|
||||
}
|
||||
@@ -251,7 +249,6 @@ export default class AccountsController extends BaseController{
|
||||
return res.status(200).send({ id: accountId });
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
if (error instanceof ServiceError) {
|
||||
this.transformServiceErrorToResponse(res, error);
|
||||
|
||||
@@ -366,6 +363,12 @@ export default class AccountsController extends BaseController{
|
||||
errors: [{ type: 'ACCOUNT.NOT.FOUND', code: 100 }] }
|
||||
);
|
||||
}
|
||||
if (error.errorType === 'account_name_not_unqiue') {
|
||||
return res.boom.badRequest(
|
||||
'The given account not unique.',
|
||||
{ errors: [{ type: 'ACCOUNT.NAME.NOT.UNIQUE', code: 150 }], }
|
||||
);
|
||||
}
|
||||
if (error.errorType === 'account_type_not_found') {
|
||||
return res.boom.badRequest(
|
||||
'The given account type not found.', {
|
||||
|
||||
Reference in New Issue
Block a user