Compare commits
No commits in common. "e67711c2fe35bb5c57fd04c0615882c22965d116" and "d7d9777d1a3d538c2af4aabbdbdd2551465e90b7" have entirely different histories.
e67711c2fe
...
d7d9777d1a
@ -41,7 +41,7 @@ export abstract class BaseSubscriber<T extends ObjectLiteral>
|
|||||||
{
|
{
|
||||||
protected abstract entity: ObjectType<T>;
|
protected abstract entity: ObjectType<T>;
|
||||||
|
|
||||||
constructor(
|
protected constructor(
|
||||||
@Optional() protected dataSource?: DataSource,
|
@Optional() protected dataSource?: DataSource,
|
||||||
@Optional() protected _configure?: Configure,
|
@Optional() protected _configure?: Configure,
|
||||||
) {
|
) {
|
||||||
|
@ -1 +1 @@
|
|||||||
export * from './user.subscriber';
|
export * from './UserSubscriber';
|
||||||
|
@ -1,42 +1,4 @@
|
|||||||
import { DynamicModule, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
|
|
||||||
import { PassportModule } from '@nestjs/passport';
|
|
||||||
|
|
||||||
import { Configure } from '@/modules/config/configure';
|
|
||||||
|
|
||||||
import { DatabaseModule } from '@/modules/database/database.module';
|
|
||||||
import { addEntities, addSubscribers } from '@/modules/database/utils';
|
|
||||||
|
|
||||||
import * as entities from './entities';
|
|
||||||
import * as guards from './guards';
|
|
||||||
import * as interceptors from './interceptors';
|
|
||||||
import * as repositories from './repositories';
|
|
||||||
import * as services from './services';
|
|
||||||
import * as strategies from './strategies';
|
|
||||||
import * as subscribers from './subscribers';
|
|
||||||
|
|
||||||
@Module({})
|
@Module({})
|
||||||
export class UserModule {
|
export class UserModule {}
|
||||||
static async forRoot(configure: Configure): Promise<DynamicModule> {
|
|
||||||
return {
|
|
||||||
module: UserModule,
|
|
||||||
imports: [
|
|
||||||
PassportModule,
|
|
||||||
services.TokenService.JwtModuleFactory(configure),
|
|
||||||
await addEntities(configure, Object.values(entities)),
|
|
||||||
DatabaseModule.forRepository(Object.values(repositories)),
|
|
||||||
],
|
|
||||||
providers: [
|
|
||||||
...Object.values(interceptors),
|
|
||||||
...Object.values(services),
|
|
||||||
...Object.values(strategies),
|
|
||||||
...Object.values(guards),
|
|
||||||
...(await addSubscribers(configure, Object.values(subscribers))),
|
|
||||||
],
|
|
||||||
exports: [
|
|
||||||
...Object.values(services),
|
|
||||||
DatabaseModule.forRepository(Object.values(repositories)),
|
|
||||||
],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -7,9 +7,6 @@ import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify
|
|||||||
import { existsSync } from 'fs-extra';
|
import { existsSync } from 'fs-extra';
|
||||||
import { isNil } from 'lodash';
|
import { isNil } from 'lodash';
|
||||||
|
|
||||||
import { JwtAuthGuard } from '@/modules/user/guards';
|
|
||||||
import { UserModule } from '@/modules/user/user.module';
|
|
||||||
|
|
||||||
import * as configs from './config';
|
import * as configs from './config';
|
||||||
import { ContentModule } from './modules/content/content.module';
|
import { ContentModule } from './modules/content/content.module';
|
||||||
import { CreateOptions } from './modules/core/types';
|
import { CreateOptions } from './modules/core/types';
|
||||||
@ -19,6 +16,7 @@ import { MeiliModule } from './modules/meilisearch/meili.module';
|
|||||||
import { Restful } from './modules/restful/restful';
|
import { Restful } from './modules/restful/restful';
|
||||||
import { RestfulModule } from './modules/restful/restful.module';
|
import { RestfulModule } from './modules/restful/restful.module';
|
||||||
import { ApiConfig } from './modules/restful/types';
|
import { ApiConfig } from './modules/restful/types';
|
||||||
|
import { JwtAuthGuard } from './modules/user/guards/jwt.auth.guard';
|
||||||
|
|
||||||
export const createOptions: CreateOptions = {
|
export const createOptions: CreateOptions = {
|
||||||
commands: () => [...Object.values(dbCommands)],
|
commands: () => [...Object.values(dbCommands)],
|
||||||
@ -28,7 +26,6 @@ export const createOptions: CreateOptions = {
|
|||||||
await MeiliModule.forRoot(configure),
|
await MeiliModule.forRoot(configure),
|
||||||
await RestfulModule.forRoot(configure),
|
await RestfulModule.forRoot(configure),
|
||||||
await ContentModule.forRoot(configure),
|
await ContentModule.forRoot(configure),
|
||||||
await UserModule.forRoot(configure),
|
|
||||||
],
|
],
|
||||||
globals: { guard: JwtAuthGuard },
|
globals: { guard: JwtAuthGuard },
|
||||||
builder: async ({ configure, BootModule }) => {
|
builder: async ({ configure, BootModule }) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user