| 1 | import { |
| 2 | Controller, |
| 3 | Delete, |
| 4 | Get, |
| 5 | HttpCode, |
| 6 | HttpStatus, |
| 7 | Param, |
| 8 | Post, |
| 9 | Session, |
| 10 | } from '@nestjs/common'; |
| 11 | import { |
| 12 | ApiNoContentResponse, |
| 13 | ApiNotFoundResponse, |
| 14 | ApiOkResponse, |
| 15 | ApiOperation, |
| 16 | ApiTags, |
| 17 | } from '@nestjs/swagger'; |
| 18 | import type { UserSession |
| 19 | |
| 20 | import { ErrorResponseDTO } |
| 21 | import { CollaboratorsService } |
| 22 | import { ListInvitationsResponseDTO } |
| 23 | |
| 24 | @ApiTags('Collaborators') |
| 25 | @Controller('invitations') |
| 26 | export class InvitationsController |
| 27 | constructor(private readonly |
| 28 | |
| 29 | @Get() |
| 30 | @ApiOperation({ |
| 31 | summary: 'List my pending invitations', |
| 32 | description: |
| 33 | 'Repositories the signed-in user has been invited to collaborate on.', |
| 34 | }) |
| 35 | @ApiOkResponse({ type |
| 36 | list(@Session() |
| 37 | return this.collaborators |
| 38 | } |
| 39 | |
| 40 | @Post(':id/accept' |
| 41 | @HttpCode(HttpStatus. |
| 42 | @ApiOperation({ summary |
| 43 | @ApiNoContentResponse() |
| 44 | @ApiNotFoundResponse({ type |
| 45 | accept(@Param( |
| 46 | return this.collaborators |
| 47 | } |
| 48 | |
| 49 | @Delete(':id' |
| 50 | @HttpCode(HttpStatus. |
| 51 | @ApiOperation({ summary |
| 52 | @ApiNoContentResponse() |
| 53 | @ApiNotFoundResponse({ type |
| 54 | decline(@Param( |
| 55 | return this.collaborators |
| 56 | } |
| 57 | } |