mirror of
https://gitlab.com/mobicoop/v3/service/matcher.git
synced 2026-01-01 04:42:41 +00:00
functional ad insert
This commit is contained in:
@@ -1,15 +1,12 @@
|
||||
import { Inject, Injectable, Logger } from '@nestjs/common';
|
||||
import { EventEmitter2 } from '@nestjs/event-emitter';
|
||||
import { AdRepositoryPort } from '../core/application/ports/ad.repository.port';
|
||||
import {
|
||||
LoggerBase,
|
||||
MessagePublisherPort,
|
||||
PrismaRepositoryBase,
|
||||
} from '@mobicoop/ddd-library';
|
||||
import { LoggerBase, MessagePublisherPort } from '@mobicoop/ddd-library';
|
||||
import { PrismaService } from './prisma.service';
|
||||
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';
|
||||
|
||||
export type AdBaseModel = {
|
||||
uuid: string;
|
||||
@@ -25,8 +22,6 @@ export type AdBaseModel = {
|
||||
driverDistance: number;
|
||||
passengerDuration: number;
|
||||
passengerDistance: number;
|
||||
waypoints: string;
|
||||
direction: string;
|
||||
fwdAzimuth: number;
|
||||
backAzimuth: number;
|
||||
createdAt: Date;
|
||||
@@ -34,6 +29,8 @@ export type AdBaseModel = {
|
||||
};
|
||||
|
||||
export type AdReadModel = AdBaseModel & {
|
||||
waypoints: string;
|
||||
direction: string;
|
||||
schedule: ScheduleItemModel[];
|
||||
};
|
||||
|
||||
@@ -43,6 +40,11 @@ export type AdWriteModel = AdBaseModel & {
|
||||
};
|
||||
};
|
||||
|
||||
export type AdUnsupportedWriteModel = {
|
||||
waypoints: string;
|
||||
direction: string;
|
||||
};
|
||||
|
||||
export type ScheduleItemModel = {
|
||||
uuid: string;
|
||||
day: number;
|
||||
@@ -57,7 +59,12 @@ export type ScheduleItemModel = {
|
||||
* */
|
||||
@Injectable()
|
||||
export class AdRepository
|
||||
extends PrismaRepositoryBase<AdEntity, AdReadModel, AdWriteModel>
|
||||
extends ExtendedPrismaRepositoryBase<
|
||||
AdEntity,
|
||||
AdReadModel,
|
||||
AdWriteModel,
|
||||
AdUnsupportedWriteModel
|
||||
>
|
||||
implements AdRepositoryPort
|
||||
{
|
||||
constructor(
|
||||
|
||||
Reference in New Issue
Block a user