ballrush-core 0.6.4 → 0.6.6

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.
@@ -15,6 +15,7 @@ export declare class Achievement {
15
15
  private description;
16
16
  private translations;
17
17
  private icon;
18
+ private iconUrl;
18
19
  private algorithm;
19
20
  private isActive;
20
21
  private createdAt;
@@ -28,6 +29,7 @@ export declare class Achievement {
28
29
  description: string;
29
30
  translations?: AchievementTranslations;
30
31
  icon: string;
32
+ iconUrl?: string;
31
33
  algorithm: string;
32
34
  isActive?: boolean;
33
35
  createdAt?: Date;
@@ -41,6 +43,7 @@ export declare class Achievement {
41
43
  getTranslations(): AchievementTranslations;
42
44
  getTranslation(language: string): AchievementTranslation | undefined;
43
45
  getIcon(): string;
46
+ getIconUrl(): string | undefined;
44
47
  getAlgorithm(): string;
45
48
  getIsActive(): boolean;
46
49
  getCreatedAt(): Date;
@@ -51,6 +54,7 @@ export declare class Achievement {
51
54
  addTranslation(language: string, translation: AchievementTranslation): void;
52
55
  removeTranslation(language: string): void;
53
56
  setIcon(icon: string): void;
57
+ setIconUrl(url: string | undefined): void;
54
58
  setAlgorithm(algorithm: string): void;
55
59
  setIsActive(isActive: boolean): void;
56
60
  /**
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Achievement = void 0;
4
4
  class Achievement {
5
- constructor(achievementId, type, scope, title, description, translations, icon, algorithm, isActive, createdAt, updatedAt) {
5
+ constructor(achievementId, type, scope, title, description, translations, icon, iconUrl, algorithm, isActive, createdAt, updatedAt) {
6
6
  this.achievementId = achievementId;
7
7
  this.type = type;
8
8
  this.scope = scope;
@@ -10,6 +10,7 @@ class Achievement {
10
10
  this.description = description;
11
11
  this.translations = translations;
12
12
  this.icon = icon;
13
+ this.iconUrl = iconUrl;
13
14
  this.algorithm = algorithm;
14
15
  this.isActive = isActive;
15
16
  this.createdAt = createdAt;
@@ -38,7 +39,7 @@ class Achievement {
38
39
  throw new Error("Achievement creation failed: algorithm is required");
39
40
  }
40
41
  const now = new Date();
41
- return new Achievement(params.achievementId, params.type, params.scope, params.title, params.description, params.translations ?? {}, params.icon, params.algorithm, params.isActive ?? true, params.createdAt ?? now, params.updatedAt ?? now);
42
+ return new Achievement(params.achievementId, params.type, params.scope, params.title, params.description, params.translations ?? {}, params.icon, params.iconUrl, params.algorithm, params.isActive ?? true, params.createdAt ?? now, params.updatedAt ?? now);
42
43
  }
43
44
  // ---- GETTERS
44
45
  getAchievementId() {
@@ -65,6 +66,9 @@ class Achievement {
65
66
  getIcon() {
66
67
  return this.icon;
67
68
  }
69
+ getIconUrl() {
70
+ return this.iconUrl;
71
+ }
68
72
  getAlgorithm() {
69
73
  return this.algorithm;
70
74
  }
@@ -117,6 +121,10 @@ class Achievement {
117
121
  this.icon = icon;
118
122
  this.updatedAt = new Date();
119
123
  }
124
+ setIconUrl(url) {
125
+ this.iconUrl = url;
126
+ this.updatedAt = new Date();
127
+ }
120
128
  setAlgorithm(algorithm) {
121
129
  if (!algorithm) {
122
130
  throw new Error("algorithm cannot be empty");
@@ -9,6 +9,7 @@ export interface AchievementDoc {
9
9
  description: string;
10
10
  translations: AchievementTranslations;
11
11
  icon: string;
12
+ iconUrl?: string;
12
13
  algorithm: string;
13
14
  isActive: boolean;
14
15
  createdAt: Date;
@@ -37,6 +37,10 @@ function createAchievementSchema() {
37
37
  type: String,
38
38
  required: true,
39
39
  },
40
+ iconUrl: {
41
+ type: String,
42
+ required: false,
43
+ },
40
44
  algorithm: {
41
45
  type: String,
42
46
  required: true,
@@ -51,7 +51,7 @@ export interface StatEventMatchDoc {
51
51
  */
52
52
  export interface StatEventHeaderDoc {
53
53
  status: 'Finished' | 'In Progress' | 'Upcoming';
54
- seasonName: string;
54
+ seasonId: string;
55
55
  groupName: string;
56
56
  eventName: string;
57
57
  date: Date;
@@ -44,7 +44,7 @@ function createStatEventSchema() {
44
44
  }, { _id: false });
45
45
  const HeaderSchema = new mongoose_1.Schema({
46
46
  status: { type: String, enum: ['Finished', 'In Progress', 'Upcoming'], required: true },
47
- seasonName: { type: String, required: true },
47
+ seasonId: { type: String, required: true },
48
48
  groupName: { type: String, required: true },
49
49
  eventName: { type: String, required: true },
50
50
  date: { type: Date, required: true },
@@ -11,7 +11,7 @@ export interface StatGroupProfileDoc {
11
11
  totalGames: number;
12
12
  averageSkillRating: number;
13
13
  currentSeason: {
14
- seasonName: string;
14
+ seasonId: string;
15
15
  status: 'in_progress' | 'completed';
16
16
  } | null;
17
17
  updatedAt: Date;
@@ -8,7 +8,7 @@ const mongoose_1 = require("mongoose");
8
8
  */
9
9
  function createStatGroupProfileSchema() {
10
10
  const CurrentSeasonSchema = new mongoose_1.Schema({
11
- seasonName: { type: String, required: true },
11
+ seasonId: { type: String, required: true },
12
12
  status: { type: String, enum: ['in_progress', 'completed'], required: true },
13
13
  }, { _id: false });
14
14
  const StatGroupProfileSchema = new mongoose_1.Schema({
@@ -19,7 +19,7 @@ export interface StatGroupSeasonParticipantDoc {
19
19
  */
20
20
  export interface StatGroupSeasonDoc {
21
21
  groupId: number;
22
- seasonName: string;
22
+ seasonId: string;
23
23
  totalMatches: number;
24
24
  totalGoals: number;
25
25
  averageGoalsPerMatch: number;
@@ -21,7 +21,7 @@ function createStatGroupSeasonSchema() {
21
21
  }, { _id: false });
22
22
  const StatGroupSeasonSchema = new mongoose_1.Schema({
23
23
  groupId: { type: Number, required: true, index: true },
24
- seasonName: { type: String, required: true },
24
+ seasonId: { type: String, required: true },
25
25
  totalMatches: { type: Number, required: true, min: 0, default: 0 },
26
26
  totalGoals: { type: Number, required: true, min: 0, default: 0 },
27
27
  averageGoalsPerMatch: { type: Number, required: true, min: 0, default: 0 },
@@ -36,8 +36,8 @@ function createStatGroupSeasonSchema() {
36
36
  collection: 'stat_group_seasons',
37
37
  versionKey: false,
38
38
  });
39
- // Composite unique index for groupId + seasonName
40
- StatGroupSeasonSchema.index({ groupId: 1, seasonName: 1 }, { unique: true });
39
+ // Composite unique index for groupId + seasonId
40
+ StatGroupSeasonSchema.index({ groupId: 1, seasonId: 1 }, { unique: true });
41
41
  // Index for listing seasons by group (newest first will be done in query)
42
42
  StatGroupSeasonSchema.index({ groupId: 1, updatedAt: -1 });
43
43
  return StatGroupSeasonSchema;
@@ -10,7 +10,7 @@ export interface StatUserMatchHistoryDoc {
10
10
  matchup: string;
11
11
  score: string;
12
12
  date: Date;
13
- seasonName: string;
13
+ seasonId: string;
14
14
  createdAt: Date;
15
15
  }
16
16
  /**
@@ -15,7 +15,7 @@ function createStatUserMatchHistorySchema() {
15
15
  matchup: { type: String, required: true },
16
16
  score: { type: String, required: true },
17
17
  date: { type: Date, required: true },
18
- seasonName: { type: String, required: true },
18
+ seasonId: { type: String, required: true },
19
19
  createdAt: { type: Date, default: Date.now },
20
20
  }, {
21
21
  collection: 'stat_user_match_history',
@@ -23,7 +23,7 @@ function createStatUserMatchHistorySchema() {
23
23
  });
24
24
  // Compound index for efficient queries (userId + groupId + date DESC)
25
25
  StatUserMatchHistorySchema.index({ userId: 1, groupId: 1, date: -1 });
26
- // Compound index for season filtering (userId + groupId + seasonName + date DESC)
27
- StatUserMatchHistorySchema.index({ userId: 1, groupId: 1, seasonName: 1, date: -1 });
26
+ // Compound index for season filtering (userId + groupId + seasonId + date DESC)
27
+ StatUserMatchHistorySchema.index({ userId: 1, groupId: 1, seasonId: 1, date: -1 });
28
28
  return StatUserMatchHistorySchema;
29
29
  }
@@ -12,6 +12,7 @@ function toDomain(doc) {
12
12
  description: doc.description,
13
13
  translations: doc.translations,
14
14
  icon: doc.icon,
15
+ iconUrl: doc.iconUrl,
15
16
  algorithm: doc.algorithm,
16
17
  isActive: doc.isActive,
17
18
  createdAt: doc.createdAt,
@@ -27,6 +28,7 @@ function toDoc(achievement) {
27
28
  description: achievement.getDescription(),
28
29
  translations: achievement.getTranslations(),
29
30
  icon: achievement.getIcon(),
31
+ iconUrl: achievement.getIconUrl(),
30
32
  algorithm: achievement.getAlgorithm(),
31
33
  isActive: achievement.getIsActive(),
32
34
  createdAt: achievement.getCreatedAt(),
@@ -28,7 +28,7 @@ class MongoStatEventRepository {
28
28
  eventId: doc.eventId,
29
29
  header: {
30
30
  status: doc.header.status,
31
- seasonName: doc.header.seasonName,
31
+ seasonId: doc.header.seasonId,
32
32
  groupName: doc.header.groupName,
33
33
  eventName: doc.header.eventName,
34
34
  date: doc.header.date,
@@ -30,7 +30,7 @@ class MongoStatGroupProfileRepository {
30
30
  totalGames: doc.totalGames,
31
31
  averageSkillRating: doc.averageSkillRating,
32
32
  currentSeason: doc.currentSeason ? {
33
- seasonName: doc.currentSeason.seasonName,
33
+ seasonId: doc.currentSeason.seasonId,
34
34
  status: doc.currentSeason.status,
35
35
  } : null,
36
36
  updatedAt: doc.updatedAt,
@@ -24,7 +24,7 @@ class MongoStatGroupSeasonRepository {
24
24
  // Map documents to domain types
25
25
  return docs.map(doc => ({
26
26
  groupId: doc.groupId,
27
- seasonName: doc.seasonName,
27
+ seasonId: doc.seasonId,
28
28
  totalMatches: doc.totalMatches,
29
29
  totalGoals: doc.totalGoals,
30
30
  averageGoalsPerMatch: doc.averageGoalsPerMatch,
@@ -32,7 +32,7 @@ class MongoStatUserMatchHistoryRepository {
32
32
  };
33
33
  // Add season filter if not "All Seasons"
34
34
  if (filter.season && filter.season !== 'All Seasons') {
35
- query.seasonName = filter.season;
35
+ query.seasonId = filter.season;
36
36
  }
37
37
  // Count total matches
38
38
  const totalMatches = await this.model.countDocuments(query);
@@ -55,7 +55,7 @@ class MongoStatUserMatchHistoryRepository {
55
55
  matchup: doc.matchup,
56
56
  score: doc.score,
57
57
  date: doc.date,
58
- seasonName: doc.seasonName,
58
+ seasonId: doc.seasonId,
59
59
  createdAt: doc.createdAt,
60
60
  }));
61
61
  return {
@@ -93,7 +93,7 @@ class MongoStatUserMatchHistoryRepository {
93
93
  matchup: item.matchup,
94
94
  score: item.score,
95
95
  date: item.date,
96
- seasonName: item.seasonName,
96
+ seasonId: item.seasonId,
97
97
  createdAt: item.createdAt,
98
98
  });
99
99
  }
@@ -39,7 +39,7 @@ export interface StatEventMatch {
39
39
  }
40
40
  export interface StatEventHeader {
41
41
  status: 'Finished' | 'In Progress' | 'Upcoming';
42
- seasonName: string;
42
+ seasonId: string;
43
43
  groupName: string;
44
44
  eventName: string;
45
45
  date: Date;
@@ -3,7 +3,7 @@
3
3
  * Pre-aggregated group profile data for ballrush-api
4
4
  */
5
5
  export interface StatGroupProfileCurrentSeason {
6
- seasonName: string;
6
+ seasonId: string;
7
7
  status: 'in_progress' | 'completed';
8
8
  }
9
9
  export interface StatGroupProfile {
@@ -16,7 +16,7 @@ export interface StatGroupSeasonParticipant {
16
16
  }
17
17
  export interface StatGroupSeason {
18
18
  groupId: number;
19
- seasonName: string;
19
+ seasonId: string;
20
20
  totalMatches: number;
21
21
  totalGoals: number;
22
22
  averageGoalsPerMatch: number;
@@ -10,7 +10,7 @@ export interface StatUserMatchHistory {
10
10
  matchup: string;
11
11
  score: string;
12
12
  date: Date;
13
- seasonName: string;
13
+ seasonId: string;
14
14
  createdAt: Date;
15
15
  }
16
16
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ballrush-core",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",