23 lines
690 B
TypeScript
23 lines
690 B
TypeScript
import { Controller, Get, Post, Body, UseGuards, Req } from '@nestjs/common';
|
|
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
|
|
import { AuthGuard } from '@nestjs/passport';
|
|
import { OrdersService } from './orders.service';
|
|
|
|
@ApiTags('订阅')
|
|
@Controller('subscriptions')
|
|
@UseGuards(AuthGuard('jwt'))
|
|
@ApiBearerAuth()
|
|
export class SubscriptionsController {
|
|
constructor(private ordersService: OrdersService) {}
|
|
|
|
@Get('current')
|
|
async getCurrentSubscription(@Req() req: any) {
|
|
return this.ordersService.getCurrentSubscription(req.user.userId);
|
|
}
|
|
|
|
@Get()
|
|
async getSubscriptions(@Req() req: any) {
|
|
return this.ordersService.getSubscriptions(req.user.userId);
|
|
}
|
|
}
|