Skip to content

Commit

Permalink
Cms db merge (#53)
Browse files Browse the repository at this point in the history
* refactor(database): merge CMS functionality in DB module
add(database): owner migration to move CMS schemas to database
add(database): query types to better specify query requirements
add(database): conditional query parsing

* refactor(database): remove stringify from older queries

* fix(database)!: Database/CMS merge updates
refactor(database,grpc-sdk): use ManagedModule
fix(database): deleteSchemas system schema deletion check failing

BREAKING CHANGE:
- All /admin/cms/* routes are now available under /database/cms
- [GET] /admin/database/schemas/extensions return definition change
  'declaredSchemaExtensions' -> 'schemaExtensions'

* fix(database): unparsed ints in getCustomEndpoints due to route definition missing skip,limit query params

* feat(database): getSchemasWithCustomEndpoints admin route

* chore(cms,grpc-sdk): delete CMS module

Co-authored-by: Konstantinos Feretos <konferetos@tutanota.com>
  • Loading branch information
kkopanidis and kon14 committed Feb 25, 2022
1 parent 98099ca commit f5b054b
Show file tree
Hide file tree
Showing 52 changed files with 1,137 additions and 1,378 deletions.
2 changes: 2 additions & 0 deletions libraries/grpc-sdk/src/classes/ManagedModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export abstract class ManagedModule extends ConduitServiceModule {
this.grpcSdk = grpcSdk;
}

async preServerStart() {}

async onServerStart() {}

async preRegister() {}
Expand Down
1 change: 1 addition & 0 deletions libraries/grpc-sdk/src/classes/ModuleManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class ModuleManager {
}

private async preRegisterLifecycle(): Promise<void> {
await this.module.preServerStart();
await this.module.startGrpcServer(this.servicePort);
await this.module.onServerStart()
await this.module.preRegister();
Expand Down
17 changes: 5 additions & 12 deletions libraries/grpc-sdk/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
Admin,
Chat,
CMS,
Config,
DatabaseProvider,
Email,
Expand Down Expand Up @@ -29,7 +28,6 @@ export default class ConduitGrpcSdk {
email: Email,
pushNotifications: PushNotifications,
authentication: Authentication,
cms: CMS,
sms: SMS,
chat: Chat,
forms: Forms,
Expand Down Expand Up @@ -84,7 +82,7 @@ export default class ConduitGrpcSdk {
return this._router;
}

get databaseProvider(): DatabaseProvider | null {
get database(): DatabaseProvider | null {
if (this._modules['database']) {
return this._modules['database'];
} else {
Expand All @@ -93,6 +91,10 @@ export default class ConduitGrpcSdk {
}
}

get databaseProvider(): DatabaseProvider | null {
return this.database;
}

get storage(): Storage | null {
if (this._modules['storage']) {
return this._modules['storage'];
Expand Down Expand Up @@ -138,15 +140,6 @@ export default class ConduitGrpcSdk {
}
}

get cms(): CMS | null {
if (this._modules['cms']) {
return this._modules['cms'];
} else {
console.warn('Cms module not up yet!');
return null;
}
}

get sms(): SMS | null {
if (this._modules['sms']) {
return this._modules['sms'];
Expand Down
2 changes: 1 addition & 1 deletion libraries/grpc-sdk/src/interfaces/ConduitService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { GrpcRequest, GrpcResponse } from '..';
export interface ConduitService {
readonly protoPath: string;
readonly protoDescription: string;
functions: { [p: string]: (call: GrpcRequest<any>, callback: GrpcResponse<any>) => {} };
functions: { [p: string]: (call: GrpcRequest<any>, callback: GrpcResponse<any>) => void | Promise<void> };
}
9 changes: 0 additions & 9 deletions libraries/grpc-sdk/src/modules/cms/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ConduitModule } from '../../classes/ConduitModule';
import { ConduitSchema, ConduitSchemaExtension } from '../../classes';
import { DatabaseProviderDefinition, DropCollectionResponse } from '../../protoUtils/database-provider';
import { DatabaseProviderDefinition, DropCollectionResponse } from '../../protoUtils/database';

export class DatabaseProvider extends ConduitModule<typeof DatabaseProviderDefinition> {
constructor(moduleName: string, url: string) {
Expand Down
3 changes: 1 addition & 2 deletions libraries/grpc-sdk/src/modules/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
export * from './storage';
export * from './router';
export * from './email';
export * from './databaseProvider';
export * from './database';
export * from './config';
export * from './admin';
export * from './pushNotifications';
export * from './cms';
export * from './sms';
export * from './chat';
export * from './forms';
1 change: 0 additions & 1 deletion modules/cms/.npmignore

This file was deleted.

19 changes: 0 additions & 19 deletions modules/cms/Dockerfile

This file was deleted.

16 changes: 0 additions & 16 deletions modules/cms/README.mdx

This file was deleted.

43 changes: 0 additions & 43 deletions modules/cms/package.json

This file was deleted.

48 changes: 0 additions & 48 deletions modules/cms/src/CMS.ts

This file was deleted.

Loading

0 comments on commit f5b054b

Please sign in to comment.