mirror of
https://gitlab.com/mobicoop/v3/service/ad.git
synced 2026-01-10 21:12:40 +00:00
Add optional comment to Ad type and records #7409
This commit is contained in:
@@ -82,6 +82,7 @@ export class AdMapper
|
||||
})),
|
||||
}
|
||||
: undefined,
|
||||
comment: copy.comment,
|
||||
};
|
||||
return record;
|
||||
};
|
||||
@@ -128,6 +129,7 @@ export class AdMapper
|
||||
},
|
||||
},
|
||||
})),
|
||||
comment: record.comment,
|
||||
},
|
||||
});
|
||||
return entity;
|
||||
@@ -193,6 +195,7 @@ export class AdMapper
|
||||
lon: waypoint.address.coordinates.lon,
|
||||
lat: waypoint.address.coordinates.lat,
|
||||
}));
|
||||
response.comment = props.comment;
|
||||
return response;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ export class CreateAdCommand extends Command {
|
||||
readonly seatsRequested?: number;
|
||||
readonly strict: boolean;
|
||||
readonly waypoints: Waypoint[];
|
||||
readonly comment?: string;
|
||||
|
||||
constructor(props: CommandProps<CreateAdCommand>) {
|
||||
super(props);
|
||||
@@ -29,5 +30,6 @@ export class CreateAdCommand extends Command {
|
||||
this.seatsRequested = props.seatsRequested;
|
||||
this.strict = props.strict;
|
||||
this.waypoints = props.waypoints;
|
||||
this.comment = props.comment;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,6 +95,7 @@ export class CreateAdService implements ICommandHandler {
|
||||
},
|
||||
},
|
||||
})),
|
||||
comment: command.comment,
|
||||
});
|
||||
|
||||
try {
|
||||
|
||||
@@ -47,6 +47,7 @@ export class AdEntity extends AggregateRoot<AdProps> {
|
||||
lon: waypoint.address.coordinates.lon,
|
||||
lat: waypoint.address.coordinates.lat,
|
||||
})),
|
||||
comment: props.comment,
|
||||
}),
|
||||
);
|
||||
return ad;
|
||||
|
||||
@@ -15,6 +15,7 @@ export interface AdProps {
|
||||
seatsRequested: number;
|
||||
strict: boolean;
|
||||
waypoints: WaypointProps[];
|
||||
comment?: string;
|
||||
}
|
||||
|
||||
// Properties that are needed for an Ad creation
|
||||
@@ -30,6 +31,7 @@ export interface CreateAdProps {
|
||||
seatsRequested: number;
|
||||
strict: boolean;
|
||||
waypoints: WaypointProps[];
|
||||
comment?: string;
|
||||
}
|
||||
|
||||
export enum Frequency {
|
||||
|
||||
@@ -12,6 +12,7 @@ export class AdCreatedDomainEvent extends DomainEvent {
|
||||
readonly seatsRequested: number;
|
||||
readonly strict: boolean;
|
||||
readonly waypoints: Waypoint[];
|
||||
readonly comment?: string;
|
||||
|
||||
constructor(props: DomainEventProps<AdCreatedDomainEvent>) {
|
||||
super(props);
|
||||
@@ -26,6 +27,7 @@ export class AdCreatedDomainEvent extends DomainEvent {
|
||||
this.seatsRequested = props.seatsRequested;
|
||||
this.strict = props.strict;
|
||||
this.waypoints = props.waypoints;
|
||||
this.comment = props.comment;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ export type AdBaseModel = {
|
||||
seatsProposed: number;
|
||||
seatsRequested: number;
|
||||
strict: boolean;
|
||||
comment?: string;
|
||||
};
|
||||
|
||||
export type AdReadModel = AdBaseModel & {
|
||||
|
||||
@@ -28,4 +28,5 @@ export class AdResponseDto extends ResponseBase {
|
||||
lon: number;
|
||||
lat: number;
|
||||
}[];
|
||||
comment?: string;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ message Ad {
|
||||
int32 seatsRequested = 10;
|
||||
bool strict = 11;
|
||||
repeated Waypoint waypoints = 12;
|
||||
optional string comment = 13;
|
||||
}
|
||||
|
||||
message ScheduleItem {
|
||||
|
||||
@@ -3,8 +3,10 @@ import {
|
||||
IsBoolean,
|
||||
IsInt,
|
||||
IsEnum,
|
||||
IsString,
|
||||
ValidateNested,
|
||||
ArrayMinSize,
|
||||
Length,
|
||||
IsUUID,
|
||||
IsArray,
|
||||
IsISO8601,
|
||||
@@ -78,4 +80,9 @@ export class CreateAdRequestDto {
|
||||
@HasValidPositionIndexes()
|
||||
@ValidateNested({ each: true })
|
||||
waypoints: WaypointDto[];
|
||||
|
||||
@Length(0, 2000)
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
comment?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user