Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
"test-all": "ava --timeout=5m --serial",
"test-saas": "ava test/ava-tests/saas-tests/* ",
"typeorm": "ts-node -r tsconfig-paths/register ../node_modules/.bin/typeorm",
"migration:generate": "yarn run typeorm migration:generate -d dist/shared/config/datasource.config.js",
"migration:create": "yarn run typeorm migration:create -d dist/shared/config/datasource.config.js",
"migration:run": "yarn run typeorm migration:run -d dist/shared/config/datasource.config.js",
"migration:revert": "npm run typeorm -- migration:revert -d dist/shared/config/datasource.config.js",
"migration:generate": "yarn run typeorm migration:generate -d dist/src/shared/config/datasource.config.js",
"migration:create": "yarn run typeorm migration:create -d dist/src/shared/config/datasource.config.js",
"migration:run": "yarn run typeorm migration:run -d dist/src/shared/config/datasource.config.js",
"migration:revert": "npm run typeorm -- migration:revert -d dist/src/shared/config/datasource.config.js",
"knip": "knip"
},
"dependencies": {
Expand Down
1 change: 0 additions & 1 deletion backend/src/authorization/auth-with-api.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export class AuthWithApiMiddleware implements NestMiddleware {
) {}

async use(req: Request, res: Response, next: (err?: any, res?: any) => void): Promise<void> {
console.info(`Auth with api middleware triggered ->: ${new Date().toISOString()}`);
try {
await this.authenticateRequest(req);
next();
Expand Down
1 change: 0 additions & 1 deletion backend/src/authorization/auth.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export class AuthMiddleware implements NestMiddleware {
private readonly logOutRepository: Repository<LogOutEntity>,
) {}
async use(req: Request, res: Response, next: (err?: any, res?: any) => void): Promise<void> {
console.log(`auth middleware triggered ->: ${new Date().toISOString()}`);
let token: string;
try {
token = req.cookies[Constants.JWT_COOKIE_KEY_NAME];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function readSslCertificate(): Promise<string> {
const fileName = 'global-bundle.pem';
return new Promise((resolve, reject) => {
fs.readFile(
join(__dirname, '..', '..', '..', '..', 'files', 'certificates', fileName),
join(__dirname, '..', '..', '..', '..', '..', 'files', 'certificates', fileName),
'utf8',
function (err, data) {
if (err) {
Expand Down
9 changes: 5 additions & 4 deletions backend/src/entities/email/template-engine/nunjucks.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ import * as nunjucks from 'nunjucks';
import { BaseType } from '../../../common/data-injection.tokens.js';
import path from 'path';
import { fileURLToPath } from 'url';
import { isTest } from '../../../helpers/app/is-test.js';
import { existsSync } from 'node:fs';
import assert from 'assert';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const pathToTemplates = path.join(__dirname, '..', '..', '..', '..', '..', 'public', 'email-templates');
assert(existsSync(pathToTemplates), `Email templates directory does not exist: ${__dirname} ${pathToTemplates}`);

@Global()
@Module({
providers: [
{
provide: BaseType.NUNJUCKS,
useFactory: () => {
const pathToTemplates = isTest()
? process.cwd() + '/public/email-templates'
: path.join(__dirname, '..', '..', '..', '..', 'public', 'email-templates');
const env = new nunjucks.Environment(new nunjucks.FileSystemLoader(pathToTemplates));
return env;
},
Expand Down
4 changes: 4 additions & 0 deletions backend/src/entities/logging/winston-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export class WinstonLogger implements LoggerService {
this.logger.info(message, ...optionalParams);
}

public info(message: any, ...optionalParams: any[]) {
this.logger.info(message, ...optionalParams);
}

Comment on lines +21 to +24
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The newly added info method is functionally identical to the existing log method (lines 17-19), as both simply delegate to this.logger.info(). This creates unnecessary duplication. Consider whether both methods are needed, or if the middleware should continue using the log method instead.

Suggested change
public info(message: any, ...optionalParams: any[]) {
this.logger.info(message, ...optionalParams);
}

Copilot uses AI. Check for mistakes.
public error(message: any, ...optionalParams: any[]) {
this.logger.error(message, ...optionalParams);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export class AppLoggerMiddleware implements NestMiddleware {
use(request: Request, response: Response, next: NextFunction): void {
const { ip, method, path: url, baseUrl } = request;
const userAgent = request.get('user-agent') || '';
this.logger.log(`START ${method} ${url}${baseUrl} - ${userAgent} ${ip}`, { context: 'HTTP' });
this.logger.info(`START ${method} ${url}${baseUrl} - ${userAgent} ${ip}`, { context: 'HTTP' });
response.on('close', () => {
const { statusCode } = response;
const contentLength = response.get('content-length');
this.logger.log(
this.logger.info(
`method: ${method}, url: ${url}, statusCode: ${statusCode}, contentLength: ${contentLength}, userAgent: ${userAgent}, ip: ${ip}`,
{ context: 'HTTP' },
);
Expand Down
1 change: 1 addition & 0 deletions backend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"target": "ESNext",
"sourceMap": true,
"outDir": "./dist",
"rootDir": "./",
"baseUrl": "./",
"incremental": true,
"moduleResolution": "node",
Expand Down
1 change: 1 addition & 0 deletions docker-compose.tst.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ services:
environment:
- "DATABASE_URL=postgres://postgres:abc123@postgres:5432/postgres"
- "EXTRA_ARGS=$EXTRA_ARGS"
- LOG_LEVEL=warn
volumes:
- ./backend/src/migrations:/app/src/migrations
depends_on:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ WHERE TABLE_TYPE = 'VIEW'
}
const knex = await this.configureKnex();
try {
await knex().select(1);
await knex.queryBuilder().select(1);
return {
result: true,
message: 'Successfully connected',
Expand Down Expand Up @@ -472,18 +472,18 @@ WHERE TABLE_TYPE = 'VIEW'
knex
.raw(
`
SELECT
SELECT
OBJECT_NAME(f.parent_object_id) "table_name",
COL_NAME(fc.parent_object_id,fc.parent_column_id) "column_name"
FROM
FROM
sys.foreign_keys AS f
INNER JOIN
sys.foreign_key_columns AS fc
INNER JOIN
sys.foreign_key_columns AS fc
ON f.OBJECT_ID = fc.constraint_object_id
INNER JOIN
sys.tables t
INNER JOIN
sys.tables t
ON t.OBJECT_ID = fc.referenced_object_id
WHERE
WHERE
OBJECT_NAME (f.referenced_object_id) = ?
`,
tableName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ export class DataAccessObjectMysql extends BasicDataAccessObject implements IDat
}
const knex = await this.configureKnex();
try {
await knex().select(1);
await knex.queryBuilder().select(1);
return {
result: true,
message: 'Successfully connected',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ export class DataAccessObjectOracle extends BasicDataAccessObject implements IDa
}
const knex = await this.configureKnex();
const schema = this.connection.schema ?? this.connection.username.toUpperCase();
const structureColumns = await knex()
const structureColumns = await knex.queryBuilder()
.select('COLUMN_NAME', 'DATA_DEFAULT', 'DATA_TYPE', 'NULLABLE', 'DATA_LENGTH')
.from('ALL_TAB_COLUMNS')
.orderBy('COLUMN_ID')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ export class DataAccessObjectPostgres extends BasicDataAccessObject implements I
const bindings = [schema];
try {
const results = await knex.raw(query, bindings);
console.log({ tablesPg: results });
return results.rows.map((row: Record<string, unknown>) => ({ tableName: row.table_name, isView: !!row.is_view }));
} catch (error) {
console.log({ tablesPg: error });
Expand Down Expand Up @@ -434,7 +433,7 @@ export class DataAccessObjectPostgres extends BasicDataAccessObject implements I
}
const knex = await this.configureKnex();
try {
await knex().select(1);
await knex.queryBuilder().select(1);
return {
result: true,
message: 'Successfully connected',
Expand Down
Loading