mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-19 11:06:25 +08:00
refactor(server): plugin modules (#5630)
- [x] separates modules into `fundamental`, `core`, `plugins`
- [x] optional modules with `@OptionalModule` decorator to install modules with requirements met(`requires`, `if`)
- [x] `module.contributesTo` defines optional features that will be enabled if module registered
- [x] `AFFiNE.plugins.use('payment', {})` to enable a optional/plugin module
- [x] `PaymentModule` is the first plugin module
- [x] GraphQLSchema will not be generated for non-included modules
- [x] Frontend can use `ServerConfigType` query to detect which features are enabled
- [x] override existing provider globally
This commit is contained in:
@@ -5,6 +5,7 @@ import { PrismaClient } from '@prisma/client';
|
||||
import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs';
|
||||
|
||||
import { AppModule, FunctionalityModules } from '../../src/app.module';
|
||||
import { AuthModule } from '../../src/core/auth';
|
||||
import { UserFeaturesInit1698652531198 } from '../../src/data/migrations/1698652531198-user-features-init';
|
||||
import { GqlModule } from '../../src/fundamentals/graphql';
|
||||
|
||||
@@ -68,7 +69,12 @@ export async function createTestingModule(
|
||||
imports =
|
||||
imports[0] === AppModule
|
||||
? [AppModule]
|
||||
: dedupeModules([...FunctionalityModules, GqlModule, ...imports]);
|
||||
: dedupeModules([
|
||||
...FunctionalityModules,
|
||||
AuthModule,
|
||||
GqlModule,
|
||||
...imports,
|
||||
]);
|
||||
|
||||
const builder = Test.createTestingModule({
|
||||
imports,
|
||||
|
||||
Reference in New Issue
Block a user