@campxdev/server-shared 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared-module/shared.module.d.ts +2 -1
- package/dist/shared-module/shared.module.d.ts.map +1 -1
- package/dist/shared-module/shared.module.js.map +1 -1
- package/package.json +6 -2
- package/.prettierrc +0 -5
- package/.vscode/settings.json +0 -13
- package/src/common/config/mongo.config.ts +0 -13
- package/src/common/decorators/message-pattern.decorator.ts +0 -14
- package/src/common/decorators/request.decorators.ts +0 -32
- package/src/common/decorators/time-validation.decorator.ts +0 -22
- package/src/common/filters/unhandled-exception.filter.ts +0 -29
- package/src/common/guards/guard.ts +0 -19
- package/src/common/index.ts +0 -9
- package/src/common/interfaces/context.interface.ts +0 -68
- package/src/common/store/request-store.ts +0 -96
- package/src/common/store/store-config.ts +0 -25
- package/src/domain/db-connection.module.ts +0 -20
- package/src/domain/index.ts +0 -2
- package/src/domain/schemas/tenant.schema.ts +0 -112
- package/src/index.ts +0 -5
- package/src/permissions/index.ts +0 -1
- package/src/permissions/permissions.ts +0 -1943
- package/src/shared-module/index.ts +0 -2
- package/src/shared-module/shared.module.ts +0 -32
- package/src/shared-module/shared.service.ts +0 -101
- package/src/utils/constants.ts +0 -11
- package/src/utils/index.ts +0 -2
- package/src/utils/utils.ts +0 -191
- package/tsconfig.json +0 -19
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { DynamicModule } from '@nestjs/common';
|
|
1
2
|
import { IDataBaseConfig } from './shared.service';
|
|
2
3
|
export interface ISharedModuleOptions {
|
|
3
4
|
service: string;
|
|
4
5
|
dataBaseConfig?: IDataBaseConfig;
|
|
5
6
|
}
|
|
6
7
|
export declare class SharedModule {
|
|
7
|
-
static forRoot(config: ISharedModuleOptions):
|
|
8
|
+
static forRoot(config: ISharedModuleOptions): DynamicModule;
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=shared.module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.module.d.ts","sourceRoot":"","sources":["../../src/shared-module/shared.module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared.module.d.ts","sourceRoot":"","sources":["../../src/shared-module/shared.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAM/C,OAAO,EAAE,eAAe,EAAiB,MAAM,kBAAkB,CAAC;AAElE,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,eAAe,CAAC;CAClC;AAED,qBAAa,YAAY;IACvB,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,oBAAoB,GAAG,aAAa;CAiB5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.module.js","sourceRoot":"","sources":["../../src/shared-module/shared.module.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"shared.module.js","sourceRoot":"","sources":["../../src/shared-module/shared.module.ts"],"names":[],"mappings":";;;AACA,+CAAsE;AAGtE,sCAA+C;AAC/C,sCAAqE;AACrE,qDAAkE;AAOlE,MAAa,YAAY;IACvB,MAAM,CAAC,OAAO,CAAC,MAA4B;QACzC,2BAAkB,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC5C,OAAO;YACL,MAAM,EAAE,YAAY;YACpB,OAAO,EAAE,CAAC,yBAAc,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,eAAM,CAAC,IAAI,EAAE,MAAM,EAAE,qBAAY,EAAE,CAAC,CAAC,CAAC;YACnF,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,YAAY;oBACrB,UAAU,EAAE,CAAC,aAAsC,EAAE,UAAsB,EAAE,EAAE;wBAC7E,OAAO,IAAI,8BAAa,CAAC,MAAM,CAAC,cAAc,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC;oBAC7E,CAAC;oBACD,MAAM,EAAE,CAAC,2BAAkB,EAAE,IAAA,6BAAkB,GAAE,CAAC;iBACnD;aACF;YACD,OAAO,EAAE,CAAC,8BAAa,EAAE,yBAAc,CAAC;SACzC,CAAC;IACJ,CAAC;CACF;AAlBD,oCAkBC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@campxdev/server-shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Campx server shared files",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
7
10
|
"scripts": {
|
|
8
|
-
"build": "rm -rf dist && tsc"
|
|
11
|
+
"build": "rm -rf dist && tsc",
|
|
12
|
+
"prepublish": "npm run build"
|
|
9
13
|
},
|
|
10
14
|
"dependencies": {
|
|
11
15
|
"@nestjs/common": "^9.3.9",
|
package/.prettierrc
DELETED
package/.vscode/settings.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export const mongoConfig = () => {
|
|
2
|
-
const username = encodeURIComponent(process.env.MONGO_DB_USERNAME);
|
|
3
|
-
const password = encodeURIComponent(process.env.MONGO_DB_PASSWORD);
|
|
4
|
-
const DB_NAME = process.env.MONGO_DB_NAME;
|
|
5
|
-
const DB_HOST = process.env.MONGO_DB_HOST;
|
|
6
|
-
const AUTH = `${username}:${password}`;
|
|
7
|
-
const DB = `${DB_HOST}/${DB_NAME}`;
|
|
8
|
-
const MONGO_URI = `mongodb+srv://${AUTH}@${DB}?retryWrites=true&w=majority`;
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
MONGO_URI,
|
|
12
|
-
};
|
|
13
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MessagePattern as Pattern } from '@nestjs/microservices';
|
|
2
|
-
|
|
3
|
-
export class IMessageProps {
|
|
4
|
-
cmd: string;
|
|
5
|
-
action: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const MessagePatterProps = {
|
|
9
|
-
service: 'square',
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const MessagePattern = (props: IMessageProps) => {
|
|
13
|
-
return Pattern({ service: MessagePatterProps.service, ...props });
|
|
14
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { createParamDecorator, ExecutionContext } from '@nestjs/common';
|
|
2
|
-
|
|
3
|
-
export const RPCBody = createParamDecorator((data: string, ctx: ExecutionContext) => {
|
|
4
|
-
const request = ctx.switchToRpc().getData();
|
|
5
|
-
if (request.body === undefined || request.body === null) return {};
|
|
6
|
-
if (data) return request.body[data];
|
|
7
|
-
return request.body;
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export const RPCQuery = createParamDecorator((data: string, ctx: ExecutionContext) => {
|
|
11
|
-
const request = ctx.switchToRpc().getData();
|
|
12
|
-
if (request.query === undefined || request.query === null) return {};
|
|
13
|
-
if (data) return request.query[data];
|
|
14
|
-
return request.query;
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
export const RPCParam = createParamDecorator((data: string, ctx: ExecutionContext) => {
|
|
18
|
-
const request = ctx.switchToRpc().getData();
|
|
19
|
-
if (request.param === undefined || request.param === null) return {};
|
|
20
|
-
if (data) return request.param[data];
|
|
21
|
-
return request.param;
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export const RPCUploadedFile = createParamDecorator((_data: string, ctx: ExecutionContext) => {
|
|
25
|
-
const request = ctx.switchToRpc().getData();
|
|
26
|
-
return request.file;
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
export const RPCUploadedFiles = createParamDecorator((_data: string, ctx: ExecutionContext) => {
|
|
30
|
-
const request = ctx.switchToRpc().getData();
|
|
31
|
-
return request.files || [];
|
|
32
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { registerDecorator, ValidationOptions } from 'class-validator';
|
|
2
|
-
|
|
3
|
-
export function IsTime(validationOptions?: ValidationOptions) {
|
|
4
|
-
return (obj: object, propertyName: string) => {
|
|
5
|
-
registerDecorator({
|
|
6
|
-
propertyName: propertyName,
|
|
7
|
-
target: obj.constructor,
|
|
8
|
-
options: validationOptions,
|
|
9
|
-
name: 'isTime',
|
|
10
|
-
validator: {
|
|
11
|
-
validate(value: any) {
|
|
12
|
-
if (typeof value !== 'string') return false;
|
|
13
|
-
const timeRegex = /^([0-9]|[0-1][0-9]|2[0-3]):([0-9]|[0-5][0-9]):([0-9]|[0-5][0-9])$/;
|
|
14
|
-
return timeRegex.test(value);
|
|
15
|
-
},
|
|
16
|
-
defaultMessage() {
|
|
17
|
-
return `${propertyName} must be a valid time in the format HH:mm:ss`;
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ArgumentsHost, Catch, ExceptionFilter } from '@nestjs/common';
|
|
2
|
-
import { RpcException } from '@nestjs/microservices';
|
|
3
|
-
|
|
4
|
-
@Catch()
|
|
5
|
-
export class UnhandledExceptionFilter<T extends Error> implements ExceptionFilter {
|
|
6
|
-
catch(exception: T, host: ArgumentsHost) {
|
|
7
|
-
console.log(exception);
|
|
8
|
-
const status = exception['status'];
|
|
9
|
-
const response = exception['response'];
|
|
10
|
-
|
|
11
|
-
if (status && response) {
|
|
12
|
-
throw new RpcException({
|
|
13
|
-
statusCode: status,
|
|
14
|
-
response: response,
|
|
15
|
-
message: exception.message,
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
throw new RpcException({
|
|
20
|
-
statusCode: 500,
|
|
21
|
-
response: {
|
|
22
|
-
statusCode: 500,
|
|
23
|
-
error: 'Internal Server Error',
|
|
24
|
-
message: exception.message,
|
|
25
|
-
},
|
|
26
|
-
message: exception.message,
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { SetMetadata } from '@nestjs/common';
|
|
2
|
-
|
|
3
|
-
export const AUTHENTICATE = 'authenticate';
|
|
4
|
-
|
|
5
|
-
export const JwtAuthGuard = () => {
|
|
6
|
-
return SetMetadata(AUTHENTICATE, true);
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const CHECK_PERMISSION_KEY = 'checkPermissionKey';
|
|
10
|
-
|
|
11
|
-
export const CheckPermission = (permission: string) => {
|
|
12
|
-
return SetMetadata(CHECK_PERMISSION_KEY, permission);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const CHECK_EVALUATOR = 'checkEvaluator';
|
|
16
|
-
|
|
17
|
-
export const CheckEvaluator = () => {
|
|
18
|
-
return SetMetadata(CHECK_EVALUATOR, true);
|
|
19
|
-
};
|
package/src/common/index.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from './config/mongo.config';
|
|
2
|
-
export * from './decorators/message-pattern.decorator';
|
|
3
|
-
export * from './decorators/request.decorators';
|
|
4
|
-
export * from './decorators/time-validation.decorator';
|
|
5
|
-
export * from './filters/unhandled-exception.filter';
|
|
6
|
-
export * from './guards/guard';
|
|
7
|
-
export * from './interfaces/context.interface';
|
|
8
|
-
export * from './store/request-store';
|
|
9
|
-
export * from './store/store-config';
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import * as mongoose from 'mongoose';
|
|
2
|
-
|
|
3
|
-
export interface IRequest {
|
|
4
|
-
cmd: {
|
|
5
|
-
cmd: string;
|
|
6
|
-
action: string;
|
|
7
|
-
service?: string;
|
|
8
|
-
};
|
|
9
|
-
body?: any;
|
|
10
|
-
param?: any;
|
|
11
|
-
query?: any;
|
|
12
|
-
file?: any;
|
|
13
|
-
files?: any;
|
|
14
|
-
request?: {
|
|
15
|
-
subDomain: string;
|
|
16
|
-
sessionId: string;
|
|
17
|
-
};
|
|
18
|
-
tenantDetails?: TenantDetails;
|
|
19
|
-
userData?: UserData;
|
|
20
|
-
isMicroservice?: boolean;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface TenantDetails {
|
|
24
|
-
_id: mongoose.Types.ObjectId;
|
|
25
|
-
id: string;
|
|
26
|
-
name: string;
|
|
27
|
-
subDomain: string;
|
|
28
|
-
host: string;
|
|
29
|
-
port: number;
|
|
30
|
-
username: string;
|
|
31
|
-
password: string;
|
|
32
|
-
database: string;
|
|
33
|
-
env: Env;
|
|
34
|
-
easyWDMSConfig: IEasyWDMSConfig;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface Env {
|
|
38
|
-
s3AccessKeyId: string;
|
|
39
|
-
s3SecretAccessKey: string;
|
|
40
|
-
s3BucketName: string;
|
|
41
|
-
s3Region: string;
|
|
42
|
-
s3Endpoint: string;
|
|
43
|
-
sentryDsn: null;
|
|
44
|
-
razorpayKey: string;
|
|
45
|
-
razorpaySecret: string;
|
|
46
|
-
clientName: string;
|
|
47
|
-
_id: string;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface IEasyWDMSConfig {
|
|
51
|
-
_id: string;
|
|
52
|
-
host: string;
|
|
53
|
-
port: number;
|
|
54
|
-
username: string;
|
|
55
|
-
password: string;
|
|
56
|
-
database: string;
|
|
57
|
-
baseApiUrl: string;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface UserData {
|
|
61
|
-
id?: number;
|
|
62
|
-
userId?: string;
|
|
63
|
-
email?: string;
|
|
64
|
-
isActive: boolean;
|
|
65
|
-
tenantId?: string;
|
|
66
|
-
evaluatorId?: number;
|
|
67
|
-
leadId?: number;
|
|
68
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { UnprocessableEntityException } from '@nestjs/common';
|
|
2
|
-
import { DataSource, EntityManager } from 'typeorm';
|
|
3
|
-
import { getObjectId } from '../../utils/utils';
|
|
4
|
-
import { IRequest, TenantDetails, UserData } from '../interfaces/context.interface';
|
|
5
|
-
import { get, set } from './store-config';
|
|
6
|
-
|
|
7
|
-
export const EXPRESS_REQUEST = 'EXPRESS_REQUEST';
|
|
8
|
-
export const TENANT_EASY_WDMS_DATA_SOURCE = 'TENANT_EASY_WDMS_DATA_SOURCE';
|
|
9
|
-
export const TENANT_DATA_SOURCE = 'TENANT_DATA_SOURCE';
|
|
10
|
-
export const TENANT_DETAILS = 'TENANT_DETAILS';
|
|
11
|
-
export const USER_DATA = 'USER_DATA';
|
|
12
|
-
|
|
13
|
-
export function setRequest(req: any): void {
|
|
14
|
-
set(EXPRESS_REQUEST, req);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function getRequest(): IRequest {
|
|
18
|
-
return get(EXPRESS_REQUEST);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function setTenantDataSource(dataSource: DataSource): void {
|
|
22
|
-
set(TENANT_DATA_SOURCE, dataSource);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function getDataSource(): DataSource {
|
|
26
|
-
const dataSource = get<DataSource>(TENANT_DATA_SOURCE);
|
|
27
|
-
if (!dataSource) {
|
|
28
|
-
throw new UnprocessableEntityException('Unable to connect to data source');
|
|
29
|
-
}
|
|
30
|
-
return dataSource;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function getManager(): EntityManager {
|
|
34
|
-
const dataSource = getDataSource();
|
|
35
|
-
return dataSource.manager;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function setTenantDetails(tenant: TenantDetails): void {
|
|
39
|
-
set(TENANT_DETAILS, tenant);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function getTenantDetailsIfExists(): TenantDetails {
|
|
43
|
-
return get<TenantDetails>(TENANT_DETAILS);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function getTenantDetails(): TenantDetails {
|
|
47
|
-
const tenant = get<TenantDetails>(TENANT_DETAILS);
|
|
48
|
-
if (!tenant) {
|
|
49
|
-
throw new UnprocessableEntityException('Unable to get tenant details');
|
|
50
|
-
}
|
|
51
|
-
tenant._id = getObjectId(tenant._id);
|
|
52
|
-
return tenant;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function getS3BaseUrl(): string {
|
|
56
|
-
const tenant = get(TENANT_DETAILS) as TenantDetails;
|
|
57
|
-
return tenant?.env?.s3Endpoint;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function setUserData(user: UserData): void {
|
|
61
|
-
set(USER_DATA, user);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export function getUserData(): UserData {
|
|
65
|
-
return get(USER_DATA);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export function getEvaluatorId(): number {
|
|
69
|
-
const userData = getUserData();
|
|
70
|
-
if (!userData?.evaluatorId) {
|
|
71
|
-
throw new UnprocessableEntityException('You are not an evaluator');
|
|
72
|
-
}
|
|
73
|
-
return userData?.evaluatorId;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export function getLeadId(): number {
|
|
77
|
-
const userData = getUserData();
|
|
78
|
-
if (!userData?.leadId) {
|
|
79
|
-
throw new UnprocessableEntityException('You are not a lead');
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return userData?.leadId;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export function getEasyWDMSDataSource(): DataSource {
|
|
86
|
-
const dataSource = get<DataSource>(TENANT_EASY_WDMS_DATA_SOURCE);
|
|
87
|
-
if (!dataSource) {
|
|
88
|
-
throw new UnprocessableEntityException('EasyWDMS database not configured');
|
|
89
|
-
}
|
|
90
|
-
return dataSource;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export function getEasyWDMSManager(): EntityManager {
|
|
94
|
-
const dataSource = getEasyWDMSDataSource();
|
|
95
|
-
return dataSource.manager;
|
|
96
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { BadRequestException } from '@nestjs/common';
|
|
2
|
-
import { NextFunction, Request, Response } from 'express';
|
|
3
|
-
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
4
|
-
|
|
5
|
-
export const store = new AsyncLocalStorage();
|
|
6
|
-
|
|
7
|
-
export const storeMiddleWare = (_req: Request, _res: Response, next: NextFunction) => {
|
|
8
|
-
store.run(new Map(), () => next());
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const getStore = () => {
|
|
12
|
-
const data = store.getStore();
|
|
13
|
-
if (!data) {
|
|
14
|
-
throw new BadRequestException('Request store is not initialized');
|
|
15
|
-
}
|
|
16
|
-
return data as Map<string, any>;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const set = (key: string, value: any) => getStore().set(key, value);
|
|
20
|
-
|
|
21
|
-
export function get<T>(key: string): T {
|
|
22
|
-
const data = store.getStore() as Map<string, any>;
|
|
23
|
-
if (!data) return;
|
|
24
|
-
return data.get(key);
|
|
25
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Module } from '@nestjs/common';
|
|
2
|
-
import { DataSource } from 'typeorm';
|
|
3
|
-
|
|
4
|
-
export const TENANT_DB_CONNECTIONS = 'TENANT_DB_CONNECTIONS';
|
|
5
|
-
|
|
6
|
-
const dbConnections = () => {
|
|
7
|
-
const map = new Map<string, DataSource>();
|
|
8
|
-
return map;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
@Module({
|
|
12
|
-
providers: [
|
|
13
|
-
{
|
|
14
|
-
provide: TENANT_DB_CONNECTIONS,
|
|
15
|
-
useFactory: dbConnections,
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
exports: [TENANT_DB_CONNECTIONS],
|
|
19
|
-
})
|
|
20
|
-
export class DBConnectionModule {}
|
package/src/domain/index.ts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
|
-
import { Document } from 'mongoose';
|
|
3
|
-
|
|
4
|
-
@Schema()
|
|
5
|
-
export class SMTPConfig extends Document {
|
|
6
|
-
@Prop({ required: true })
|
|
7
|
-
host: string;
|
|
8
|
-
|
|
9
|
-
@Prop({ required: true })
|
|
10
|
-
port: number;
|
|
11
|
-
|
|
12
|
-
@Prop({ required: true })
|
|
13
|
-
username: string;
|
|
14
|
-
|
|
15
|
-
@Prop({ required: true })
|
|
16
|
-
password: string;
|
|
17
|
-
|
|
18
|
-
@Prop({ required: false })
|
|
19
|
-
from: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@Schema()
|
|
23
|
-
export class EasyWDMSConfig extends Document {
|
|
24
|
-
@Prop({ required: true })
|
|
25
|
-
host: string;
|
|
26
|
-
|
|
27
|
-
@Prop({ required: true })
|
|
28
|
-
port: number;
|
|
29
|
-
|
|
30
|
-
@Prop({ required: true })
|
|
31
|
-
username: string;
|
|
32
|
-
|
|
33
|
-
@Prop({ required: true })
|
|
34
|
-
password: string;
|
|
35
|
-
|
|
36
|
-
@Prop({ required: true })
|
|
37
|
-
database: string;
|
|
38
|
-
|
|
39
|
-
@Prop({ required: true })
|
|
40
|
-
baseApiUrl: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export const EasyWDMSConfigSchema = SchemaFactory.createForClass(EasyWDMSConfig);
|
|
44
|
-
|
|
45
|
-
@Schema()
|
|
46
|
-
export class TenantEnvironment extends Document {
|
|
47
|
-
@Prop({ required: true })
|
|
48
|
-
s3AccessKeyId: string;
|
|
49
|
-
|
|
50
|
-
@Prop({ required: true })
|
|
51
|
-
s3SecretAccessKey: string;
|
|
52
|
-
|
|
53
|
-
@Prop({ required: true })
|
|
54
|
-
s3BucketName: string;
|
|
55
|
-
|
|
56
|
-
@Prop({ required: true })
|
|
57
|
-
s3Region: string;
|
|
58
|
-
|
|
59
|
-
@Prop({ required: true })
|
|
60
|
-
s3Endpoint: string;
|
|
61
|
-
|
|
62
|
-
@Prop()
|
|
63
|
-
sentryDsn?: string;
|
|
64
|
-
|
|
65
|
-
@Prop()
|
|
66
|
-
razorpayKey?: string;
|
|
67
|
-
|
|
68
|
-
@Prop()
|
|
69
|
-
razorpaySecret?: string;
|
|
70
|
-
|
|
71
|
-
@Prop()
|
|
72
|
-
clientName?: string;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export const TenantEnvironmentSchema = SchemaFactory.createForClass(TenantEnvironment);
|
|
76
|
-
|
|
77
|
-
export const TenantCollectionName = 'tenants';
|
|
78
|
-
|
|
79
|
-
@Schema({ collection: TenantCollectionName, timestamps: true, id: true })
|
|
80
|
-
export class Tenant extends Document {
|
|
81
|
-
@Prop({ required: true, unique: true })
|
|
82
|
-
name: string;
|
|
83
|
-
|
|
84
|
-
@Prop({ required: true, unique: true })
|
|
85
|
-
subDomain: string;
|
|
86
|
-
|
|
87
|
-
@Prop({ required: true })
|
|
88
|
-
host: string;
|
|
89
|
-
|
|
90
|
-
@Prop({ required: true })
|
|
91
|
-
port: number;
|
|
92
|
-
|
|
93
|
-
@Prop({ required: true })
|
|
94
|
-
username: string;
|
|
95
|
-
|
|
96
|
-
@Prop({ required: true })
|
|
97
|
-
password: string;
|
|
98
|
-
|
|
99
|
-
@Prop({ required: true })
|
|
100
|
-
database: string;
|
|
101
|
-
|
|
102
|
-
@Prop({ required: true, type: TenantEnvironmentSchema })
|
|
103
|
-
env: TenantEnvironment;
|
|
104
|
-
|
|
105
|
-
@Prop({ type: EasyWDMSConfigSchema })
|
|
106
|
-
easyWDMSConfig: EasyWDMSConfig;
|
|
107
|
-
|
|
108
|
-
@Prop({ type: SMTPConfig })
|
|
109
|
-
smtpConfig: SMTPConfig;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export const TenantSchema = SchemaFactory.createForClass(Tenant);
|
package/src/index.ts
DELETED
package/src/permissions/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './permissions';
|