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

@@ -6,7 +6,6 @@ import {
ScheduleItemModel,
AdUnsupportedWriteModel,
} from './infrastructure/ad.repository';
import { Frequency } from './core/domain/ad.types';
import { v4 } from 'uuid';
import { ScheduleItemProps } from './core/domain/value-objects/schedule-item.value-object';
import { DirectionEncoderPort } from '@modules/geography/core/application/ports/direction-encoder.port';
@@ -85,7 +84,7 @@ export class AdMapper
props: {
driver: record.driver,
passenger: record.passenger,
frequency: Frequency[record.frequency],
frequency: record.frequency,
fromDate: record.fromDate.toISOString().split('T')[0],
toDate: record.toDate.toISOString().split('T')[0],
schedule: record.schedule.map((scheduleItem: ScheduleItemModel) => ({
@@ -120,11 +119,6 @@ export class AdMapper
return entity;
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars
toResponse = (entity: AdEntity): undefined => {
return undefined;
};
toUnsupportedPersistence = (entity: AdEntity): AdUnsupportedWriteModel => ({
waypoints: this.directionEncoder.encode(entity.getProps().waypoints),
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 { AdMapper } from '../ad.mapper';
import { ExtendedPrismaRepositoryBase } from '@mobicoop/ddd-library/dist/db/prisma-repository.base';
import { Frequency } from '../core/domain/ad.types';
export type AdBaseModel = {
uuid: string;
driver: boolean;
passenger: boolean;
frequency: string;
frequency: Frequency;
fromDate: Date;
toDate: Date;
seatsProposed: number;

View File

@@ -165,8 +165,4 @@ describe('Ad Mapper', () => {
expect(mapped.getProps().schedule[0].time).toBe('07:05');
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 (
configService: ConfigService,
): Promise<MessageBrokerModuleOptions> => ({
uri: configService.get<string>('MESSAGE_BROKER_URI'),
exchange: configService.get<string>('MESSAGE_BROKER_EXCHANGE'),
uri: configService.get<string>('MESSAGE_BROKER_URI') as string,
exchange: configService.get<string>('MESSAGE_BROKER_EXCHANGE') as string,
name: 'matcher',
handlers: {
adCreated: {