ballrush-core 0.4.3 → 0.5.1
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/index.d.ts +6 -0
- package/dist/mongo/index.js +6 -0
- package/dist/mongo/schemas/stat-group-activity-chart.schema.d.ts +27 -0
- package/dist/mongo/schemas/stat-group-activity-chart.schema.js +27 -0
- package/dist/mongo/schemas/stat-group-last-100-games.schema.d.ts +33 -0
- package/dist/mongo/schemas/stat-group-last-100-games.schema.js +31 -0
- package/dist/mongo/schemas/stat-group-profile.schema.d.ts +27 -0
- package/dist/mongo/schemas/stat-group-profile.schema.js +29 -0
- package/dist/mongo/schemas/stat-group-season.schema.d.ts +37 -0
- package/dist/mongo/schemas/stat-group-season.schema.js +39 -0
- package/dist/mongo/schemas/stat-user-match-history.schema.d.ts +24 -0
- package/dist/mongo/schemas/stat-user-match-history.schema.js +29 -0
- package/dist/mongo/schemas/stat-user-profile.schema.d.ts +51 -0
- package/dist/mongo/schemas/stat-user-profile.schema.js +48 -0
- package/dist/ports/index.d.ts +6 -0
- package/dist/ports/index.js +6 -0
- package/dist/ports/stat-group-activity-chart.repository.d.ts +14 -0
- package/dist/ports/stat-group-activity-chart.repository.js +2 -0
- package/dist/ports/stat-group-last-100-games.repository.d.ts +13 -0
- package/dist/ports/stat-group-last-100-games.repository.js +2 -0
- package/dist/ports/stat-group-profile.repository.d.ts +14 -0
- package/dist/ports/stat-group-profile.repository.js +2 -0
- package/dist/ports/stat-group-season.repository.d.ts +14 -0
- package/dist/ports/stat-group-season.repository.js +2 -0
- package/dist/ports/stat-user-match-history.repository.d.ts +19 -0
- package/dist/ports/stat-user-match-history.repository.js +2 -0
- package/dist/ports/stat-user-profile.repository.d.ts +20 -0
- package/dist/ports/stat-user-profile.repository.js +2 -0
- package/dist/repositories/index.d.ts +6 -0
- package/dist/repositories/index.js +6 -0
- package/dist/repositories/mongo/stat-group-activity-chart.repository.d.ts +13 -0
- package/dist/repositories/mongo/stat-group-activity-chart.repository.js +46 -0
- package/dist/repositories/mongo/stat-group-last-100-games.repository.d.ts +13 -0
- package/dist/repositories/mongo/stat-group-last-100-games.repository.js +49 -0
- package/dist/repositories/mongo/stat-group-profile.repository.d.ts +13 -0
- package/dist/repositories/mongo/stat-group-profile.repository.js +47 -0
- package/dist/repositories/mongo/stat-group-season.repository.d.ts +13 -0
- package/dist/repositories/mongo/stat-group-season.repository.js +54 -0
- package/dist/repositories/mongo/stat-user-match-history.repository.d.ts +14 -0
- package/dist/repositories/mongo/stat-user-match-history.repository.js +108 -0
- package/dist/repositories/mongo/stat-user-profile.repository.d.ts +14 -0
- package/dist/repositories/mongo/stat-user-profile.repository.js +105 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +6 -0
- package/dist/types/stat-group-activity-chart.types.d.ts +15 -0
- package/dist/types/stat-group-activity-chart.types.js +6 -0
- package/dist/types/stat-group-last-100-games.types.d.ts +21 -0
- package/dist/types/stat-group-last-100-games.types.js +6 -0
- package/dist/types/stat-group-profile.types.d.ts +19 -0
- package/dist/types/stat-group-profile.types.js +6 -0
- package/dist/types/stat-group-season.types.d.ts +25 -0
- package/dist/types/stat-group-season.types.js +6 -0
- package/dist/types/stat-user-match-history.types.d.ts +39 -0
- package/dist/types/stat-user-match-history.types.js +6 -0
- package/dist/types/stat-user-profile.types.d.ts +36 -0
- package/dist/types/stat-user-profile.types.js +6 -0
- package/package.json +1 -1
package/dist/mongo/index.d.ts
CHANGED
|
@@ -3,3 +3,9 @@ export * from "./schemas/event-template.schema";
|
|
|
3
3
|
export * from "./schemas/event.schema";
|
|
4
4
|
export * from "./schemas/group.schema";
|
|
5
5
|
export * from "./schemas/stat-group.schema";
|
|
6
|
+
export * from "./schemas/stat-group-profile.schema";
|
|
7
|
+
export * from "./schemas/stat-group-season.schema";
|
|
8
|
+
export * from "./schemas/stat-group-last-100-games.schema";
|
|
9
|
+
export * from "./schemas/stat-group-activity-chart.schema";
|
|
10
|
+
export * from "./schemas/stat-user-profile.schema";
|
|
11
|
+
export * from "./schemas/stat-user-match-history.schema";
|
package/dist/mongo/index.js
CHANGED
|
@@ -19,3 +19,9 @@ __exportStar(require("./schemas/event-template.schema"), exports);
|
|
|
19
19
|
__exportStar(require("./schemas/event.schema"), exports);
|
|
20
20
|
__exportStar(require("./schemas/group.schema"), exports);
|
|
21
21
|
__exportStar(require("./schemas/stat-group.schema"), exports);
|
|
22
|
+
__exportStar(require("./schemas/stat-group-profile.schema"), exports);
|
|
23
|
+
__exportStar(require("./schemas/stat-group-season.schema"), exports);
|
|
24
|
+
__exportStar(require("./schemas/stat-group-last-100-games.schema"), exports);
|
|
25
|
+
__exportStar(require("./schemas/stat-group-activity-chart.schema"), exports);
|
|
26
|
+
__exportStar(require("./schemas/stat-user-profile.schema"), exports);
|
|
27
|
+
__exportStar(require("./schemas/stat-user-match-history.schema"), exports);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Schema } from "mongoose";
|
|
2
|
+
/**
|
|
3
|
+
* Mongoose document interface for StatGroupActivityChart data point
|
|
4
|
+
*/
|
|
5
|
+
export interface StatGroupActivityDataPointDoc {
|
|
6
|
+
monthYear: string;
|
|
7
|
+
displayName: string;
|
|
8
|
+
matches: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Mongoose document interface for StatGroupActivityChart
|
|
12
|
+
*/
|
|
13
|
+
export interface StatGroupActivityChartDoc {
|
|
14
|
+
groupId: number;
|
|
15
|
+
timespan: 6 | 12;
|
|
16
|
+
data: StatGroupActivityDataPointDoc[];
|
|
17
|
+
updatedAt: Date;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Factory function to create StatGroupActivityChart schema
|
|
21
|
+
* Collection: stat_group_activity_charts
|
|
22
|
+
*/
|
|
23
|
+
export declare function createStatGroupActivityChartSchema(): Schema<StatGroupActivityChartDoc, import("mongoose").Model<StatGroupActivityChartDoc, any, any, any, import("mongoose").Document<unknown, any, StatGroupActivityChartDoc> & StatGroupActivityChartDoc & {
|
|
24
|
+
_id: import("mongoose").Types.ObjectId;
|
|
25
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, StatGroupActivityChartDoc, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<StatGroupActivityChartDoc>> & import("mongoose").FlatRecord<StatGroupActivityChartDoc> & {
|
|
26
|
+
_id: import("mongoose").Types.ObjectId;
|
|
27
|
+
}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createStatGroupActivityChartSchema = createStatGroupActivityChartSchema;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
/**
|
|
6
|
+
* Factory function to create StatGroupActivityChart schema
|
|
7
|
+
* Collection: stat_group_activity_charts
|
|
8
|
+
*/
|
|
9
|
+
function createStatGroupActivityChartSchema() {
|
|
10
|
+
const DataPointSchema = new mongoose_1.Schema({
|
|
11
|
+
monthYear: { type: String, required: true }, // Format: "2024-10"
|
|
12
|
+
displayName: { type: String, required: true }, // Format: "Oct 2024"
|
|
13
|
+
matches: { type: Number, required: true, min: 0, default: 0 },
|
|
14
|
+
}, { _id: false });
|
|
15
|
+
const StatGroupActivityChartSchema = new mongoose_1.Schema({
|
|
16
|
+
groupId: { type: Number, required: true, index: true },
|
|
17
|
+
timespan: { type: Number, enum: [6, 12], required: true },
|
|
18
|
+
data: { type: [DataPointSchema], default: [] },
|
|
19
|
+
updatedAt: { type: Date, default: Date.now },
|
|
20
|
+
}, {
|
|
21
|
+
collection: 'stat_group_activity_charts',
|
|
22
|
+
versionKey: false,
|
|
23
|
+
});
|
|
24
|
+
// Composite unique index for groupId + timespan
|
|
25
|
+
StatGroupActivityChartSchema.index({ groupId: 1, timespan: 1 }, { unique: true });
|
|
26
|
+
return StatGroupActivityChartSchema;
|
|
27
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Schema } from "mongoose";
|
|
2
|
+
/**
|
|
3
|
+
* Mongoose document interface for StatGroupLast100Games player
|
|
4
|
+
*/
|
|
5
|
+
export interface StatGroupLast100GamesPlayerDoc {
|
|
6
|
+
userId: number;
|
|
7
|
+
playerName: string;
|
|
8
|
+
skillRating: number;
|
|
9
|
+
games: number;
|
|
10
|
+
wins: number;
|
|
11
|
+
draws: number;
|
|
12
|
+
losses: number;
|
|
13
|
+
winPercentage: number;
|
|
14
|
+
achievementsCount: number;
|
|
15
|
+
score: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Mongoose document interface for StatGroupLast100Games
|
|
19
|
+
*/
|
|
20
|
+
export interface StatGroupLast100GamesDoc {
|
|
21
|
+
groupId: number;
|
|
22
|
+
players: StatGroupLast100GamesPlayerDoc[];
|
|
23
|
+
updatedAt: Date;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Factory function to create StatGroupLast100Games schema
|
|
27
|
+
* Collection: stat_group_last_100_games
|
|
28
|
+
*/
|
|
29
|
+
export declare function createStatGroupLast100GamesSchema(): Schema<StatGroupLast100GamesDoc, import("mongoose").Model<StatGroupLast100GamesDoc, any, any, any, import("mongoose").Document<unknown, any, StatGroupLast100GamesDoc> & StatGroupLast100GamesDoc & {
|
|
30
|
+
_id: import("mongoose").Types.ObjectId;
|
|
31
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, StatGroupLast100GamesDoc, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<StatGroupLast100GamesDoc>> & import("mongoose").FlatRecord<StatGroupLast100GamesDoc> & {
|
|
32
|
+
_id: import("mongoose").Types.ObjectId;
|
|
33
|
+
}>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createStatGroupLast100GamesSchema = createStatGroupLast100GamesSchema;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
/**
|
|
6
|
+
* Factory function to create StatGroupLast100Games schema
|
|
7
|
+
* Collection: stat_group_last_100_games
|
|
8
|
+
*/
|
|
9
|
+
function createStatGroupLast100GamesSchema() {
|
|
10
|
+
const PlayerSchema = new mongoose_1.Schema({
|
|
11
|
+
userId: { type: Number, required: true },
|
|
12
|
+
playerName: { type: String, required: true },
|
|
13
|
+
skillRating: { type: Number, required: true, min: 0, default: 0 },
|
|
14
|
+
games: { type: Number, required: true, min: 0, max: 100, default: 0 },
|
|
15
|
+
wins: { type: Number, required: true, min: 0, default: 0 },
|
|
16
|
+
draws: { type: Number, required: true, min: 0, default: 0 },
|
|
17
|
+
losses: { type: Number, required: true, min: 0, default: 0 },
|
|
18
|
+
winPercentage: { type: Number, required: true, min: 0, max: 100, default: 0 },
|
|
19
|
+
achievementsCount: { type: Number, required: true, min: 0, default: 0 },
|
|
20
|
+
score: { type: Number, required: true, min: 0, default: 0 },
|
|
21
|
+
}, { _id: false });
|
|
22
|
+
const StatGroupLast100GamesSchema = new mongoose_1.Schema({
|
|
23
|
+
groupId: { type: Number, required: true, unique: true, index: true },
|
|
24
|
+
players: { type: [PlayerSchema], default: [] },
|
|
25
|
+
updatedAt: { type: Date, default: Date.now },
|
|
26
|
+
}, {
|
|
27
|
+
collection: 'stat_group_last_100_games',
|
|
28
|
+
versionKey: false,
|
|
29
|
+
});
|
|
30
|
+
return StatGroupLast100GamesSchema;
|
|
31
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Schema } from "mongoose";
|
|
2
|
+
/**
|
|
3
|
+
* Mongoose document interface for StatGroupProfile
|
|
4
|
+
*/
|
|
5
|
+
export interface StatGroupProfileDoc {
|
|
6
|
+
groupId: number;
|
|
7
|
+
groupName: string;
|
|
8
|
+
establishedDate: Date;
|
|
9
|
+
totalMembers: number;
|
|
10
|
+
activePlayers: number;
|
|
11
|
+
totalGames: number;
|
|
12
|
+
averageSkillRating: number;
|
|
13
|
+
currentSeason: {
|
|
14
|
+
seasonName: string;
|
|
15
|
+
status: 'in_progress' | 'completed';
|
|
16
|
+
} | null;
|
|
17
|
+
updatedAt: Date;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Factory function to create StatGroupProfile schema
|
|
21
|
+
* Collection: stat_group_profiles
|
|
22
|
+
*/
|
|
23
|
+
export declare function createStatGroupProfileSchema(): Schema<StatGroupProfileDoc, import("mongoose").Model<StatGroupProfileDoc, any, any, any, import("mongoose").Document<unknown, any, StatGroupProfileDoc> & StatGroupProfileDoc & {
|
|
24
|
+
_id: import("mongoose").Types.ObjectId;
|
|
25
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, StatGroupProfileDoc, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<StatGroupProfileDoc>> & import("mongoose").FlatRecord<StatGroupProfileDoc> & {
|
|
26
|
+
_id: import("mongoose").Types.ObjectId;
|
|
27
|
+
}>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createStatGroupProfileSchema = createStatGroupProfileSchema;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
/**
|
|
6
|
+
* Factory function to create StatGroupProfile schema
|
|
7
|
+
* Collection: stat_group_profiles
|
|
8
|
+
*/
|
|
9
|
+
function createStatGroupProfileSchema() {
|
|
10
|
+
const CurrentSeasonSchema = new mongoose_1.Schema({
|
|
11
|
+
seasonName: { type: String, required: true },
|
|
12
|
+
status: { type: String, enum: ['in_progress', 'completed'], required: true },
|
|
13
|
+
}, { _id: false });
|
|
14
|
+
const StatGroupProfileSchema = new mongoose_1.Schema({
|
|
15
|
+
groupId: { type: Number, required: true, unique: true, index: true },
|
|
16
|
+
groupName: { type: String, required: true },
|
|
17
|
+
establishedDate: { type: Date, required: true },
|
|
18
|
+
totalMembers: { type: Number, required: true, min: 0, default: 0 },
|
|
19
|
+
activePlayers: { type: Number, required: true, min: 0, default: 0 },
|
|
20
|
+
totalGames: { type: Number, required: true, min: 0, default: 0 },
|
|
21
|
+
averageSkillRating: { type: Number, required: true, min: 0, default: 0 },
|
|
22
|
+
currentSeason: { type: CurrentSeasonSchema, default: null },
|
|
23
|
+
updatedAt: { type: Date, default: Date.now },
|
|
24
|
+
}, {
|
|
25
|
+
collection: 'stat_group_profiles',
|
|
26
|
+
versionKey: false,
|
|
27
|
+
});
|
|
28
|
+
return StatGroupProfileSchema;
|
|
29
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Schema } from "mongoose";
|
|
2
|
+
/**
|
|
3
|
+
* Mongoose document interface for StatGroupSeason participant
|
|
4
|
+
*/
|
|
5
|
+
export interface StatGroupSeasonParticipantDoc {
|
|
6
|
+
userId: number;
|
|
7
|
+
playerName: string;
|
|
8
|
+
achievementsCount: number;
|
|
9
|
+
games: number;
|
|
10
|
+
wins: number;
|
|
11
|
+
losses: number;
|
|
12
|
+
draws: number;
|
|
13
|
+
winPercentage: number;
|
|
14
|
+
skillRating: number;
|
|
15
|
+
score: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Mongoose document interface for StatGroupSeason
|
|
19
|
+
*/
|
|
20
|
+
export interface StatGroupSeasonDoc {
|
|
21
|
+
groupId: number;
|
|
22
|
+
seasonName: string;
|
|
23
|
+
participants: StatGroupSeasonParticipantDoc[];
|
|
24
|
+
startDate: Date;
|
|
25
|
+
endDate: Date | null;
|
|
26
|
+
status: 'in_progress' | 'completed';
|
|
27
|
+
updatedAt: Date;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Factory function to create StatGroupSeason schema
|
|
31
|
+
* Collection: stat_group_seasons
|
|
32
|
+
*/
|
|
33
|
+
export declare function createStatGroupSeasonSchema(): Schema<StatGroupSeasonDoc, import("mongoose").Model<StatGroupSeasonDoc, any, any, any, import("mongoose").Document<unknown, any, StatGroupSeasonDoc> & StatGroupSeasonDoc & {
|
|
34
|
+
_id: import("mongoose").Types.ObjectId;
|
|
35
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, StatGroupSeasonDoc, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<StatGroupSeasonDoc>> & import("mongoose").FlatRecord<StatGroupSeasonDoc> & {
|
|
36
|
+
_id: import("mongoose").Types.ObjectId;
|
|
37
|
+
}>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createStatGroupSeasonSchema = createStatGroupSeasonSchema;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
/**
|
|
6
|
+
* Factory function to create StatGroupSeason schema
|
|
7
|
+
* Collection: stat_group_seasons
|
|
8
|
+
*/
|
|
9
|
+
function createStatGroupSeasonSchema() {
|
|
10
|
+
const ParticipantSchema = new mongoose_1.Schema({
|
|
11
|
+
userId: { type: Number, required: true },
|
|
12
|
+
playerName: { type: String, required: true },
|
|
13
|
+
achievementsCount: { type: Number, required: true, min: 0, default: 0 },
|
|
14
|
+
games: { type: Number, required: true, min: 0, default: 0 },
|
|
15
|
+
wins: { type: Number, required: true, min: 0, default: 0 },
|
|
16
|
+
losses: { type: Number, required: true, min: 0, default: 0 },
|
|
17
|
+
draws: { type: Number, required: true, min: 0, default: 0 },
|
|
18
|
+
winPercentage: { type: Number, required: true, min: 0, max: 100, default: 0 },
|
|
19
|
+
skillRating: { type: Number, required: true, min: 0, default: 0 },
|
|
20
|
+
score: { type: Number, required: true, min: 0, default: 0 },
|
|
21
|
+
}, { _id: false });
|
|
22
|
+
const StatGroupSeasonSchema = new mongoose_1.Schema({
|
|
23
|
+
groupId: { type: Number, required: true, index: true },
|
|
24
|
+
seasonName: { type: String, required: true },
|
|
25
|
+
participants: { type: [ParticipantSchema], default: [] },
|
|
26
|
+
startDate: { type: Date, required: true },
|
|
27
|
+
endDate: { type: Date, default: null },
|
|
28
|
+
status: { type: String, enum: ['in_progress', 'completed'], required: true },
|
|
29
|
+
updatedAt: { type: Date, default: Date.now },
|
|
30
|
+
}, {
|
|
31
|
+
collection: 'stat_group_seasons',
|
|
32
|
+
versionKey: false,
|
|
33
|
+
});
|
|
34
|
+
// Composite unique index for groupId + seasonName
|
|
35
|
+
StatGroupSeasonSchema.index({ groupId: 1, seasonName: 1 }, { unique: true });
|
|
36
|
+
// Index for listing seasons by group (newest first will be done in query)
|
|
37
|
+
StatGroupSeasonSchema.index({ groupId: 1, updatedAt: -1 });
|
|
38
|
+
return StatGroupSeasonSchema;
|
|
39
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Schema } from "mongoose";
|
|
2
|
+
/**
|
|
3
|
+
* Mongoose document interface for StatUserMatchHistory
|
|
4
|
+
*/
|
|
5
|
+
export interface StatUserMatchHistoryDoc {
|
|
6
|
+
userId: number;
|
|
7
|
+
groupId: number;
|
|
8
|
+
eventId: number;
|
|
9
|
+
result: 'Win' | 'Loss' | 'Draw';
|
|
10
|
+
matchup: string;
|
|
11
|
+
score: string;
|
|
12
|
+
date: Date;
|
|
13
|
+
seasonName: string;
|
|
14
|
+
createdAt: Date;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Factory function to create StatUserMatchHistory schema
|
|
18
|
+
* Collection: stat_user_match_history
|
|
19
|
+
*/
|
|
20
|
+
export declare function createStatUserMatchHistorySchema(): Schema<StatUserMatchHistoryDoc, import("mongoose").Model<StatUserMatchHistoryDoc, any, any, any, import("mongoose").Document<unknown, any, StatUserMatchHistoryDoc> & StatUserMatchHistoryDoc & {
|
|
21
|
+
_id: import("mongoose").Types.ObjectId;
|
|
22
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, StatUserMatchHistoryDoc, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<StatUserMatchHistoryDoc>> & import("mongoose").FlatRecord<StatUserMatchHistoryDoc> & {
|
|
23
|
+
_id: import("mongoose").Types.ObjectId;
|
|
24
|
+
}>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createStatUserMatchHistorySchema = createStatUserMatchHistorySchema;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
/**
|
|
6
|
+
* Factory function to create StatUserMatchHistory schema
|
|
7
|
+
* Collection: stat_user_match_history
|
|
8
|
+
*/
|
|
9
|
+
function createStatUserMatchHistorySchema() {
|
|
10
|
+
const StatUserMatchHistorySchema = new mongoose_1.Schema({
|
|
11
|
+
userId: { type: Number, required: true, index: true },
|
|
12
|
+
groupId: { type: Number, required: true, index: true },
|
|
13
|
+
eventId: { type: Number, required: true },
|
|
14
|
+
result: { type: String, enum: ['Win', 'Loss', 'Draw'], required: true },
|
|
15
|
+
matchup: { type: String, required: true },
|
|
16
|
+
score: { type: String, required: true },
|
|
17
|
+
date: { type: Date, required: true },
|
|
18
|
+
seasonName: { type: String, required: true },
|
|
19
|
+
createdAt: { type: Date, default: Date.now },
|
|
20
|
+
}, {
|
|
21
|
+
collection: 'stat_user_match_history',
|
|
22
|
+
versionKey: false,
|
|
23
|
+
});
|
|
24
|
+
// Compound index for efficient queries (userId + groupId + date DESC)
|
|
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 });
|
|
28
|
+
return StatUserMatchHistorySchema;
|
|
29
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Schema } from "mongoose";
|
|
2
|
+
/**
|
|
3
|
+
* Mongoose sub-schema for SkillHistoryPoint
|
|
4
|
+
*/
|
|
5
|
+
export interface SkillHistoryPointDoc {
|
|
6
|
+
date: Date;
|
|
7
|
+
earnedRating: number | null;
|
|
8
|
+
manualAdjustment: number | null;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Mongoose sub-schema for ProfileAchievement
|
|
12
|
+
*/
|
|
13
|
+
export interface ProfileAchievementDoc {
|
|
14
|
+
icon: string;
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
count: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Mongoose document interface for StatUserProfile
|
|
21
|
+
*/
|
|
22
|
+
export interface StatUserProfileDoc {
|
|
23
|
+
userId: number;
|
|
24
|
+
groupId: number;
|
|
25
|
+
username: string;
|
|
26
|
+
fullName: string;
|
|
27
|
+
avatarUrl: string;
|
|
28
|
+
position: string;
|
|
29
|
+
currentSkillRating: number;
|
|
30
|
+
groupName: string;
|
|
31
|
+
gamesCount: number;
|
|
32
|
+
wins: number;
|
|
33
|
+
losses: number;
|
|
34
|
+
draws: number;
|
|
35
|
+
winPercentage: number;
|
|
36
|
+
goalsFor: number;
|
|
37
|
+
goalsAgainst: number;
|
|
38
|
+
eventsCount: number;
|
|
39
|
+
skillHistory: SkillHistoryPointDoc[];
|
|
40
|
+
achievements: ProfileAchievementDoc[];
|
|
41
|
+
lastUpdated: Date;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Factory function to create StatUserProfile schema
|
|
45
|
+
* Collection: stat_user_profile
|
|
46
|
+
*/
|
|
47
|
+
export declare function createStatUserProfileSchema(): Schema<StatUserProfileDoc, import("mongoose").Model<StatUserProfileDoc, any, any, any, import("mongoose").Document<unknown, any, StatUserProfileDoc> & StatUserProfileDoc & {
|
|
48
|
+
_id: import("mongoose").Types.ObjectId;
|
|
49
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, StatUserProfileDoc, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<StatUserProfileDoc>> & import("mongoose").FlatRecord<StatUserProfileDoc> & {
|
|
50
|
+
_id: import("mongoose").Types.ObjectId;
|
|
51
|
+
}>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createStatUserProfileSchema = createStatUserProfileSchema;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
/**
|
|
6
|
+
* Factory function to create StatUserProfile schema
|
|
7
|
+
* Collection: stat_user_profile
|
|
8
|
+
*/
|
|
9
|
+
function createStatUserProfileSchema() {
|
|
10
|
+
const SkillHistoryPointSchema = new mongoose_1.Schema({
|
|
11
|
+
date: { type: Date, required: true },
|
|
12
|
+
earnedRating: { type: Number, default: null },
|
|
13
|
+
manualAdjustment: { type: Number, default: null },
|
|
14
|
+
}, { _id: false });
|
|
15
|
+
const ProfileAchievementSchema = new mongoose_1.Schema({
|
|
16
|
+
icon: { type: String, required: true },
|
|
17
|
+
name: { type: String, required: true },
|
|
18
|
+
description: { type: String, required: true },
|
|
19
|
+
count: { type: Number, required: true, min: 0, default: 0 },
|
|
20
|
+
}, { _id: false });
|
|
21
|
+
const StatUserProfileSchema = new mongoose_1.Schema({
|
|
22
|
+
userId: { type: Number, required: true, index: true },
|
|
23
|
+
groupId: { type: Number, required: true, index: true },
|
|
24
|
+
username: { type: String, required: true },
|
|
25
|
+
fullName: { type: String, required: true },
|
|
26
|
+
avatarUrl: { type: String, default: '' },
|
|
27
|
+
position: { type: String, default: '' },
|
|
28
|
+
currentSkillRating: { type: Number, required: true, default: 0 },
|
|
29
|
+
groupName: { type: String, required: true },
|
|
30
|
+
gamesCount: { type: Number, required: true, min: 0, default: 0 },
|
|
31
|
+
wins: { type: Number, required: true, min: 0, default: 0 },
|
|
32
|
+
losses: { type: Number, required: true, min: 0, default: 0 },
|
|
33
|
+
draws: { type: Number, required: true, min: 0, default: 0 },
|
|
34
|
+
winPercentage: { type: Number, required: true, min: 0, max: 100, default: 0 },
|
|
35
|
+
goalsFor: { type: Number, required: true, min: 0, default: 0 },
|
|
36
|
+
goalsAgainst: { type: Number, required: true, min: 0, default: 0 },
|
|
37
|
+
eventsCount: { type: Number, required: true, min: 0, default: 0 },
|
|
38
|
+
skillHistory: { type: [SkillHistoryPointSchema], default: [] },
|
|
39
|
+
achievements: { type: [ProfileAchievementSchema], default: [] },
|
|
40
|
+
lastUpdated: { type: Date, default: Date.now },
|
|
41
|
+
}, {
|
|
42
|
+
collection: 'stat_user_profile',
|
|
43
|
+
versionKey: false,
|
|
44
|
+
});
|
|
45
|
+
// Create compound unique index for userId + groupId
|
|
46
|
+
StatUserProfileSchema.index({ userId: 1, groupId: 1 }, { unique: true });
|
|
47
|
+
return StatUserProfileSchema;
|
|
48
|
+
}
|
package/dist/ports/index.d.ts
CHANGED
|
@@ -3,3 +3,9 @@ export * from "./groups.repository";
|
|
|
3
3
|
export * from "./events.repository";
|
|
4
4
|
export * from "./event-templates.repository";
|
|
5
5
|
export * from "./stat-group.repository";
|
|
6
|
+
export * from "./stat-group-profile.repository";
|
|
7
|
+
export * from "./stat-group-season.repository";
|
|
8
|
+
export * from "./stat-group-last-100-games.repository";
|
|
9
|
+
export * from "./stat-group-activity-chart.repository";
|
|
10
|
+
export * from "./stat-user-profile.repository";
|
|
11
|
+
export * from "./stat-user-match-history.repository";
|
package/dist/ports/index.js
CHANGED
|
@@ -19,3 +19,9 @@ __exportStar(require("./groups.repository"), exports);
|
|
|
19
19
|
__exportStar(require("./events.repository"), exports);
|
|
20
20
|
__exportStar(require("./event-templates.repository"), exports);
|
|
21
21
|
__exportStar(require("./stat-group.repository"), exports);
|
|
22
|
+
__exportStar(require("./stat-group-profile.repository"), exports);
|
|
23
|
+
__exportStar(require("./stat-group-season.repository"), exports);
|
|
24
|
+
__exportStar(require("./stat-group-last-100-games.repository"), exports);
|
|
25
|
+
__exportStar(require("./stat-group-activity-chart.repository"), exports);
|
|
26
|
+
__exportStar(require("./stat-user-profile.repository"), exports);
|
|
27
|
+
__exportStar(require("./stat-user-match-history.repository"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StatGroupActivityChart } from "../types/stat-group-activity-chart.types";
|
|
2
|
+
/**
|
|
3
|
+
* Repository interface for StatGroupActivityChart
|
|
4
|
+
* Provides pre-aggregated time-series data for the group activity chart
|
|
5
|
+
*/
|
|
6
|
+
export interface StatGroupActivityChartRepository {
|
|
7
|
+
/**
|
|
8
|
+
* Finds activity chart data for a group within a timespan
|
|
9
|
+
* @param groupId - The group ID
|
|
10
|
+
* @param months - Number of months to look back (6 or 12)
|
|
11
|
+
* @returns Array of monthly activity data points
|
|
12
|
+
*/
|
|
13
|
+
findByGroupId(groupId: number, months: 6 | 12): Promise<StatGroupActivityChart | null>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StatGroupLast100Games } from "../types/stat-group-last-100-games.types";
|
|
2
|
+
/**
|
|
3
|
+
* Repository interface for StatGroupLast100Games
|
|
4
|
+
* Provides enriched statistics for players' last 100 games in a group
|
|
5
|
+
*/
|
|
6
|
+
export interface StatGroupLast100GamesRepository {
|
|
7
|
+
/**
|
|
8
|
+
* Finds enriched last 100 games statistics for all players in a group
|
|
9
|
+
* @param groupId - The group ID
|
|
10
|
+
* @returns Array of enriched statistics pre-sorted by score (descending)
|
|
11
|
+
*/
|
|
12
|
+
findByGroupId(groupId: number): Promise<StatGroupLast100Games | null>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StatGroupProfile } from "../types/stat-group-profile.types";
|
|
2
|
+
/**
|
|
3
|
+
* Repository interface for StatGroupProfile
|
|
4
|
+
* Provides pre-aggregated group profile data including header info,
|
|
5
|
+
* current season, and aggregate statistics
|
|
6
|
+
*/
|
|
7
|
+
export interface StatGroupProfileRepository {
|
|
8
|
+
/**
|
|
9
|
+
* Finds pre-aggregated group profile data by group ID
|
|
10
|
+
* @param groupId - The group ID
|
|
11
|
+
* @returns Group profile data or null if not found
|
|
12
|
+
*/
|
|
13
|
+
findByGroupId(groupId: number): Promise<StatGroupProfile | null>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StatGroupSeason } from "../types/stat-group-season.types";
|
|
2
|
+
/**
|
|
3
|
+
* Repository interface for StatGroupSeason
|
|
4
|
+
* Provides pre-aggregated season statistics including participant rankings
|
|
5
|
+
* and performance data
|
|
6
|
+
*/
|
|
7
|
+
export interface StatGroupSeasonRepository {
|
|
8
|
+
/**
|
|
9
|
+
* Finds all season statistics for a group
|
|
10
|
+
* @param groupId - The group ID
|
|
11
|
+
* @returns Array of season statistics ordered by season (newest first)
|
|
12
|
+
*/
|
|
13
|
+
findByGroupId(groupId: number): Promise<StatGroupSeason[]>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { StatUserMatchHistory, MatchHistoryFilter, MatchHistoryOptions, MatchHistoryResult } from "../types/stat-user-match-history.types";
|
|
2
|
+
/**
|
|
3
|
+
* Repository interface for StatUserMatchHistory
|
|
4
|
+
* Provides paginated and filterable match history data
|
|
5
|
+
*/
|
|
6
|
+
export interface StatUserMatchHistoryRepository {
|
|
7
|
+
/**
|
|
8
|
+
* Find paginated match history for a user in a group
|
|
9
|
+
* @param filter - User ID, group ID, and optional season filter
|
|
10
|
+
* @param options - Pagination options
|
|
11
|
+
* @returns Paginated match history with metadata
|
|
12
|
+
*/
|
|
13
|
+
find(filter: MatchHistoryFilter, options: MatchHistoryOptions): Promise<MatchHistoryResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Create a new match history item
|
|
16
|
+
* @param item - Match history item to save
|
|
17
|
+
*/
|
|
18
|
+
create(item: StatUserMatchHistory): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StatUserProfile } from "../types/stat-user-profile.types";
|
|
2
|
+
/**
|
|
3
|
+
* Repository interface for StatUserProfile
|
|
4
|
+
* Provides pre-aggregated user profile data including basic info,
|
|
5
|
+
* statistics, skill history, and achievements
|
|
6
|
+
*/
|
|
7
|
+
export interface StatUserProfileRepository {
|
|
8
|
+
/**
|
|
9
|
+
* Find user profile data for a specific user in a specific group
|
|
10
|
+
* @param userId - User ID
|
|
11
|
+
* @param groupId - Group ID
|
|
12
|
+
* @returns User profile data or null if not found
|
|
13
|
+
*/
|
|
14
|
+
findByUserAndGroup(userId: number, groupId: number): Promise<StatUserProfile | null>;
|
|
15
|
+
/**
|
|
16
|
+
* Create or update user profile data
|
|
17
|
+
* @param profile - User profile data to save
|
|
18
|
+
*/
|
|
19
|
+
save(profile: StatUserProfile): Promise<void>;
|
|
20
|
+
}
|
|
@@ -3,3 +3,9 @@ export * from "./mongo/group.repository";
|
|
|
3
3
|
export * from "./mongo/event.repository";
|
|
4
4
|
export * from "./mongo/event-template.repository";
|
|
5
5
|
export * from "./mongo/stat-group.repository";
|
|
6
|
+
export * from "./mongo/stat-group-profile.repository";
|
|
7
|
+
export * from "./mongo/stat-group-season.repository";
|
|
8
|
+
export * from "./mongo/stat-group-last-100-games.repository";
|
|
9
|
+
export * from "./mongo/stat-group-activity-chart.repository";
|
|
10
|
+
export * from "./mongo/stat-user-profile.repository";
|
|
11
|
+
export * from "./mongo/stat-user-match-history.repository";
|
|
@@ -19,3 +19,9 @@ __exportStar(require("./mongo/group.repository"), exports);
|
|
|
19
19
|
__exportStar(require("./mongo/event.repository"), exports);
|
|
20
20
|
__exportStar(require("./mongo/event-template.repository"), exports);
|
|
21
21
|
__exportStar(require("./mongo/stat-group.repository"), exports);
|
|
22
|
+
__exportStar(require("./mongo/stat-group-profile.repository"), exports);
|
|
23
|
+
__exportStar(require("./mongo/stat-group-season.repository"), exports);
|
|
24
|
+
__exportStar(require("./mongo/stat-group-last-100-games.repository"), exports);
|
|
25
|
+
__exportStar(require("./mongo/stat-group-activity-chart.repository"), exports);
|
|
26
|
+
__exportStar(require("./mongo/stat-user-profile.repository"), exports);
|
|
27
|
+
__exportStar(require("./mongo/stat-user-match-history.repository"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Model } from "mongoose";
|
|
2
|
+
import type { StatGroupActivityChartRepository } from "../../ports/stat-group-activity-chart.repository";
|
|
3
|
+
import type { StatGroupActivityChartDoc } from "../../mongo/schemas/stat-group-activity-chart.schema";
|
|
4
|
+
import type { StatGroupActivityChart } from "../../types/stat-group-activity-chart.types";
|
|
5
|
+
/**
|
|
6
|
+
* MongoDB implementation of StatGroupActivityChartRepository
|
|
7
|
+
* Provides read-only access to pre-aggregated activity chart data
|
|
8
|
+
*/
|
|
9
|
+
export declare class MongoStatGroupActivityChartRepository implements StatGroupActivityChartRepository {
|
|
10
|
+
private readonly model;
|
|
11
|
+
constructor(model: Model<StatGroupActivityChartDoc>);
|
|
12
|
+
findByGroupId(groupId: number, months: 6 | 12): Promise<StatGroupActivityChart | null>;
|
|
13
|
+
}
|