ballrush-core 0.5.4 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/domain/event.d.ts +3 -4
- package/dist/domain/event.js +6 -11
- package/dist/mongo/schemas/event.schema.d.ts +1 -1
- package/dist/mongo/schemas/event.schema.js +1 -1
- package/dist/ports/events.repository.d.ts +1 -1
- package/dist/repositories/mongo/event.mapper.js +2 -2
- package/package.json +1 -1
package/dist/domain/event.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare class Event {
|
|
|
10
10
|
private matches;
|
|
11
11
|
private readonly createdBy;
|
|
12
12
|
private isRatingApplied;
|
|
13
|
-
private
|
|
13
|
+
private seasonId;
|
|
14
14
|
private reportMessageId?;
|
|
15
15
|
private status;
|
|
16
16
|
private constructor();
|
|
@@ -20,7 +20,7 @@ export declare class Event {
|
|
|
20
20
|
templateId: number;
|
|
21
21
|
date: Date;
|
|
22
22
|
createdBy: number;
|
|
23
|
-
|
|
23
|
+
seasonId: string;
|
|
24
24
|
participants?: ParticipantEvent[];
|
|
25
25
|
teams?: Team[];
|
|
26
26
|
matches?: Match[];
|
|
@@ -35,14 +35,13 @@ export declare class Event {
|
|
|
35
35
|
getMessageId(): number;
|
|
36
36
|
getReportMessageId(): number | undefined;
|
|
37
37
|
getDate(): Date;
|
|
38
|
-
|
|
38
|
+
getSeasonId(): string;
|
|
39
39
|
getParticipants(): ParticipantEvent[];
|
|
40
40
|
getTeams(): Team[];
|
|
41
41
|
getMatches(): Match[];
|
|
42
42
|
getCreatedBy(): number;
|
|
43
43
|
getStatus(): EventStatus;
|
|
44
44
|
getIsRatingApplied(): boolean;
|
|
45
|
-
renameSeason(newName: string): void;
|
|
46
45
|
reschedule(newDate: Date): void;
|
|
47
46
|
attachMessage(messageId: number): void;
|
|
48
47
|
attachReportMessage(reportMessageId: number): void;
|
package/dist/domain/event.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Event = void 0;
|
|
4
4
|
class Event {
|
|
5
|
-
constructor(eventId, groupId, messageId, templateId, date, participants, teams, matches, createdBy, isRatingApplied,
|
|
5
|
+
constructor(eventId, groupId, messageId, templateId, date, participants, teams, matches, createdBy, isRatingApplied, seasonId, reportMessageId, status = "active") {
|
|
6
6
|
this.eventId = eventId;
|
|
7
7
|
this.groupId = groupId;
|
|
8
8
|
this.messageId = messageId;
|
|
@@ -13,15 +13,15 @@ class Event {
|
|
|
13
13
|
this.matches = matches;
|
|
14
14
|
this.createdBy = createdBy;
|
|
15
15
|
this.isRatingApplied = isRatingApplied;
|
|
16
|
-
this.
|
|
16
|
+
this.seasonId = seasonId;
|
|
17
17
|
this.reportMessageId = reportMessageId;
|
|
18
18
|
this.status = status;
|
|
19
19
|
}
|
|
20
20
|
static create(params) {
|
|
21
|
-
if (!params.
|
|
22
|
-
throw new Error("Event must have a season
|
|
21
|
+
if (!params.seasonId) {
|
|
22
|
+
throw new Error("Event must have a season ID");
|
|
23
23
|
}
|
|
24
|
-
return new Event(params.eventId, params.groupId, params.messageId ?? 0, params.templateId, params.date, params.participants ?? [], params.teams ?? [], params.matches ?? [], params.createdBy, params.isRatingApplied ?? false, params.
|
|
24
|
+
return new Event(params.eventId, params.groupId, params.messageId ?? 0, params.templateId, params.date, params.participants ?? [], params.teams ?? [], params.matches ?? [], params.createdBy, params.isRatingApplied ?? false, params.seasonId, params.reportMessageId, params.status ?? "active");
|
|
25
25
|
}
|
|
26
26
|
getEventId() { return this.eventId; }
|
|
27
27
|
getGroupId() { return this.groupId; }
|
|
@@ -29,18 +29,13 @@ class Event {
|
|
|
29
29
|
getMessageId() { return this.messageId; }
|
|
30
30
|
getReportMessageId() { return this.reportMessageId; }
|
|
31
31
|
getDate() { return this.date; }
|
|
32
|
-
|
|
32
|
+
getSeasonId() { return this.seasonId; }
|
|
33
33
|
getParticipants() { return this.participants; }
|
|
34
34
|
getTeams() { return this.teams; }
|
|
35
35
|
getMatches() { return this.matches; }
|
|
36
36
|
getCreatedBy() { return this.createdBy; }
|
|
37
37
|
getStatus() { return this.status; }
|
|
38
38
|
getIsRatingApplied() { return this.isRatingApplied; }
|
|
39
|
-
renameSeason(newName) {
|
|
40
|
-
if (!newName)
|
|
41
|
-
throw new Error("Season name cannot be empty");
|
|
42
|
-
this.seasonName = newName;
|
|
43
|
-
}
|
|
44
39
|
reschedule(newDate) {
|
|
45
40
|
this.date = newDate;
|
|
46
41
|
}
|
|
@@ -39,7 +39,7 @@ function createEventSchema() {
|
|
|
39
39
|
messageId: { type: Number, required: true },
|
|
40
40
|
templateId: { type: Number, required: true },
|
|
41
41
|
date: { type: Date, required: true },
|
|
42
|
-
|
|
42
|
+
seasonId: { type: String, required: true },
|
|
43
43
|
createdBy: { type: Number, required: true },
|
|
44
44
|
participants: { type: [ParticipantSchema], default: [] },
|
|
45
45
|
teams: { type: [TeamSchema], default: [] },
|
|
@@ -15,7 +15,7 @@ function toDomain(doc) {
|
|
|
15
15
|
matches: doc.matches,
|
|
16
16
|
createdBy: doc.createdBy,
|
|
17
17
|
isRatingApplied: doc.isRatingApplied,
|
|
18
|
-
|
|
18
|
+
seasonId: doc.seasonId,
|
|
19
19
|
reportMessageId: doc.reportMessageId,
|
|
20
20
|
status: doc.status,
|
|
21
21
|
});
|
|
@@ -32,7 +32,7 @@ function toDoc(event) {
|
|
|
32
32
|
teams: event.getTeams(),
|
|
33
33
|
matches: event.getMatches(),
|
|
34
34
|
status: event.getStatus(),
|
|
35
|
-
|
|
35
|
+
seasonId: event.getSeasonId(),
|
|
36
36
|
isRatingApplied: event.getIsRatingApplied(),
|
|
37
37
|
reportMessageId: event.getReportMessageId(),
|
|
38
38
|
};
|