38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
|
|
import { Body, Controller, Delete, Get, Param, Post, Put } from '@nestjs/common'
|
||
|
|
import { CreateLicenseDto, 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: CreateLicenseDto) {
|
||
|
|
return this.licensesService.create(partnerId, data)
|
||
|
|
}
|
||
|
|
|
||
|
|
@Put(':id')
|
||
|
|
async update(
|
||
|
|
@Param('partnerId') partnerId: string,
|
||
|
|
@Param('id') id: string,
|
||
|
|
@Body() data: UpdateLicenseDto,
|
||
|
|
) {
|
||
|
|
return this.licensesService.update(partnerId, id, data)
|
||
|
|
}
|
||
|
|
|
||
|
|
@Delete(':id')
|
||
|
|
async delete(@Param('partnerId') partnerId: string, @Param('id') id: string) {
|
||
|
|
return this.licensesService.delete(partnerId, id)
|
||
|
|
}
|
||
|
|
}
|