.
This commit is contained in:
1 parent
5af2c80cd1
commit
f7ee34da4f
78 files changed
+9016
-150
No files matched your search
+138
-20
@@ -81,16 +81,54 @@ type SeedPlayer = {
|
||||
wins: number;
|
||||
losses: number;
|
||||
};
|
||||
masteries: ChampionMasteryEntry[];
|
||||
masteries: SeedChampionMastery[];
|
||||
recentStatsSummary: RiotRecentStatsSummary;
|
||||
};
|
||||
|
||||
type SeedChampionMastery = {
|
||||
championId: string;
|
||||
championName?: string;
|
||||
level: number;
|
||||
points: number;
|
||||
};
|
||||
|
||||
const DEV_COMMUNITY_NAME = '[DEV] Lolympus Test Community';
|
||||
const DEV_COMMUNITY_DESCRIPTION =
|
||||
'Frontend/Backend 통합 검증용으로 생성된 개발 커뮤니티입니다.';
|
||||
|
||||
const NOW = new Date();
|
||||
|
||||
const CHAMPION_IDS: Record<string, number> = {
|
||||
Ahri: 103,
|
||||
Ashe: 22,
|
||||
Camille: 164,
|
||||
Ezreal: 81,
|
||||
Gwen: 887,
|
||||
Hwei: 910,
|
||||
JarvanIV: 59,
|
||||
Jax: 24,
|
||||
Jinx: 222,
|
||||
KaiSa: 145,
|
||||
LeeSin: 64,
|
||||
Nami: 267,
|
||||
Nasus: 75,
|
||||
Nautilus: 111,
|
||||
Nidalee: 76,
|
||||
Orianna: 61,
|
||||
Rakan: 497,
|
||||
Rengar: 107,
|
||||
Sona: 37,
|
||||
Syndra: 134,
|
||||
Taliyah: 163,
|
||||
Thresh: 412,
|
||||
Viego: 234,
|
||||
Viktor: 112,
|
||||
Xayah: 498,
|
||||
Yorick: 83,
|
||||
Yuumi: 350,
|
||||
Zeri: 221,
|
||||
};
|
||||
|
||||
const PLAYER_SEEDS: SeedPlayer[] = [
|
||||
{
|
||||
key: 'priri',
|
||||
@@ -115,9 +153,19 @@ const PLAYER_SEEDS: SeedPlayer[] = [
|
||||
losses: 22,
|
||||
},
|
||||
masteries: [
|
||||
{ championId: 'Syndra', championName: '신드라', level: 7, points: 124300 },
|
||||
{
|
||||
championId: 'Syndra',
|
||||
championName: '신드라',
|
||||
level: 7,
|
||||
points: 124300,
|
||||
},
|
||||
{ championId: 'Ahri', championName: '아리', level: 7, points: 98200 },
|
||||
{ championId: 'Orianna', championName: '오리아나', level: 6, points: 63400 },
|
||||
{
|
||||
championId: 'Orianna',
|
||||
championName: '오리아나',
|
||||
level: 6,
|
||||
points: 63400,
|
||||
},
|
||||
],
|
||||
recentStatsSummary: {
|
||||
games: 24,
|
||||
@@ -155,7 +203,12 @@ const PLAYER_SEEDS: SeedPlayer[] = [
|
||||
masteries: [
|
||||
{ championId: 'Viego', championName: '비에고', level: 7, points: 138200 },
|
||||
{ championId: 'LeeSin', championName: '리신', level: 6, points: 88700 },
|
||||
{ championId: 'Nidalee', championName: '니달리', level: 6, points: 64100 },
|
||||
{
|
||||
championId: 'Nidalee',
|
||||
championName: '니달리',
|
||||
level: 6,
|
||||
points: 64100,
|
||||
},
|
||||
],
|
||||
recentStatsSummary: {
|
||||
games: 28,
|
||||
@@ -229,8 +282,18 @@ const PLAYER_SEEDS: SeedPlayer[] = [
|
||||
losses: 11,
|
||||
},
|
||||
masteries: [
|
||||
{ championId: 'Thresh', championName: '쓰레쉬', level: 7, points: 187300 },
|
||||
{ championId: 'Nautilus', championName: '노틸러스', level: 7, points: 144800 },
|
||||
{
|
||||
championId: 'Thresh',
|
||||
championName: '쓰레쉬',
|
||||
level: 7,
|
||||
points: 187300,
|
||||
},
|
||||
{
|
||||
championId: 'Nautilus',
|
||||
championName: '노틸러스',
|
||||
level: 7,
|
||||
points: 144800,
|
||||
},
|
||||
{ championId: 'Rakan', championName: '라칸', level: 6, points: 65300 },
|
||||
],
|
||||
recentStatsSummary: {
|
||||
@@ -269,7 +332,12 @@ const PLAYER_SEEDS: SeedPlayer[] = [
|
||||
masteries: [
|
||||
{ championId: 'Jinx', championName: '징크스', level: 7, points: 166100 },
|
||||
{ championId: 'KaiSa', championName: '카이사', level: 7, points: 139400 },
|
||||
{ championId: 'Ezreal', championName: '이즈리얼', level: 6, points: 90100 },
|
||||
{
|
||||
championId: 'Ezreal',
|
||||
championName: '이즈리얼',
|
||||
level: 6,
|
||||
points: 90100,
|
||||
},
|
||||
],
|
||||
recentStatsSummary: {
|
||||
games: 29,
|
||||
@@ -305,9 +373,19 @@ const PLAYER_SEEDS: SeedPlayer[] = [
|
||||
losses: 8,
|
||||
},
|
||||
masteries: [
|
||||
{ championId: 'Viktor', championName: '빅토르', level: 7, points: 172900 },
|
||||
{
|
||||
championId: 'Viktor',
|
||||
championName: '빅토르',
|
||||
level: 7,
|
||||
points: 172900,
|
||||
},
|
||||
{ championId: 'Hwei', championName: '흐웨이', level: 6, points: 94400 },
|
||||
{ championId: 'Taliyah', championName: '탈리야', level: 6, points: 55300 },
|
||||
{
|
||||
championId: 'Taliyah',
|
||||
championName: '탈리야',
|
||||
level: 6,
|
||||
points: 55300,
|
||||
},
|
||||
],
|
||||
recentStatsSummary: {
|
||||
games: 25,
|
||||
@@ -474,7 +552,10 @@ const PLAYER_SEEDS: SeedPlayer[] = [
|
||||
},
|
||||
];
|
||||
|
||||
function createPreferences(main: Position, sub: Position): PositionPreference[] {
|
||||
function createPreferences(
|
||||
main: Position,
|
||||
sub: Position,
|
||||
): PositionPreference[] {
|
||||
const rest = (['TOP', 'JGL', 'MID', 'ADC', 'SUP'] as Position[]).filter(
|
||||
(position) => position !== main && position !== sub,
|
||||
);
|
||||
@@ -490,6 +571,7 @@ function createPreferences(main: Position, sub: Position): PositionPreference[]
|
||||
}
|
||||
|
||||
function createTier(
|
||||
puuid: string,
|
||||
queueType: string,
|
||||
tier: string,
|
||||
rank: string,
|
||||
@@ -498,9 +580,11 @@ function createTier(
|
||||
losses: number,
|
||||
): TierInfo {
|
||||
return {
|
||||
leagueId: `dev-${puuid}-${queueType}`,
|
||||
queueType,
|
||||
tier,
|
||||
rank: rank || 'I',
|
||||
puuid,
|
||||
leaguePoints,
|
||||
wins,
|
||||
losses,
|
||||
@@ -513,8 +597,10 @@ function selectPrimaryTier(tiers: TierInfo[]) {
|
||||
}
|
||||
|
||||
function createRiotAccount(player: SeedPlayer) {
|
||||
const puuid = `dev-seed-${player.key}-puuid`;
|
||||
const tiers = [
|
||||
createTier(
|
||||
puuid,
|
||||
'RANKED_SOLO_5x5',
|
||||
player.tier.tier,
|
||||
player.tier.rank,
|
||||
@@ -527,6 +613,7 @@ function createRiotAccount(player: SeedPlayer) {
|
||||
if (player.flex) {
|
||||
tiers.push(
|
||||
createTier(
|
||||
puuid,
|
||||
'RANKED_FLEX_SR',
|
||||
player.flex.tier,
|
||||
player.flex.rank,
|
||||
@@ -538,7 +625,7 @@ function createRiotAccount(player: SeedPlayer) {
|
||||
}
|
||||
|
||||
return {
|
||||
puuid: `dev-seed-${player.key}-puuid`,
|
||||
puuid,
|
||||
gameName: player.gameName,
|
||||
tagLine: player.tagLine,
|
||||
profileIconId: player.profileIconId,
|
||||
@@ -550,7 +637,7 @@ function createRiotAccount(player: SeedPlayer) {
|
||||
matchIds: [],
|
||||
recentStatsSummary: player.recentStatsSummary,
|
||||
recentStatsFetchedAt: NOW,
|
||||
championMasteries: player.masteries,
|
||||
championMasteries: createChampionMasteries(puuid, player.masteries),
|
||||
championMasteriesFetchedAt: NOW,
|
||||
championRecords: {},
|
||||
championRecordsFetchedAt: NOW,
|
||||
@@ -559,16 +646,21 @@ function createRiotAccount(player: SeedPlayer) {
|
||||
};
|
||||
}
|
||||
|
||||
function createStaffRiotAccount(key: string, gameName: string, tagLine: string) {
|
||||
function createStaffRiotAccount(
|
||||
key: string,
|
||||
gameName: string,
|
||||
tagLine: string,
|
||||
) {
|
||||
const puuid = `dev-seed-${key}-puuid`;
|
||||
return {
|
||||
puuid: `dev-seed-${key}-puuid`,
|
||||
puuid,
|
||||
gameName,
|
||||
tagLine,
|
||||
profileIconId: 29,
|
||||
revisionDate: Date.now(),
|
||||
summonerLevel: 120,
|
||||
isPrimary: true,
|
||||
tiers: [createTier('RANKED_SOLO_5x5', 'GOLD', 'I', 75, 24, 19)],
|
||||
tiers: [createTier(puuid, 'RANKED_SOLO_5x5', 'GOLD', 'I', 75, 24, 19)],
|
||||
tierHistory: [],
|
||||
matchIds: [],
|
||||
recentStatsSummary: {
|
||||
@@ -582,10 +674,20 @@ function createStaffRiotAccount(key: string, gameName: string, tagLine: string)
|
||||
mostPlayedChampionIds: ['Orianna', 'JarvanIV'],
|
||||
},
|
||||
recentStatsFetchedAt: NOW,
|
||||
championMasteries: [
|
||||
{ championId: 'Orianna', championName: '오리아나', level: 5, points: 18300 },
|
||||
{ championId: 'JarvanIV', championName: '자르반 4세', level: 5, points: 12600 },
|
||||
],
|
||||
championMasteries: createChampionMasteries(puuid, [
|
||||
{
|
||||
championId: 'Orianna',
|
||||
championName: '오리아나',
|
||||
level: 5,
|
||||
points: 18300,
|
||||
},
|
||||
{
|
||||
championId: 'JarvanIV',
|
||||
championName: '자르반 4세',
|
||||
level: 5,
|
||||
points: 12600,
|
||||
},
|
||||
]),
|
||||
championMasteriesFetchedAt: NOW,
|
||||
championRecords: {},
|
||||
championRecordsFetchedAt: NOW,
|
||||
@@ -594,6 +696,18 @@ function createStaffRiotAccount(key: string, gameName: string, tagLine: string)
|
||||
};
|
||||
}
|
||||
|
||||
function createChampionMasteries(
|
||||
puuid: string,
|
||||
masteries: SeedChampionMastery[],
|
||||
): ChampionMasteryEntry[] {
|
||||
return masteries.map((mastery) => ({
|
||||
puuid,
|
||||
championId: CHAMPION_IDS[mastery.championId] ?? 0,
|
||||
championLevel: mastery.level,
|
||||
championPoints: mastery.points,
|
||||
}));
|
||||
}
|
||||
|
||||
function toMatchParticipant(user: {
|
||||
_id: mongoose.Types.ObjectId;
|
||||
riotAccounts: Array<{
|
||||
@@ -650,7 +764,9 @@ async function main() {
|
||||
await AuctionModel.deleteMany({ matchId: { $in: matchIds } }).exec();
|
||||
}
|
||||
|
||||
await MatchModel.deleteMany({ communityId: existingCommunity._id }).exec();
|
||||
await MatchModel.deleteMany({
|
||||
communityId: existingCommunity._id,
|
||||
}).exec();
|
||||
await UserModel.deleteMany({ communityId: existingCommunity._id }).exec();
|
||||
await CommunityModel.deleteOne({ _id: existingCommunity._id }).exec();
|
||||
}
|
||||
@@ -664,6 +780,8 @@ async function main() {
|
||||
name: DEV_COMMUNITY_NAME,
|
||||
description: DEV_COMMUNITY_DESCRIPTION,
|
||||
ownerUserId,
|
||||
riotPlatform: 'kr',
|
||||
riotRegion: 'asia',
|
||||
});
|
||||
|
||||
const owner = {
|
||||
|
||||
Reference in new issue
Block a user