feat: allow admins to add match participants
This commit is contained in:
1 parent
8aff1be225
commit
24983aeb09
11 files changed
+1019
-19
No files matched your search
@@ -24,6 +24,7 @@ import type {
|
||||
UserDocument,
|
||||
} from '../global/database/schema';
|
||||
import {
|
||||
AddParticipantDto,
|
||||
CreateMatchDto,
|
||||
JoinMatchDto,
|
||||
UpdateMatchDto,
|
||||
@@ -149,6 +150,28 @@ export class MatchController {
|
||||
});
|
||||
}
|
||||
|
||||
// 관리자 전용 — 커뮤니티 유저를 모집중 매치에 직접 추가한다.
|
||||
@Post(':matchId/participants/:userId')
|
||||
@Roles('admin', 'owner')
|
||||
@UseGuards(RolesGuard)
|
||||
public async addParticipant(
|
||||
@CurrentUser() currentUser: UserDocument,
|
||||
@Param('communityId', ParseObjectIdPipe)
|
||||
communityId: mongoose.Types.ObjectId,
|
||||
@Param('matchId', ParseObjectIdPipe) matchId: mongoose.Types.ObjectId,
|
||||
@Param('userId', ParseObjectIdPipe) userId: mongoose.Types.ObjectId,
|
||||
@Body() body: AddParticipantDto | undefined,
|
||||
) {
|
||||
this.assertSameCommunity(currentUser, communityId);
|
||||
const match = await this.matchService.join({
|
||||
matchId,
|
||||
userId,
|
||||
preferredPositions: body?.preferredPositions,
|
||||
riotPuuid: body?.riotPuuid,
|
||||
});
|
||||
return this.matchService.serialize(match);
|
||||
}
|
||||
|
||||
// 관리자 전용 — 참가자 주/부 포지션 변경.
|
||||
@Patch(':matchId/participants/:userId')
|
||||
@Roles('admin', 'owner')
|
||||
|
||||
Reference in new issue
Block a user