fix(server): validation events actually throwing an error (#8172)

* fix validation events

* add e2e test
This commit is contained in:
Daniel Dietzler 2024-03-21 23:59:21 +01:00 committed by GitHub
parent 508f32c08a
commit d6823b128c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 36 additions and 8 deletions

View file

@ -1,5 +1,4 @@
import { BadRequestException, Inject, Injectable } from '@nestjs/common';
import { OnEvent } from '@nestjs/event-emitter';
import { Trie } from 'mnemonist';
import { R_OK } from 'node:constants';
import { EventEmitter } from 'node:events';
@ -8,6 +7,7 @@ import path, { basename, parse } from 'node:path';
import picomatch from 'picomatch';
import { StorageCore } from 'src/cores/storage.core';
import { SystemConfigCore } from 'src/cores/system-config.core';
import { OnEventInternal } from 'src/decorators';
import {
CreateLibraryDto,
LibraryResponseDto,
@ -105,7 +105,7 @@ export class LibraryService extends EventEmitter {
});
}
@OnEvent(InternalEvent.VALIDATE_CONFIG)
@OnEventInternal(InternalEvent.VALIDATE_CONFIG)
validateConfig({ newConfig }: InternalEventMap[InternalEvent.VALIDATE_CONFIG]) {
const { scan } = newConfig.library;
if (!validateCronExpression(scan.cronExpression)) {