fix: Consequence kezelés és deck szerkesztés javítások
- TaskCardEditor és JokerCardEditor: consequence mezők eltávolítása (csak LuckCardEditor-nél marad) - DeckCreator: kártya type konverzió javítása betöltéskor (szám -> string) - DeckCreator: csak megfelelő típusú kártyák megtartása mentéskor - UpdateDeckCommandHandler: userstate -> authLevel javítás (interface mező helyesen) - sql_schema_only.sql: trigger függvény javítása (NEW.updatedate -> NEW.update_date)
This commit is contained in:
@@ -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);
|
||||
@@ -24,7 +24,7 @@ export class UpdateDeckCommandHandler {
|
||||
throw new Error('Deck not found');
|
||||
}
|
||||
|
||||
if(cmd.authLevel !==1 && existingDeck.userid !== cmd.userid) {
|
||||
if(cmd.authLevel !== 1 && existingDeck.userid !== cmd.userid) {
|
||||
logAuth(`Unauthorized access attempt to deck with ID: ${cmd.id}, UserID: ${cmd.userid}`);
|
||||
throw new Error('Unauthorized');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user