fixes
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;
|
||||
|
||||
@@ -9,12 +9,12 @@ export class UpdateDeckCommandHandler {
|
||||
constructor(private readonly deckRepo: IDeckRepository) {}
|
||||
|
||||
async execute(cmd: UpdateDeckCommand): Promise<ShortDeckDto | null> {
|
||||
if(cmd.state !== undefined && cmd.userstate!==1) {
|
||||
if(cmd.state !== undefined && cmd.authLevel!==1) {
|
||||
throw new Error('Only admin users can change deck state');
|
||||
}
|
||||
try {
|
||||
let existingDeck: DeckAggregate | null = null;
|
||||
if (cmd.userstate === 1) {
|
||||
if (cmd.authLevel === 1) {
|
||||
existingDeck = await this.deckRepo.findByIdIncludingDeleted(cmd.id);
|
||||
} else {
|
||||
existingDeck = await this.deckRepo.findById(cmd.id);
|
||||
|
||||
@@ -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