fix base files for strict ts

This commit is contained in:
sbriat 2023-08-25 16:01:19 +02:00
parent f15e7d11b1
commit a4c63c4233
7 changed files with 16 additions and 21 deletions

View File

@ -26,15 +26,19 @@ import { GeographyModule } from '@modules/geography/geography.module';
useFactory: async ( useFactory: async (
configService: ConfigService, configService: ConfigService,
): Promise<ConfigurationModuleOptions> => ({ ): Promise<ConfigurationModuleOptions> => ({
domain: configService.get<string>('SERVICE_CONFIGURATION_DOMAIN'), domain: configService.get<string>(
'SERVICE_CONFIGURATION_DOMAIN',
) as string,
messageBroker: { messageBroker: {
uri: configService.get<string>('MESSAGE_BROKER_URI'), uri: configService.get<string>('MESSAGE_BROKER_URI') as string,
exchange: configService.get<string>('MESSAGE_BROKER_EXCHANGE'), exchange: configService.get<string>(
'MESSAGE_BROKER_EXCHANGE',
) as string,
}, },
redis: { redis: {
host: configService.get<string>('REDIS_HOST'), host: configService.get<string>('REDIS_HOST') as string,
password: configService.get<string>('REDIS_PASSWORD'), password: configService.get<string>('REDIS_PASSWORD'),
port: configService.get<number>('REDIS_PORT'), port: configService.get<number>('REDIS_PORT') as number,
}, },
setConfigurationBrokerQueue: 'matcher-configuration-create-update', setConfigurationBrokerQueue: 'matcher-configuration-create-update',
deleteConfigurationQueue: 'matcher-configuration-delete', deleteConfigurationQueue: 'matcher-configuration-delete',

View File

@ -19,6 +19,6 @@ async function bootstrap() {
}); });
await app.startAllMicroservices(); await app.startAllMicroservices();
await app.listen(process.env.HEALTH_SERVICE_PORT); await app.listen(process.env.HEALTH_SERVICE_PORT as string);
} }
bootstrap(); bootstrap();

View File

@ -6,7 +6,6 @@ import {
ScheduleItemModel, ScheduleItemModel,
AdUnsupportedWriteModel, AdUnsupportedWriteModel,
} from './infrastructure/ad.repository'; } from './infrastructure/ad.repository';
import { Frequency } from './core/domain/ad.types';
import { v4 } from 'uuid'; import { v4 } from 'uuid';
import { ScheduleItemProps } from './core/domain/value-objects/schedule-item.value-object'; import { ScheduleItemProps } from './core/domain/value-objects/schedule-item.value-object';
import { DirectionEncoderPort } from '@modules/geography/core/application/ports/direction-encoder.port'; import { DirectionEncoderPort } from '@modules/geography/core/application/ports/direction-encoder.port';
@ -85,7 +84,7 @@ export class AdMapper
props: { props: {
driver: record.driver, driver: record.driver,
passenger: record.passenger, passenger: record.passenger,
frequency: Frequency[record.frequency], frequency: record.frequency,
fromDate: record.fromDate.toISOString().split('T')[0], fromDate: record.fromDate.toISOString().split('T')[0],
toDate: record.toDate.toISOString().split('T')[0], toDate: record.toDate.toISOString().split('T')[0],
schedule: record.schedule.map((scheduleItem: ScheduleItemModel) => ({ schedule: record.schedule.map((scheduleItem: ScheduleItemModel) => ({
@ -120,11 +119,6 @@ export class AdMapper
return entity; return entity;
}; };
// eslint-disable-next-line @typescript-eslint/no-unused-vars
toResponse = (entity: AdEntity): undefined => {
return undefined;
};
toUnsupportedPersistence = (entity: AdEntity): AdUnsupportedWriteModel => ({ toUnsupportedPersistence = (entity: AdEntity): AdUnsupportedWriteModel => ({
waypoints: this.directionEncoder.encode(entity.getProps().waypoints), waypoints: this.directionEncoder.encode(entity.getProps().waypoints),
direction: this.directionEncoder.encode(entity.getProps().points), direction: this.directionEncoder.encode(entity.getProps().points),

View File

@ -7,12 +7,13 @@ import { AD_MESSAGE_PUBLISHER } from '../ad.di-tokens';
import { AdEntity } from '../core/domain/ad.entity'; import { AdEntity } from '../core/domain/ad.entity';
import { AdMapper } from '../ad.mapper'; import { AdMapper } from '../ad.mapper';
import { ExtendedPrismaRepositoryBase } from '@mobicoop/ddd-library/dist/db/prisma-repository.base'; import { ExtendedPrismaRepositoryBase } from '@mobicoop/ddd-library/dist/db/prisma-repository.base';
import { Frequency } from '../core/domain/ad.types';
export type AdBaseModel = { export type AdBaseModel = {
uuid: string; uuid: string;
driver: boolean; driver: boolean;
passenger: boolean; passenger: boolean;
frequency: string; frequency: Frequency;
fromDate: Date; fromDate: Date;
toDate: Date; toDate: Date;
seatsProposed: number; seatsProposed: number;

View File

@ -165,8 +165,4 @@ describe('Ad Mapper', () => {
expect(mapped.getProps().schedule[0].time).toBe('07:05'); expect(mapped.getProps().schedule[0].time).toBe('07:05');
expect(mapped.getProps().waypoints.length).toBe(2); expect(mapped.getProps().waypoints.length).toBe(2);
}); });
it('should map domain entity to response', async () => {
expect(adMapper.toResponse(adEntity)).toBeUndefined();
});
}); });

View File

@ -14,8 +14,8 @@ const imports = [
useFactory: async ( useFactory: async (
configService: ConfigService, configService: ConfigService,
): Promise<MessageBrokerModuleOptions> => ({ ): Promise<MessageBrokerModuleOptions> => ({
uri: configService.get<string>('MESSAGE_BROKER_URI'), uri: configService.get<string>('MESSAGE_BROKER_URI') as string,
exchange: configService.get<string>('MESSAGE_BROKER_EXCHANGE'), exchange: configService.get<string>('MESSAGE_BROKER_EXCHANGE') as string,
name: 'matcher', name: 'matcher',
handlers: { handlers: {
adCreated: { adCreated: {

View File

@ -13,7 +13,7 @@
"incremental": true, "incremental": true,
"skipLibCheck": true, "skipLibCheck": true,
"strictNullChecks": true, "strictNullChecks": true,
"noImplicitAny": false, "noImplicitAny": true,
"strictBindCallApply": false, "strictBindCallApply": false,
"forceConsistentCasingInFileNames": false, "forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false, "noFallthroughCasesInSwitch": false,