import { BaseCustomManager } from 'src/core/modules/domain/usecase/managers/base-custom.manager'; import { EventTopics } from 'src/core/strings/constants/interface.constants'; import { UserModel } from 'src/modules/user-related/user/data/models/user.model'; import { UserEntity } from 'src/modules/user-related/user/domain/entities/user.entity'; import { LogUserType } from 'src/core/helpers/constant'; import { LogUserLoginEvent } from 'src/modules/configuration/log/domain/entities/log-user-login.event'; export class LogoutManager extends BaseCustomManager { async validateProcess(): Promise { return; } async beforeProcess(): Promise { return; } async process(): Promise { await this.dataService.update( this.queryRunner, this.entityTarget, { id: this.user.id }, { refresh_token: null, }, ); await this.publishEvents(); return; } async afterProcess(): Promise { return; } getResult() { return `Success Logout user`; } get entityTarget(): any { return UserModel; } get eventTopics(): EventTopics[] { return [ { topic: LogUserLoginEvent, data: { type: LogUserType.logout, role: this.user.role, user_id: this.user.id, username: this.user.name, created_at: new Date().getTime(), }, }, ]; } }