coupon/back/src/wos/wos.controller.ts
hyoseung930 608a904768 쿠폰 자동 입력 사이트 작성
배포 완료됐습니다.

이제 FID 입력란 아래에 **최근 유저** 칩이 표시됩니다. 한 번 조회한 사람은 아바타 + 닉네임 칩으로 저장되어, 다음번엔 클릭 한 번으로 바로 쿠폰을 받을 수 있습니다.
2026-04-16 18:06:00 +09:00

51 lines
1.3 KiB
TypeScript

import { Controller, Post, Get, Delete, Patch, Body, Param, HttpCode } from '@nestjs/common';
import { WosService } from './wos.service';
@Controller('api')
export class WosController {
constructor(private readonly wosService: WosService) {}
@Post('player')
@HttpCode(200)
async getPlayer(@Body() body: { fid: string }) {
return this.wosService.getPlayer(body.fid);
}
@Post('redeem-all')
@HttpCode(200)
async redeemAll(@Body() body: { fid: string }) {
return this.wosService.redeemAll(body.fid);
}
@Get('users')
async listUsers() {
return this.wosService.listUsers();
}
@Get('history/:fid')
async getHistory(@Param('fid') fid: string) {
return this.wosService.getHistory(fid);
}
@Get('coupons')
async listCoupons() {
return this.wosService.listCoupons();
}
@Post('coupons')
@HttpCode(200)
async addCoupon(@Body() body: { name: string; code: string }) {
return this.wosService.addCoupon(body.name, body.code);
}
@Patch('coupons/:id')
async toggleCoupon(@Param('id') id: string, @Body() body: { is_active: boolean }) {
return this.wosService.toggleCoupon(Number(id), body.is_active);
}
@Delete('coupons/:id')
async deleteCoupon(@Param('id') id: string) {
return this.wosService.deleteCoupon(Number(id));
}
}