|
|
@@ -1,10 +1,13 @@
|
|
|
import { Public } from '../auth/public.decorator'
|
|
|
import { MembershipService } from './membership.service'
|
|
|
-import { Body, Controller, Get, Post, Req } from '@nestjs/common'
|
|
|
+import { Body, Controller, Delete, Get, Param, Post, Put, Req } from '@nestjs/common'
|
|
|
import { MemberPlanDto } from './dto/memberPlan.dto'
|
|
|
import { HasRoles } from '../auth/roles.decorator'
|
|
|
import { Role } from '../model/role.enum'
|
|
|
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'
|
|
|
+import { PageRequest } from '../common/dto/page-request'
|
|
|
+import { MemberPlan } from './entities/memberPlan.entity'
|
|
|
+import { Membership } from './entities/membership.entity'
|
|
|
|
|
|
@ApiTags('membership.admin')
|
|
|
@Controller('/admin/membership')
|
|
|
@@ -13,8 +16,18 @@ import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'
|
|
|
export class MembershipAdminController {
|
|
|
constructor(private readonly membershipService: MembershipService) {}
|
|
|
|
|
|
- @Post('/save')
|
|
|
- async save(@Body() memberPlanDto: MemberPlanDto) {
|
|
|
- return await this.membershipService.save(memberPlanDto)
|
|
|
+ @Post('/members')
|
|
|
+ public async listMembers(@Body() page: PageRequest<Membership>) {
|
|
|
+ return await this.membershipService.findAllMembers(page)
|
|
|
+ }
|
|
|
+
|
|
|
+ @Put('/plans')
|
|
|
+ async savePlan(@Body() memberPlanDto: MemberPlanDto) {
|
|
|
+ return await this.membershipService.savePlan(memberPlanDto)
|
|
|
+ }
|
|
|
+
|
|
|
+ @Delete('/plans/:id')
|
|
|
+ async deletePlan(@Param('id') id: number) {
|
|
|
+ return await this.membershipService.deletePlanById(id)
|
|
|
}
|
|
|
}
|