/
kochkatech
/
CorpGame
Обзор
Документация
Войти
/
kochkatech
/
CorpGame
Код
Запросы
1
Задачи
Вики
Пакеты
0
Релизы
1
CI/CD
Аналитика
master
backend/src/interaction/interaction.controller.ts
48 строк
2 KB
kochkareal
chore: добавлен .gitattributes, нормализованы переносы строк (LF везде, кроме .bat/.cmd)
06 авг 2026, 15:18
06 авг 2026, 15:18
c25ef1b
Код
Авторство
О чём код?
import { Body, Controller, Post, UseGuards } from '@nestjs/common'; import { TeamGuard } from '../auth/team.guard'; import { CurrentTeam } from '../auth/current-team.decorator'; import { TeamTokenPayload } from '../auth/jwt.util'; import { InteractionService } from './interaction.service'; import { TheftService } from './theft.service'; @UseGuards(TeamGuard) @Controller('team/interactions') export class InteractionController { constructor( private readonly interaction: InteractionService, private readonly theft: TheftService, ) {} @Post('transfer') transfer( @CurrentTeam() current: TeamTokenPayload, @Body('targetTeamId') targetTeamId: string, @Body('resource') resource: string, @Body('amount') amount: number, ) { return this.interaction.transfer(current.sessionId, current.teamId, targetTeamId, resource, Number(amount)); } @Post('sanction') sanction(@CurrentTeam() current: TeamTokenPayload, @Body('targetTeamId') targetTeamId: string) { return this.interaction.sanction(current.sessionId, current.teamId, targetTeamId); } @Post('theft/start') theftStart( @CurrentTeam() current: TeamTokenPayload, @Body('targetTeamId') targetTeamId: string, @Body('resource') resource: string, ) { return this.theft.start(current.sessionId, current.teamId, targetTeamId, resource); } @Post('theft/guess') theftGuess( @CurrentTeam() current: TeamTokenPayload, @Body('attemptId') attemptId: string, @Body('guessTeamId') guessTeamId: string, ) { return this.theft.guess(attemptId, current.teamId, guessTeamId); } }