36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
import { Body, Controller, Get, Param, Patch, Post } from '@nestjs/common'
|
|
import { CreatePartnerLicenseDto, UpdateLicenseDto } from './dto/license.dto'
|
|
import { PartnerLicensesService } from './licenses.service'
|
|
|
|
@Controller('admin/partners/:partnerId/licenses')
|
|
export class PartnerLicensesController {
|
|
constructor(private readonly licensesService: PartnerLicensesService) {}
|
|
|
|
@Get()
|
|
async findAll(@Param('partnerId') partnerId: string) {
|
|
return this.licensesService.findAll(partnerId)
|
|
}
|
|
|
|
@Get(':id')
|
|
async findOne(@Param('partnerId') partnerId: string, @Param('id') id: string) {
|
|
return this.licensesService.findOne(partnerId, id)
|
|
}
|
|
|
|
@Post()
|
|
async create(
|
|
@Param('partnerId') partnerId: string,
|
|
@Body() data: CreatePartnerLicenseDto,
|
|
) {
|
|
return this.licensesService.create(partnerId, data)
|
|
}
|
|
|
|
@Patch(':id')
|
|
async update(
|
|
@Param('partnerId') partnerId: string,
|
|
@Param('id') id: string,
|
|
@Body() data: UpdateLicenseDto,
|
|
) {
|
|
return this.licensesService.update(partnerId, id, data)
|
|
}
|
|
}
|