Merge remote changes into javitasok-plusz
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { DeckAggregate } from '../../../Domain/Deck/DeckAggregate';
|
||||
import { UserAggregate } from '../../../Domain/User/UserAggregate';
|
||||
import { CreateDeckDto, UpdateDeckDto, ShortDeckDto, DetailDeckDto } from '../DeckDto';
|
||||
import e from 'express';
|
||||
|
||||
export class DeckMapper {
|
||||
static toShortDto(deck: DeckAggregate, userId?: string): ShortDeckDto {
|
||||
|
||||
@@ -22,7 +22,7 @@ export class OrganizationMapper {
|
||||
contactemail: org.contactemail,
|
||||
state: org.state,
|
||||
regdate: org.regdate,
|
||||
updatedate: org.updatedate,
|
||||
updateDate: org.updateDate,
|
||||
url: org.url,
|
||||
userinorg: org.userinorg,
|
||||
maxOrganizationalDecks: org.maxOrganizationalDecks,
|
||||
|
||||
@@ -27,7 +27,7 @@ export interface DetailOrganizationDto {
|
||||
contactemail: string;
|
||||
state: number;
|
||||
regdate: Date;
|
||||
updatedate: Date;
|
||||
updateDate: Date;
|
||||
url: string | null;
|
||||
userinorg: number;
|
||||
maxOrganizationalDecks: number | null;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,7 @@ export class LogoutCommandHandler {
|
||||
|
||||
// 5. Update user's last logout timestamp in database
|
||||
try {
|
||||
const updateResult = await this.userRepo.update(userId, { updatedate: new Date() });
|
||||
const updateResult = await this.userRepo.update(userId, { updateDate: new Date() });
|
||||
if (updateResult) {
|
||||
logAuth('User last logout timestamp updated', userId);
|
||||
}
|
||||
@@ -151,7 +151,7 @@ export class LogoutCommandHandler {
|
||||
}
|
||||
|
||||
// Update user logout timestamp
|
||||
await this.userRepo.update(userId, { updatedate: new Date() });
|
||||
await this.userRepo.update(userId, { updateDate: new Date() });
|
||||
|
||||
logAuth('User logged out from all devices', userId);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user