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:
GitG0r0
2025-10-27 18:27:40 +01:00
parent d0741c273f
commit d3dcb7f7da
5 changed files with 91 additions and 276 deletions
@@ -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');
}