mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
65 lines
2.0 KiB
TypeScript
65 lines
2.0 KiB
TypeScript
import {
|
|
MiddlewareConsumer,
|
|
Module,
|
|
NestModule,
|
|
RequestMethod,
|
|
} from '@nestjs/common';
|
|
import { UserModule } from './user/user.module';
|
|
import { AuthModule } from './auth/auth.module';
|
|
import { WorkspaceModule } from './workspace/workspace.module';
|
|
import { PageModule } from './page/page.module';
|
|
import { AttachmentModule } from './attachment/attachment.module';
|
|
import { CommentModule } from './comment/comment.module';
|
|
import { SearchModule } from './search/search.module';
|
|
import { SpaceModule } from './space/space.module';
|
|
import { GroupModule } from './group/group.module';
|
|
import { CaslModule } from './casl/casl.module';
|
|
import { PageAccessModule } from './page/page-access/page-access.module';
|
|
import { DomainMiddleware } from '../common/middlewares/domain.middleware';
|
|
import { AuditContextMiddleware } from '../common/middlewares/audit-context.middleware';
|
|
import { ShareModule } from './share/share.module';
|
|
import { NotificationModule } from './notification/notification.module';
|
|
import { WatcherModule } from './watcher/watcher.module';
|
|
import { SessionModule } from './session/session.module';
|
|
import { ClsMiddleware } from 'nestjs-cls';
|
|
|
|
@Module({
|
|
imports: [
|
|
UserModule,
|
|
AuthModule,
|
|
WorkspaceModule,
|
|
PageModule,
|
|
AttachmentModule,
|
|
CommentModule,
|
|
SearchModule,
|
|
SpaceModule,
|
|
GroupModule,
|
|
CaslModule,
|
|
PageAccessModule,
|
|
ShareModule,
|
|
NotificationModule,
|
|
WatcherModule,
|
|
SessionModule,
|
|
],
|
|
})
|
|
export class CoreModule implements NestModule {
|
|
configure(consumer: MiddlewareConsumer) {
|
|
const excludedRoutes = [
|
|
{ path: 'auth/setup', method: RequestMethod.POST },
|
|
{ path: 'health', method: RequestMethod.GET },
|
|
{ path: 'health/live', method: RequestMethod.GET },
|
|
{ path: 'billing/stripe/webhook', method: RequestMethod.POST },
|
|
];
|
|
|
|
consumer
|
|
.apply(DomainMiddleware)
|
|
.exclude(...excludedRoutes)
|
|
.forRoutes('*');
|
|
|
|
consumer
|
|
.apply(AuditContextMiddleware)
|
|
.exclude(...excludedRoutes)
|
|
.forRoutes('*');
|
|
}
|
|
}
|