Progress on API routes
This commit is contained in:
22
src/entries/entries.controller.ts
Normal file
22
src/entries/entries.controller.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Body, Controller, Delete, Inject, Param, Post } from '@nestjs/common';
|
||||
import { EntryService } from './entries.service';
|
||||
import { EntryDTO } from './entries.dto';
|
||||
|
||||
@Controller('entries')
|
||||
export class EntriesController {
|
||||
constructor(
|
||||
@Inject(EntryService)
|
||||
private readonly entryService: EntryService
|
||||
) {}
|
||||
|
||||
@Post()
|
||||
async saveEntry(@Body() entry: EntryDTO) {
|
||||
return (await this.entryService.save(entry)).uuid
|
||||
}
|
||||
|
||||
@Delete(":uuid")
|
||||
async softDelete(@Param("uuid") uuid: string): Promise<void>
|
||||
{
|
||||
await this.entryService.softDeleteByUuid(uuid)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user