|
@@ -1,4 +1,4 @@
|
|
|
-import { Body, Controller, Post } from "@nestjs/common";
|
|
|
|
|
|
|
+import { BadRequestException, Body, Controller, Get, Param, Post } from "@nestjs/common";
|
|
|
import { ApiBearerAuth, ApiTags } from "@nestjs/swagger";
|
|
import { ApiBearerAuth, ApiTags } from "@nestjs/swagger";
|
|
|
import { MomentsService } from "./moments.service";
|
|
import { MomentsService } from "./moments.service";
|
|
|
import { PageRequest } from "src/common/dto/page-request";
|
|
import { PageRequest } from "src/common/dto/page-request";
|
|
@@ -16,4 +16,13 @@ export class MomentsController {
|
|
|
return await this.momentsService.findAll(page)
|
|
return await this.momentsService.findAll(page)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Get('/get/:id')
|
|
|
|
|
+ public async get(@Param('id') id: string) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ return await this.momentsService.findById(Number(id))
|
|
|
|
|
+ } catch (err) {
|
|
|
|
|
+ throw new BadRequestException(err, 'Error: Moments not existent!')
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|