mirror of
https://gitlab.com/mobicoop/v3/service/user.git
synced 2026-02-01 22:40:45 +00:00
fix logging
This commit is contained in:
@@ -30,8 +30,12 @@ export class CreateUserUseCase {
|
|||||||
this._loggingMessager.publish('user.create.info', JSON.stringify(user));
|
this._loggingMessager.publish('user.create.info', JSON.stringify(user));
|
||||||
return user;
|
return user;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
let key = 'user.create.crit';
|
||||||
|
if (error.message.includes('Already exists')) {
|
||||||
|
key = 'user.create.warning';
|
||||||
|
}
|
||||||
this._loggingMessager.publish(
|
this._loggingMessager.publish(
|
||||||
'user.create.critical',
|
key,
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
command,
|
command,
|
||||||
error,
|
error,
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ export class DeleteUserUseCase {
|
|||||||
const user = await this._repository.delete(command.uuid);
|
const user = await this._repository.delete(command.uuid);
|
||||||
this._userMessager.publish('delete', JSON.stringify({ uuid: user.uuid }));
|
this._userMessager.publish('delete', JSON.stringify({ uuid: user.uuid }));
|
||||||
this._loggingMessager.publish(
|
this._loggingMessager.publish(
|
||||||
'delete',
|
'user.delete.info',
|
||||||
JSON.stringify({ uuid: user.uuid }),
|
JSON.stringify({ uuid: user.uuid }),
|
||||||
);
|
);
|
||||||
return user;
|
return user;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this._loggingMessager.publish(
|
this._loggingMessager.publish(
|
||||||
'user.delete.critical',
|
'user.delete.crit',
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
command,
|
command,
|
||||||
error,
|
error,
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export class UpdateUserUseCase {
|
|||||||
return user;
|
return user;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this._loggingMessager.publish(
|
this._loggingMessager.publish(
|
||||||
'user.update.critical',
|
'user.update.crit',
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
command,
|
command,
|
||||||
error,
|
error,
|
||||||
|
|||||||
Reference in New Issue
Block a user