Skip to content

refactor: refactor-to-boilerplate#52

Closed
Powfu2 wants to merge 6 commits into
masterfrom
update-to-biolerplate-v2
Closed

refactor: refactor-to-boilerplate#52
Powfu2 wants to merge 6 commits into
masterfrom
update-to-biolerplate-v2

Conversation

@Powfu2

@Powfu2 Powfu2 commented Jul 8, 2026

Copy link
Copy Markdown
Question Answer
Bug fix
New feature
Breaking change
Deprecations
Documentation
Tests added
Chore

Related issues: (MAPCO-6292)
Closes (MAPCO-6292)

Further information:

@Powfu2 Powfu2 requested a review from eyalr1100 July 8, 2026 14:00

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Where are all the other workflows?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why didn't you create a schema? we don't like custom env variables json

Comment thread config/default.json Outdated
Comment on lines +48 to +49
"database": "postgres",
"schema": "public"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why? If that's how your local db is configured, change it in local.json

Comment thread src/common/db/util.ts Outdated
Comment on lines +1 to +2
import type { FindOperator } from 'typeorm';
import { Between, LessThanOrEqual, MoreThanOrEqual } from 'typeorm';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I know you auto fixed it with vs code. But when you import just one type you can just import it in one line with type before the import

Comment thread src/common/interfaces.ts Outdated
Comment on lines +9 to +12
protocol: string;
host: string;
projectId?: string;
port: string;
projectId?: string;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

take this from the configtype - would be much easier with a schema

Comment thread src/containerConfig.ts Outdated
Comment on lines +42 to +68
{
token: Connection,
provider: { useFactory: instancePerContainerCachingFactory(connectionFactory) },
postInjectionHook: async (container: DependencyContainer): Promise<void> => {
const connection = container.resolve<Connection>(Connection);
await connection.connect();
},
{
token: DUMP_METADATA_REPOSITORY_SYMBOL,
provider: {
useFactory: (container): Repository<DumpMetadata> => {
const connection = container.resolve<Connection>(Connection);
const repository = connection.getRepository(DumpMetadata);
return repository;
},
},
{
token: DUMP_METADATA_REPOSITORY_SYMBOL,
provider: {
useFactory: (container): Repository<DumpMetadata> => {
const connection = container.resolve<Connection>(Connection);
return connection.getRepository(DumpMetadata);
},
},
{ token: DUMP_METADATA_ROUTER_SYMBOL, provider: { useFactory: dumpMetadataRouterFactory } },
{
token: 'healthcheck',
provider: { useFactory: (container): unknown => getDbHealthCheckFunction(container.resolve<Connection>(Connection)) },
},
{
token: 'onSignal',
provider: {
useValue: {
useValue: async (): Promise<void> => {
await Promise.all([tracing.stop(), otelMetrics.stop(), shutdownHandler.onShutdown()]);
},
},
},
{ token: DUMP_METADATA_ROUTER_SYMBOL, provider: { useFactory: dumpMetadataRouterFactory } },
{
token: SERVICES.HEALTHCHECK,
provider: { useFactory: (container): HealthCheck => getDbHealthCheckFunction(container.resolve<Connection>(Connection)) },
},
{
token: 'onSignal',
provider: {
useValue: async (): Promise<void> => {
await Promise.all([getTracing().stop()]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why don't you use cleanup registry? Do you want to destroy our project?

import type { DumpMetadata } from '@src/dumpMetadata/DAL/typeorm/dumpMetadata';
import type { RegisterOptions } from '@src/containerConfig';
import { SERVICES } from '@common/constants';
import { createMultipleFakeDumpsMetadata } from '../../../helpers';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If you removed all the ../../.. for src, why not add a @tests alias?

Comment on lines +9 to +30
const HAPPY_PATH = 'Happy Path 🙂';
const SAD_PATH = 'Sad Path 😥';
const BAD_PATH = 'Bad Path 😡';

export const BEFORE_ALL_TIMEOUT = 20000;
const BEFORE_ALL_TIMEOUT = 20000;

export const generateDumpsMetadataOnDb = async (repository: Repository<DumpMetadata>, amount: number): Promise<DumpMetadata[]> => {
const generateDumpsMetadataOnDb = async (repository: Repository<DumpMetadata>, amount: number): Promise<DumpMetadata[]> => {
const createdDumpsMetadata = repository.create(createMultipleFakeDumpsMetadata(amount));
return repository.save(createdDumpsMetadata);
};

export const getBaseRegisterOptions = (): Required<RegisterOptions> => {
const getBaseRegisterOptions = async (): Promise<Required<RegisterOptions>> => {
return {
override: [
{ token: Services.LOGGER, provider: { useValue: jsLogger({ enabled: false }) } },
{ token: Services.TRACER, provider: { useValue: trace.getTracer('testTracer') } },
{ token: SERVICES.LOGGER, provider: { useValue: await jsLogger({ enabled: false }) } },
{ token: SERVICES.TRACER, provider: { useValue: trace.getTracer('testTracer') } },
],
useChild: true,
};
};

export { HAPPY_PATH, SAD_PATH, BAD_PATH, BEFORE_ALL_TIMEOUT, generateDumpsMetadataOnDb, getBaseRegisterOptions };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

revert to inline export

Comment on lines +24 to +32
const noopLogger = {
info: (): void => undefined,
error: (): void => undefined,
debug: (): void => undefined,
warn: (): void => undefined,
trace: (): void => undefined,
fatal: (): void => undefined,
child: (): Logger => noopLogger,
} as unknown as Logger;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Our team manager will kill you for using as unknown as

import { getDefaultFilter } from '../../helpers';
import { DumpNameAlreadyExistsError } from '../../../../src/common/errors';

const noopLogger = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I also don't get the sentiment of using a mocked logger instead of logger enabled false like it was before

@Powfu2 Powfu2 closed this Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants