Skip to content

Commit 70eb521

Browse files
authored
Merge pull request #1458 from rocket-admin/backend_clickhouse
Backend clickhouse
2 parents df24823 + 0e9de8f commit 70eb521

53 files changed

Lines changed: 9134 additions & 513 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

backend/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
"test-all": "ava --timeout=5m --serial",
2727
"test-saas": "ava test/ava-tests/saas-tests/* ",
2828
"typeorm": "ts-node -r tsconfig-paths/register ../node_modules/.bin/typeorm",
29-
"migration:generate": "yarn run typeorm migration:generate -d dist/shared/config/datasource.config.js",
30-
"migration:create": "yarn run typeorm migration:create -d dist/shared/config/datasource.config.js",
31-
"migration:run": "yarn run typeorm migration:run -d dist/shared/config/datasource.config.js",
32-
"migration:revert": "npm run typeorm -- migration:revert -d dist/shared/config/datasource.config.js",
29+
"migration:generate": "yarn run typeorm migration:generate -d dist/src/shared/config/datasource.config.js",
30+
"migration:create": "yarn run typeorm migration:create -d dist/src/shared/config/datasource.config.js",
31+
"migration:run": "yarn run typeorm migration:run -d dist/src/shared/config/datasource.config.js",
32+
"migration:revert": "npm run typeorm -- migration:revert -d dist/src/shared/config/datasource.config.js",
3333
"knip": "knip"
3434
},
3535
"dependencies": {

backend/src/app.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class AppController {
1616

1717
@Get('/hello')
1818
async getHello(): Promise<string> {
19-
2019
return this.getHelloUseCase.execute(undefined, InTransactionEnum.OFF);
2120
}
2221
}
22+

backend/src/authorization/auth-with-api.middleware.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export class AuthWithApiMiddleware implements NestMiddleware {
2828
) {}
2929

3030
async use(req: Request, res: Response, next: (err?: any, res?: any) => void): Promise<void> {
31-
console.info(`Auth with api middleware triggered ->: ${new Date().toISOString()}`);
3231
try {
3332
await this.authenticateRequest(req);
3433
next();

backend/src/authorization/auth.middleware.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export class AuthMiddleware implements NestMiddleware {
2727
private readonly logOutRepository: Repository<LogOutEntity>,
2828
) {}
2929
async use(req: Request, res: Response, next: (err?: any, res?: any) => void): Promise<void> {
30-
console.log(`auth middleware triggered ->: ${new Date().toISOString()}`);
3130
let token: string;
3231
try {
3332
token = req.cookies[Constants.JWT_COOKIE_KEY_NAME];

backend/src/entities/agent/repository/custom-agent-repository-extension.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ export const customAgentRepositoryExtension = {
6565
return 'CASSANDRA-TEST-AGENT-TOKEN';
6666
case ConnectionTypeTestEnum.agent_redis:
6767
return 'REDIS-TEST-AGENT-TOKEN';
68+
case ConnectionTypeTestEnum.agent_clickhouse:
69+
return 'CLICKHOUSE-TEST-AGENT-TOKEN';
6870
}
6971
},
7072
};

backend/src/entities/connection/ssl-certificate/read-certificate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export async function readSslCertificate(): Promise<string> {
99
const fileName = 'global-bundle.pem';
1010
return new Promise((resolve, reject) => {
1111
fs.readFile(
12-
join(__dirname, '..', '..', '..', '..', 'files', 'certificates', fileName),
12+
join(__dirname, '..', '..', '..', '..', '..', 'files', 'certificates', fileName),
1313
'utf8',
1414
function (err, data) {
1515
if (err) {

backend/src/entities/email/template-engine/nunjucks.module.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@ import * as nunjucks from 'nunjucks';
33
import { BaseType } from '../../../common/data-injection.tokens.js';
44
import path from 'path';
55
import { fileURLToPath } from 'url';
6-
import { isTest } from '../../../helpers/app/is-test.js';
6+
import { existsSync } from 'node:fs';
7+
import assert from 'assert';
78
const __filename = fileURLToPath(import.meta.url);
89
const __dirname = path.dirname(__filename);
910

11+
const pathToTemplates = path.join(__dirname, '..', '..', '..', '..', '..', 'public', 'email-templates');
12+
assert(existsSync(pathToTemplates), `Email templates directory does not exist: ${__dirname} ${pathToTemplates}`);
13+
1014
@Global()
1115
@Module({
1216
providers: [
1317
{
1418
provide: BaseType.NUNJUCKS,
1519
useFactory: () => {
16-
const pathToTemplates = isTest()
17-
? process.cwd() + '/public/email-templates'
18-
: path.join(__dirname, '..', '..', '..', '..', 'public', 'email-templates');
1920
const env = new nunjucks.Environment(new nunjucks.FileSystemLoader(pathToTemplates));
2021
return env;
2122
},

backend/src/entities/logging/winston-logger.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export class WinstonLogger implements LoggerService {
1818
this.logger.info(message, ...optionalParams);
1919
}
2020

21+
public info(message: any, ...optionalParams: any[]) {
22+
this.logger.info(message, ...optionalParams);
23+
}
24+
2125
public error(message: any, ...optionalParams: any[]) {
2226
this.logger.error(message, ...optionalParams);
2327
}

backend/src/enums/connection-type.enum.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export enum ConnectionTypeTestEnum {
1010
elasticsearch = 'elasticsearch',
1111
cassandra = 'cassandra',
1212
redis = 'redis',
13+
clickhouse = 'clickhouse',
1314
agent_postgres = 'agent_postgres',
1415
agent_mysql = 'agent_mysql',
1516
agent_oracledb = 'agent_oracledb',
@@ -19,4 +20,5 @@ export enum ConnectionTypeTestEnum {
1920
agent_elasticsearch = 'agent_elasticsearch',
2021
agent_cassandra = 'agent_cassandra',
2122
agent_redis = 'agent_redis',
23+
agent_clickhouse = 'agent_clickhouse',
2224
}

backend/src/helpers/is-connection-entity-agent.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export function isConnectionEntityAgent(connection: ConnectionEntity | CreateCon
1313
ConnectionTypesEnum.agent_mongodb,
1414
ConnectionTypesEnum.agent_cassandra,
1515
ConnectionTypesEnum.agent_redis,
16+
ConnectionTypesEnum.agent_clickhouse,
1617
];
1718

1819
return agentTypes.includes(connection.type as ConnectionTypesEnum);
@@ -28,6 +29,7 @@ export function isConnectionTypeAgent(type: ConnectionTypesEnum | string): boole
2829
ConnectionTypeTestEnum.agent_mongodb,
2930
ConnectionTypeTestEnum.agent_cassandra,
3031
ConnectionTypesEnum.agent_redis,
32+
ConnectionTypesEnum.agent_clickhouse,
3133
];
3234

3335
return connectionTypes.includes(type as ConnectionTypeTestEnum);

0 commit comments

Comments
 (0)