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.
@@ -10,7 +10,7 @@ export declare class Event {
10
10
  private matches;
11
11
  private readonly createdBy;
12
12
  private isRatingApplied;
13
- private seasonName;
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
- seasonName: string;
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
- getSeasonName(): string;
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;
@@ -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, seasonName, reportMessageId, status = "active") {
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.seasonName = seasonName;
16
+ this.seasonId = seasonId;
17
17
  this.reportMessageId = reportMessageId;
18
18
  this.status = status;
19
19
  }
20
20
  static create(params) {
21
- if (!params.seasonName) {
22
- throw new Error("Event must have a season name");
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.seasonName, params.reportMessageId, params.status ?? "active");
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
- getSeasonName() { return this.seasonName; }
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
  }
@@ -10,7 +10,7 @@ export interface EventDoc {
10
10
  participants: ParticipantEvent[];
11
11
  teams: Team[];
12
12
  matches: Match[];
13
- seasonName: string;
13
+ seasonId: string;
14
14
  status: EventStatus;
15
15
  isRatingApplied: boolean;
16
16
  reportMessageId?: number;
@@ -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
- seasonName: { type: String, required: true },
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: [] },
@@ -11,7 +11,7 @@ export type EventWrite = {
11
11
  teams: Team[];
12
12
  matches: Match[];
13
13
  status: EventStatus;
14
- seasonName: string;
14
+ seasonId: string;
15
15
  isRatingApplied?: boolean;
16
16
  reportMessageId?: number;
17
17
  };
@@ -15,7 +15,7 @@ function toDomain(doc) {
15
15
  matches: doc.matches,
16
16
  createdBy: doc.createdBy,
17
17
  isRatingApplied: doc.isRatingApplied,
18
- seasonName: doc.seasonName,
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
- seasonName: event.getSeasonName(),
35
+ seasonId: event.getSeasonId(),
36
36
  isRatingApplied: event.getIsRatingApplied(),
37
37
  reportMessageId: event.getReportMessageId(),
38
38
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ballrush-core",
3
- "version": "0.5.4",
3
+ "version": "0.6.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",