mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
feat: licenses administration basic authentication.
feat: accounts slug. feat: duplicate accounts_balance table and merge balance with accounts table. feat: refactoring customers and vendors. feat: system user soft deleting. feat: preventing build tenant database without any subscription. feat: remove 'password' property from 'req.user' object. feat: refactoring JournalPoster class. feat: delete duplicated directories and files.
This commit is contained in:
@@ -9,6 +9,9 @@ export default class UsersService {
|
||||
@Inject()
|
||||
tenancy: TenancyService;
|
||||
|
||||
@Inject('logger')
|
||||
logger: any;
|
||||
|
||||
/**
|
||||
* Creates a new user.
|
||||
* @param {number} tenantId
|
||||
@@ -61,6 +64,7 @@ export default class UsersService {
|
||||
id: userId, tenant_id: tenantId,
|
||||
});
|
||||
if (!user) {
|
||||
this.logger.info('[users] the given user not found.', { tenantId, userId });
|
||||
throw new ServiceError('user_not_found');
|
||||
}
|
||||
return user;
|
||||
@@ -73,7 +77,12 @@ export default class UsersService {
|
||||
*/
|
||||
async deleteUser(tenantId: number, userId: number): Promise<void> {
|
||||
await this.getUserOrThrowError(tenantId, userId);
|
||||
await SystemUser.query().where('id', userId).delete();
|
||||
|
||||
this.logger.info('[users] trying to delete the given user.', { tenantId, userId });
|
||||
await SystemUser.query().where('tenant_id', tenantId)
|
||||
.where('id', userId).delete();
|
||||
|
||||
this.logger.info('[users] the given user deleted successfully.', { tenantId, userId });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user