ballrush-core 0.6.4 → 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/dist/mongo/schemas/stat-event.schema.d.ts +1 -1
- package/dist/mongo/schemas/stat-event.schema.js +1 -1
- package/dist/mongo/schemas/stat-group-profile.schema.d.ts +1 -1
- package/dist/mongo/schemas/stat-group-profile.schema.js +1 -1
- package/dist/mongo/schemas/stat-group-season.schema.d.ts +1 -1
- package/dist/mongo/schemas/stat-group-season.schema.js +3 -3
- package/dist/mongo/schemas/stat-user-match-history.schema.d.ts +1 -1
- package/dist/mongo/schemas/stat-user-match-history.schema.js +3 -3
- package/dist/repositories/mongo/stat-event.repository.js +1 -1
- package/dist/repositories/mongo/stat-group-profile.repository.js +1 -1
- package/dist/repositories/mongo/stat-group-season.repository.js +1 -1
- package/dist/repositories/mongo/stat-user-match-history.repository.js +3 -3
- package/dist/types/stat-event.types.d.ts +1 -1
- package/dist/types/stat-group-profile.types.d.ts +1 -1
- package/dist/types/stat-group-season.types.d.ts +1 -1
- package/dist/types/stat-user-match-history.types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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 },
|
|
@@ -8,7 +8,7 @@ const mongoose_1 = require("mongoose");
|
|
|
8
8
|
*/
|
|
9
9
|
function createStatGroupProfileSchema() {
|
|
10
10
|
const CurrentSeasonSchema = new mongoose_1.Schema({
|
|
11
|
-
|
|
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({
|
|
@@ -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
|
-
|
|
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 +
|
|
40
|
-
StatGroupSeasonSchema.index({ groupId: 1,
|
|
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;
|
|
@@ -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
|
-
|
|
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 +
|
|
27
|
-
StatUserMatchHistorySchema.index({ userId: 1, groupId: 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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
96
|
+
seasonId: item.seasonId,
|
|
97
97
|
createdAt: item.createdAt,
|
|
98
98
|
});
|
|
99
99
|
}
|