add migrations (package, config, migrations), add exceptions filter for kodi, start VideoFiles module

This commit is contained in:
Jurgis Sakalauskas
2023-01-03 10:58:33 +02:00
parent 2fb78b61c4
commit 9cf70326af
27 changed files with 295 additions and 69 deletions
+19 -13
View File
@@ -7,27 +7,33 @@ export class PathsConfig {
}
public getStaticRequestsLogPath(): string {
return join(
this.getRootPath(),
this.configService.getEnv('LOG_FILE_REQUESTS'),
);
return this.getPathByEnvKey('LOG_FILE_REQUESTS');
}
public getStaticFolder(): string {
return join(
this.getRootPath(),
this.configService.getEnv('STATIC_SERVE_FOLDER'),
);
return this.getPathByEnvKey('STATIC_SERVE_FOLDER');
}
public getRecentSearchesFolder(): string {
return join(
this.getRootPath(),
this.configService.getEnv('RECENT_SEARCHES_FOLDER'),
);
return this.getPathByEnvKey('RECENT_SEARCHES_FOLDER');
}
private getPathByEnvKey(key: string) {
const relPath = this.configService.getEnv(key);
return this.getPath(relPath);
}
private getPath(relPath: string) {
if (relPath[0] === '/') {
//this is an absolute path
return relPath;
}
return join(this.getRootPath(), relPath);
}
private getRootPath(): string {
return join(__dirname, '../..');
return this.configService.getEnv('PWD');
}
}
+11
View File
@@ -0,0 +1,11 @@
import { DataSource, DataSourceOptions } from 'typeorm';
import { configService } from './config.service';
/**
* config for typeorm cli
*/
export default new DataSource(<DataSourceOptions>{
type: configService.getTypeOrmConfig().type,
database: configService.getTypeOrmConfig().database,
migrations: ['migrations/*{.ts,.js}'],
});
+2 -2
View File
@@ -1,8 +1,8 @@
import { LrtCategory } from '../KodiApi/LRT/LrtApiClient/Entity/lrt-category.entity';
import { TitleEntity } from '../KodiApi/AllFiles/Entity/title.entity';
import { FileEntity } from '../KodiApi/AllFiles/Entity/file.entity';
import { ConfigService } from './config.service';
import { EntityClassOrSchema } from '@nestjs/typeorm/dist/interfaces/entity-class-or-schema.type';
import { TitleEntity } from '../VideoFiles/Entity/title.entity';
import { FileEntity } from '../VideoFiles/Entity/file.entity';
export class TypeOrmConfig {
constructor(configService: ConfigService) {