mirror of
https://gitlab.com/mobicoop/v3/service/matcher.git
synced 2026-01-01 20:12:40 +00:00
wip
This commit is contained in:
@@ -4,7 +4,8 @@ import { Injectable } from '@nestjs/common';
|
||||
import { Ad } from '../domain/entities/ad';
|
||||
import { AdPresenter } from '../adapters/primaries/ad.presenter';
|
||||
import { CreateAdRequest } from '../domain/dtos/create-ad.request';
|
||||
import { Coordinates } from 'src/modules/geography/domain/types/coordinates.type';
|
||||
import { Coordinates } from '../../geography/domain/entities/coordinates';
|
||||
import moment from 'moment-timezone';
|
||||
|
||||
@Injectable()
|
||||
export class AdProfile extends AutomapperProfile {
|
||||
@@ -21,16 +22,14 @@ export class AdProfile extends AutomapperProfile {
|
||||
CreateAdRequest,
|
||||
forMember(
|
||||
(dest) => dest.waypoints,
|
||||
mapFrom(
|
||||
(source) =>
|
||||
source.waypoints.map(
|
||||
(waypoint) =>
|
||||
new Coordinates(
|
||||
waypoint.lon ?? undefined,
|
||||
waypoint.lat ?? undefined,
|
||||
),
|
||||
),
|
||||
// .filter((waypoint) => waypoint),
|
||||
mapFrom((source) =>
|
||||
source.waypoints.map(
|
||||
(waypoint) =>
|
||||
new Coordinates(
|
||||
waypoint.lon ?? undefined,
|
||||
waypoint.lat ?? undefined,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -54,6 +53,18 @@ export class AdProfile extends AutomapperProfile {
|
||||
(dest) => dest.updatedAt,
|
||||
mapFrom((source) => new Date(source.updatedAt)),
|
||||
),
|
||||
// forMember(
|
||||
// (dest) => dest.monTime,
|
||||
// mapFrom((source) =>
|
||||
// source.monTime
|
||||
// ? new Date(
|
||||
// moment
|
||||
// .tz(`${source.fromDate} ${source.monTime}`, source.timezone)
|
||||
// .format(),
|
||||
// )
|
||||
// : undefined,
|
||||
// ),
|
||||
// ),
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import { createMap, Mapper } from '@automapper/core';
|
||||
import { AutomapperProfile, InjectMapper } from '@automapper/nestjs';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Coordinates } from '../../geography/domain/types/coordinates.type';
|
||||
|
||||
@Injectable()
|
||||
export class CoordinatesProfile extends AutomapperProfile {
|
||||
constructor(@InjectMapper() mapper: Mapper) {
|
||||
super(mapper);
|
||||
}
|
||||
|
||||
override get profile() {
|
||||
return (mapper: any) => {
|
||||
createMap(mapper, Coordinates, Coordinates);
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user