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.
- package/dist/domain/achievement.d.ts +4 -0
- package/dist/domain/achievement.js +10 -2
- package/dist/mongo/schemas/achievement.schema.d.ts +1 -0
- package/dist/mongo/schemas/achievement.schema.js +4 -0
- 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/achievement.mapper.js +2 -0
- 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
|
@@ -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");
|
|
@@ -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
|
}
|
|
@@ -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
|
-
|
|
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
|
}
|