|
|
@@ -1,10 +1,11 @@
|
|
|
-import { Body, Controller, Get, Param, Patch, Post, Put, Query, Req } from '@nestjs/common'
|
|
|
+import { Body, Controller, Delete, Get, Param, Patch, Post, Put, Query, Req } from '@nestjs/common'
|
|
|
import { PaperService } from './paper.service'
|
|
|
import { PageRequest } from '../common/dto/page-request'
|
|
|
import { PaperOrder } from './entities/paper-order.entity'
|
|
|
import { PaperGenResult } from './entities/paper-gen-result.entity'
|
|
|
import { CreatePaperOrderDto } from './dto/create-order.dto'
|
|
|
import { HasAnyRoles } from 'src/auth/roles.decorator'
|
|
|
+import { PaperOrderAttachment } from './entities/paper-order-attachment.entity'
|
|
|
|
|
|
@Controller('paper')
|
|
|
@HasAnyRoles('paperOrder', 'paperGen')
|
|
|
@@ -46,4 +47,19 @@ export class PaperController {
|
|
|
async genChapters(@Body() body) {
|
|
|
return await this.paperService.genChapters(body.id, body.description)
|
|
|
}
|
|
|
+
|
|
|
+ @Post('/attachments')
|
|
|
+ async attachments(@Body() page: PageRequest<PaperOrderAttachment>) {
|
|
|
+ return await this.paperService.attachments(page)
|
|
|
+ }
|
|
|
+
|
|
|
+ @Put('/attachments')
|
|
|
+ async createAttachment(@Body() dto: PaperOrderAttachment) {
|
|
|
+ return await this.paperService.createAttachment(dto)
|
|
|
+ }
|
|
|
+
|
|
|
+ @Delete('/attachments/:id')
|
|
|
+ async deleteAttachment(@Param('id') id: string) {
|
|
|
+ return await this.paperService.deleteAttachment(Number(id))
|
|
|
+ }
|
|
|
}
|