This commit is contained in:
dahyeon committed 2026-04-26 03:33:24 -07:00
1 parent 6d62de4ec4
commit 285f72b3ee
16 files changed
+2095 -136

No files matched your search

+72 -7
View File
@@ -8,6 +8,15 @@ import { ModelDefinition } from './types';
export type Position = 'TOP' | 'JGL' | 'MID' | 'ADC' | 'SUP';
export const POSITIONS: Position[] = ['TOP', 'JGL', 'MID', 'ADC', 'SUP'];
export type RiotLane = 'TOP' | 'JUNGLE' | 'MIDDLE' | 'BOTTOM' | 'UTILITY';
export const RIOT_LANES: RiotLane[] = [
'TOP',
'JUNGLE',
'MIDDLE',
'BOTTOM',
'UTILITY',
];
export type MatchStatus =
| 'recruiting'
| 'team-built'
@@ -112,7 +121,7 @@ export interface ChampionMasteryEntry {
nextSeasonMilestone?: Record<string, unknown>;
}
export interface RiotRecentStatsSummary {
export interface RiotLaneStats {
games: number;
wins: number;
losses: number;
@@ -120,9 +129,34 @@ export interface RiotRecentStatsSummary {
avgDeaths: number;
avgAssists: number;
avgCs: number;
mostPlayedChampionIds: string[];
// 필드 추가가 잦을 수 있어 확장용 추가 메트릭 영역 허용
extras?: Record<string, unknown>;
avgCsPerMin: number;
mostPlayedChampionIds: number[];
}
export interface RiotRecentStatsSummary {
overall: RiotLaneStats;
byLane: Partial<Record<RiotLane, RiotLaneStats>>;
}
export function createEmptyRiotLaneStats(): RiotLaneStats {
return {
games: 0,
wins: 0,
losses: 0,
avgKills: 0,
avgDeaths: 0,
avgAssists: 0,
avgCs: 0,
avgCsPerMin: 0,
mostPlayedChampionIds: [],
};
}
export function createEmptyRiotRecentStatsSummary(): RiotRecentStatsSummary {
return {
overall: createEmptyRiotLaneStats(),
byLane: {},
};
}
export interface RiotAccount extends MongooseTimestamps {
@@ -177,6 +211,7 @@ export interface Community extends MongooseTimestamps {
dakaoProjectId?: mongoose.Types.ObjectId;
riotPlatform?: RiotPlatformRoute;
riotRegion?: RiotRegionalRoute;
seasonStartedAt?: Date;
}
export type CommunityDocument = HydratedDocument<Community>;
@@ -370,7 +405,7 @@ const ChampionMasteryEntrySubSchema = new Schema<ChampionMasteryEntry>(
{ _id: false },
);
const RiotRecentStatsSummarySubSchema = new Schema<RiotRecentStatsSummary>(
const RiotLaneStatsSubSchema = new Schema<RiotLaneStats>(
{
games: { type: Number, required: true, default: 0 },
wins: { type: Number, required: true, default: 0 },
@@ -379,8 +414,37 @@ const RiotRecentStatsSummarySubSchema = new Schema<RiotRecentStatsSummary>(
avgDeaths: { type: Number, required: true, default: 0 },
avgAssists: { type: Number, required: true, default: 0 },
avgCs: { type: Number, required: true, default: 0 },
mostPlayedChampionIds: { type: [String], required: true, default: [] },
extras: { type: Schema.Types.Mixed, required: false, default: {} },
avgCsPerMin: { type: Number, required: true, default: 0 },
mostPlayedChampionIds: { type: [Number], required: true, default: [] },
},
{ _id: false },
);
const RiotRecentStatsByLaneSubSchema = new Schema<
Partial<Record<RiotLane, RiotLaneStats>>
>(
{
TOP: { type: RiotLaneStatsSubSchema, required: false },
JUNGLE: { type: RiotLaneStatsSubSchema, required: false },
MIDDLE: { type: RiotLaneStatsSubSchema, required: false },
BOTTOM: { type: RiotLaneStatsSubSchema, required: false },
UTILITY: { type: RiotLaneStatsSubSchema, required: false },
},
{ _id: false },
);
const RiotRecentStatsSummarySubSchema = new Schema<RiotRecentStatsSummary>(
{
overall: {
type: RiotLaneStatsSubSchema,
required: true,
default: createEmptyRiotLaneStats,
},
byLane: {
type: RiotRecentStatsByLaneSubSchema,
required: true,
default: () => ({}),
},
},
{ _id: false },
);
@@ -453,6 +517,7 @@ export const CommunitySchema = new Schema<Community>(
dakaoProjectId: { type: Schema.Types.ObjectId },
riotPlatform: { type: String },
riotRegion: { type: String },
seasonStartedAt: { type: Date },
},
{
timestamps: true,