ballrush-core 0.6.3 → 0.6.5

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ballrush-core
2
2
 
3
- ⚠️ **Note:** This library is for **personal use** in the Ballrush project.
3
+ ⚠️ **Note:** This library is for **personal use** in the Ballrush project.
4
4
 
5
5
  Shared core library for **Ballrush**.
6
6
  Includes **TypeScript types**, **domain entities**, **repository ports & Mongo implementations**, **Mongoose schema factories** (no models), and **utils**.
@@ -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
  }
@@ -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.3",
3
+ "version": "0.6.5",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",