This commit is contained in:
dahyeon committed 2026-04-26 06:48:32 -07:00
1 parent ca56af79e5
commit 8b8dec4c44
14 files changed
+1155 -7

No files matched your search

@@ -1,12 +1,24 @@
import { Controller, Get, Param, Query } from '@nestjs/common';
import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
import mongoose from 'mongoose';
import { AllowPublicAccess } from '../auth/allow-public-access.decorator';
import { ParseObjectIdPipe } from '../common/parse-object-id.pipe';
import { RiotJobQueueService } from '../riot-job-queue/riot-job-queue.service';
import type {
RiotJobPriority,
} from '../riot-job-queue/riot-job-queue.types';
import { MatchHistoryService } from './match-history.service';
interface RefreshBody {
queueGroups?: string[];
priority?: RiotJobPriority;
}
@Controller('communities/:communityId/users/:userId')
export class MatchHistoryController {
constructor(private readonly matchHistoryService: MatchHistoryService) {}
constructor(
private readonly matchHistoryService: MatchHistoryService,
private readonly riotJobQueueService: RiotJobQueueService,
) {}
@Get('history-profile')
@AllowPublicAccess()
@@ -87,6 +99,22 @@ export class MatchHistoryController {
});
}
@Post('refresh')
@AllowPublicAccess()
public refresh(
@Param('communityId', ParseObjectIdPipe)
communityId: mongoose.Types.ObjectId,
@Param('userId', ParseObjectIdPipe) userId: mongoose.Types.ObjectId,
@Body() body: RefreshBody,
) {
return this.riotJobQueueService.enqueueRefresh({
communityId,
userId,
queueGroups: body.queueGroups ?? ['summoners-rift'],
priority: body.priority ?? 'high',
});
}
private toNumber(value: string | undefined): number | undefined {
if (!value) return undefined;
const parsed = Number(value);
@@ -1,8 +1,10 @@
import { Module } from '@nestjs/common';
import { RiotJobQueueModule } from '../riot-job-queue/riot-job-queue.module';
import { MatchHistoryController } from './match-history.controller';
import { MatchHistoryService } from './match-history.service';
@Module({
imports: [RiotJobQueueModule],
controllers: [MatchHistoryController],
providers: [MatchHistoryService],
exports: [MatchHistoryService],