11import { ApiBaseController , GetUserId } from '@shared/decorators' ;
22import { BoardsFacade } from '@core/boards/application/boards.facade' ;
33import { Body , Delete , Get , Param , Patch , Post } from '@nestjs/common' ;
4+ import { CreateBoardDto , UpdateBoardDto } from '@core/boards/application/dtos' ;
5+ import type { BoardWithRelations } from '@core/boards/domain/entities' ;
46
57@ApiBaseController ( 'projects/:projectId/boards' , 'Boards' , true )
68export class BoardsController {
79 constructor ( private readonly facade : BoardsFacade ) { }
810
911 @Get ( )
10- async findAll ( @Param ( 'projectId' ) projectId : string , @GetUserId ( ) userId : string ) {
12+ async findAll (
13+ @Param ( 'projectId' ) projectId : string ,
14+ @GetUserId ( ) userId : string ,
15+ ) : Promise < BoardWithRelations [ ] > {
1116 return this . facade . getAll ( projectId , userId ) ;
1217 }
1318
@@ -16,16 +21,16 @@ export class BoardsController {
1621 @Param ( 'id' ) id : string ,
1722 @Param ( 'projectId' ) projectId : string ,
1823 @GetUserId ( ) userId : string ,
19- ) {
24+ ) : Promise < BoardWithRelations | null > {
2025 return this . facade . getOne ( id , projectId , userId ) ;
2126 }
2227
2328 @Post ( )
2429 async create (
2530 @Param ( 'projectId' ) projectId : string ,
2631 @GetUserId ( ) userId : string ,
27- @Body ( ) dto : any ,
28- ) {
32+ @Body ( ) dto : CreateBoardDto ,
33+ ) : Promise < BoardWithRelations > {
2934 return this . facade . create ( projectId , userId , dto ) ;
3035 }
3136
@@ -34,8 +39,8 @@ export class BoardsController {
3439 @Param ( 'id' ) id : string ,
3540 @Param ( 'projectId' ) projectId : string ,
3641 @GetUserId ( ) userId : string ,
37- @Body ( ) dto : any ,
38- ) {
42+ @Body ( ) dto : UpdateBoardDto ,
43+ ) : Promise < BoardWithRelations | null > {
3944 return this . facade . update ( id , projectId , userId , dto ) ;
4045 }
4146
@@ -44,7 +49,7 @@ export class BoardsController {
4449 @Param ( 'id' ) id : string ,
4550 @Param ( 'projectId' ) projectId : string ,
4651 @GetUserId ( ) userId : string ,
47- ) {
52+ ) : Promise < boolean > {
4853 return this . facade . delete ( id , projectId , userId ) ;
4954 }
5055}
0 commit comments