add constraint
This commit is contained in:
parent
e71f08a3de
commit
a08964bd4a
@ -2,6 +2,8 @@ import { NestFactory } from '@nestjs/core';
|
||||
|
||||
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';
|
||||
|
||||
import { useContainer } from 'class-validator';
|
||||
|
||||
import { AppModule } from './app.module';
|
||||
|
||||
async function bootstrap() {
|
||||
@ -10,6 +12,7 @@ async function bootstrap() {
|
||||
logger: ['error', 'warn'],
|
||||
});
|
||||
app.setGlobalPrefix('api');
|
||||
useContainer(app.select(AppModule), { fallbackOnErrors: true });
|
||||
await app.listen(process.env.PORT ?? 3000, () => {
|
||||
console.log('api: http://localhost:3000');
|
||||
});
|
||||
|
@ -5,6 +5,8 @@ import { DataSource, ObjectType } from 'typeorm';
|
||||
|
||||
import { CUSTOM_REPOSITORY_METADATA } from '@/modules/database/constants';
|
||||
|
||||
import { DataExistConstraint } from '../core/constraints/data.exist.constraint';
|
||||
|
||||
@Module({})
|
||||
export class DatabaseModule {
|
||||
static forRoot(configRegister: () => TypeOrmModuleOptions): DynamicModule {
|
||||
@ -12,6 +14,7 @@ export class DatabaseModule {
|
||||
global: true,
|
||||
module: DatabaseModule,
|
||||
imports: [TypeOrmModule.forRoot(configRegister())],
|
||||
providers: [DataExistConstraint],
|
||||
};
|
||||
}
|
||||
static forRepository<T extends Type<any>>(
|
||||
|
Loading…
Reference in New Issue
Block a user