"activate user admin"
This commit is contained in:
@@ -39,6 +39,7 @@ import { ProcessOrgAuthCallbackCommandHandler } from '../Organization/commands/P
|
||||
import { CreateContactCommandHandler } from '../Contact/commands/CreateContactCommandHandler';
|
||||
import { UpdateContactCommandHandler } from '../Contact/commands/UpdateContactCommandHandler';
|
||||
import { DeleteContactCommandHandler } from '../Contact/commands/DeleteContactCommandHandler';
|
||||
import { ActivateUserCommandHandler } from '../User/commands/ActivateUserCommandHandler';
|
||||
|
||||
// Query Handlers
|
||||
import { GetUserByIdQueryHandler } from '../User/queries/GetUserByIdQueryHandler';
|
||||
@@ -121,6 +122,7 @@ export class DIContainer {
|
||||
private _updateContactCommandHandler: UpdateContactCommandHandler | null = null;
|
||||
private _deleteContactCommandHandler: DeleteContactCommandHandler | null = null;
|
||||
private _generateBoardCommandHandler: GenerateBoardCommandHandler | null = null;
|
||||
private _activateUserCommandHandler: ActivateUserCommandHandler | null = null;
|
||||
|
||||
// Query Handlers
|
||||
private _getUserByIdQueryHandler: GetUserByIdQueryHandler | null = null;
|
||||
@@ -306,6 +308,13 @@ export class DIContainer {
|
||||
return this._deactivateUserCommandHandler;
|
||||
}
|
||||
|
||||
public get activateUserCommandHandler(): ActivateUserCommandHandler {
|
||||
if (!this._activateUserCommandHandler) {
|
||||
this._activateUserCommandHandler = new ActivateUserCommandHandler(this.userRepository);
|
||||
}
|
||||
return this._activateUserCommandHandler;
|
||||
}
|
||||
|
||||
public get deleteUserCommandHandler(): DeleteUserCommandHandler {
|
||||
if (!this._deleteUserCommandHandler) {
|
||||
this._deleteUserCommandHandler = new DeleteUserCommandHandler(this.userRepository);
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
export interface ActivateUserCommand {
|
||||
id: string;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { IUserRepository } from '../../../Domain/IRepository/IUserRepository';
|
||||
import { ActivateUserCommand } from './ActivateUserCommand';
|
||||
|
||||
|
||||
export class ActivateUserCommandHandler {
|
||||
constructor(private readonly userRepo: IUserRepository) {}
|
||||
|
||||
async execute(cmd: ActivateUserCommand): Promise<boolean> {
|
||||
await this.userRepo.activate(cmd.id);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user