Skip to content

Commit 06cdba6

Browse files
controllers: apply envelope option to auth, user, and root controllers; update metadata
1 parent a53a4a0 commit 06cdba6

File tree

4 files changed

+25
-44
lines changed

4 files changed

+25
-44
lines changed

src/app.controller.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { Controller, Get } from '@nestjs/common';
22
import { AppService } from './app.service';
3+
import { Api } from './common/decorators/api.decorator';
34

45
@Controller()
56
export class AppController {
67
constructor(private readonly appService: AppService) {}
78

89
@Get()
9-
getHello(): string {
10-
return this.appService.getHello();
10+
@Api({ summary: 'Health / hello endpoint', description: 'Simple hello world response', envelope: true })
11+
getHello() {
12+
return { message: this.appService.getHello() };
1113
}
1214
}

src/auth/auth.controller.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Body, Controller, Post, HttpCode, HttpStatus, BadRequestException } from '@nestjs/common';
22
import { AuthService } from './auth.service';
33
import { GoogleAuthInput } from './dto/google-auth.input';
4-
import { ApiTags, ApiOperation, ApiResponse, ApiParam } from '@nestjs/swagger';
5-
import { ApiPaginationQuery } from '../common/decorators/api-nested-query.decorator';
4+
import { ApiTags } from '@nestjs/swagger';
5+
import { Api } from '../common/decorators/api.decorator';
66

77
@ApiTags('Auth')
88
@Controller('auth')
@@ -13,12 +13,16 @@ export class AuthController {
1313
* Fetch new jobs from Reddit and Web3Career, store them, and send notifications
1414
*/
1515
@Post('google')
16-
@ApiOperation({
17-
summary: 'Fetch new jobs from Reddit and Web3Career',
18-
description: 'Fetches new jobs from both sources, stores them, and sends notifications.',
16+
@Api({
17+
summary: 'Google authentication',
18+
description: 'Authenticate a user using a Google ID token and optional buildType.',
19+
bodyType: GoogleAuthInput,
20+
envelope: true,
21+
responses: [
22+
{ status: 200, description: 'Authenticated successfully.' },
23+
{ status: 400, description: 'ID token missing or invalid.' },
24+
],
1925
})
20-
@ApiParam({ name: 'idToken', description: 'Google ID Token', type: String })
21-
@ApiResponse({ status: 200, description: 'Jobs fetched and notifications sent.' })
2226
@HttpCode(HttpStatus.OK)
2327
async googleAuth(@Body() googleAuthInput: GoogleAuthInput) {
2428
const { idToken, buildType } = googleAuthInput;

0 commit comments

Comments
 (0)