Skip to content

Commit 5e79bad

Browse files
committed
event key
1 parent 6c63987 commit 5e79bad

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

backend/src/DTOs/new-event.dto.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ import { MultiLingStringDTO } from "@/DTOs/multi-ling-string.dto";
22
import { ApiProperty } from "@nestjs/swagger";
33

44
export class NewEventDTO {
5+
@ApiProperty({
6+
type: "string",
7+
nullable: false,
8+
required: true,
9+
})
10+
eventKey: string;
11+
512
@ApiProperty({
613
type: "string",
714
format: "date-time",

backend/src/entities/event/event.entity.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ export class Event extends TranslatableEntity {
77
readonly LBL_VENUE_WITH_ARTICLE_IF_NEEDED = "venueWithArticleIfNeeded";
88
readonly LBL_ADDRESS = "address";
99

10+
/** @dev Used to re-address the event and avoiding duplicates */
11+
@Column({ nullable: false, unique: true })
12+
eventKey: string;
13+
1014
@Column({ nullable: false })
1115
eventStartDateTime: Date;
1216

backend/src/entities/event/event.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export class EventService {
137137

138138
const newEventEntity: Event = this.eventRepository.create();
139139
await this.eventRepository.save(newEventEntity); // otherwise relationship constraints don't work
140+
newEventEntity.eventKey = newEvent.eventKey;
140141
newEventEntity.venueWithArticleIfNeeded =
141142
await this.multilingualStringService.createTranslations(
142143
newEvent.venueWithArticleIfNeeded,

0 commit comments

Comments
 (0)