init
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { Controller, Get, Param, Query, UseGuards } from '@nestjs/common';
|
||||
import { BenefitService } from './benefit.service';
|
||||
import { JwtAuthGuard, AuthUser } from '../../common/guards/jwt-auth.guard';
|
||||
import { CurrentUser } from '../../common/decorators/current-user.decorator';
|
||||
|
||||
@Controller('benefit')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
export class BenefitController {
|
||||
constructor(private readonly benefitService: BenefitService) {}
|
||||
|
||||
@Get('coupons')
|
||||
coupons(@CurrentUser() user: AuthUser) {
|
||||
return this.benefitService.listCoupons(user.actorId);
|
||||
}
|
||||
|
||||
@Get('summary')
|
||||
summary(@CurrentUser() user: AuthUser) {
|
||||
return this.benefitService.getSummary(user.actorId);
|
||||
}
|
||||
|
||||
@Get('coupons/:id')
|
||||
coupon(@CurrentUser() user: AuthUser, @Param('id') id: string) {
|
||||
return this.benefitService.getCoupon(user.actorId, BigInt(id));
|
||||
}
|
||||
|
||||
@Get('ledger')
|
||||
ledger(@CurrentUser() user: AuthUser, @Query('couponId') couponId?: string) {
|
||||
return this.benefitService.getLedger(
|
||||
user.actorId,
|
||||
couponId ? BigInt(couponId) : undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user