From d6af6f9cbaa6558623a045597f80778524bc0dc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20T=C3=B6lle?= Date: Tue, 12 Jul 2022 20:32:55 +0200 Subject: [PATCH] fix(api): missing OpenAPI route tags --- src/auth/auth.controller.ts | 2 ++ src/health-check/health-check.controller.ts | 2 ++ src/listens/listens.controller.ts | 2 ++ src/main.ts | 3 --- src/reports/reports.controller.ts | 2 ++ src/users/users.controller.ts | 2 ++ 6 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.ts index 7c944a6..60e2c70 100644 --- a/src/auth/auth.controller.ts +++ b/src/auth/auth.controller.ts @@ -6,6 +6,7 @@ import { UseFilters, UseGuards, } from "@nestjs/common"; +import { ApiTags } from "@nestjs/swagger"; import type { Response } from "express"; import { User } from "../users/user.entity"; import { AuthSession } from "./auth-session.entity"; @@ -19,6 +20,7 @@ import { } from "./guards/auth-strategies.guard"; import { SpotifyAuthFilter } from "./spotify.filter"; +@ApiTags("auth") @Controller("api/v1/auth") export class AuthController { constructor(private readonly authService: AuthService) {} diff --git a/src/health-check/health-check.controller.ts b/src/health-check/health-check.controller.ts index c06f8ba..b5ff426 100644 --- a/src/health-check/health-check.controller.ts +++ b/src/health-check/health-check.controller.ts @@ -1,5 +1,6 @@ import { Controller, Get } from "@nestjs/common"; import { ConfigService } from "@nestjs/config"; +import { ApiTags } from "@nestjs/swagger"; import { HealthCheck, HealthCheckResult, @@ -9,6 +10,7 @@ import { } from "@nestjs/terminus"; import { configureScope, Scope } from "@sentry/node"; +@ApiTags("health") @Controller("api/v1/health") export class HealthCheckController { constructor( diff --git a/src/listens/listens.controller.ts b/src/listens/listens.controller.ts index f972765..43c0a99 100644 --- a/src/listens/listens.controller.ts +++ b/src/listens/listens.controller.ts @@ -1,4 +1,5 @@ import { Controller, Get, Query } from "@nestjs/common"; +import { ApiTags } from "@nestjs/swagger"; import { Pagination } from "nestjs-typeorm-paginate"; import { AuthAccessToken } from "../auth/decorators/auth-access-token.decorator"; import { ReqUser } from "../auth/decorators/req-user.decorator"; @@ -7,6 +8,7 @@ import { GetListensFilterDto } from "./dto/get-listens.dto"; import { Listen } from "./listen.entity"; import { ListensService } from "./listens.service"; +@ApiTags("listens") @Controller("api/v1/listens") export class ListensController { constructor(private readonly listensService: ListensService) {} diff --git a/src/main.ts b/src/main.ts index bf92554..c60a512 100644 --- a/src/main.ts +++ b/src/main.ts @@ -80,9 +80,6 @@ async function bootstrap() { .setDescription("Track and analyze your Spotify Listens") .setVersion("1.0") .addBearerAuth() - .addTag("user") - .addTag("listens") - .addTag("auth") .build(); const document = SwaggerModule.createDocument(app, options); SwaggerModule.setup("api/docs", app, document); diff --git a/src/reports/reports.controller.ts b/src/reports/reports.controller.ts index c467109..d6f6dc3 100644 --- a/src/reports/reports.controller.ts +++ b/src/reports/reports.controller.ts @@ -1,4 +1,5 @@ import { Controller, Get, Query } from "@nestjs/common"; +import { ApiTags } from "@nestjs/swagger"; import { AuthAccessToken } from "../auth/decorators/auth-access-token.decorator"; import { ReqUser } from "../auth/decorators/req-user.decorator"; import { User } from "../users/user.entity"; @@ -11,6 +12,7 @@ import { TopTracksReportDto } from "./dto/top-tracks-report.dto"; import { ReportsService } from "./reports.service"; import { Timeframe } from "./timeframe.enum"; +@ApiTags("reports") @Controller("api/v1/reports") export class ReportsController { constructor(private readonly reportsService: ReportsService) {} diff --git a/src/users/users.controller.ts b/src/users/users.controller.ts index b91bf68..c747a81 100644 --- a/src/users/users.controller.ts +++ b/src/users/users.controller.ts @@ -1,8 +1,10 @@ import { Controller, Get } from "@nestjs/common"; +import { ApiTags } from "@nestjs/swagger"; import { AuthAccessToken } from "../auth/decorators/auth-access-token.decorator"; import { ReqUser } from "../auth/decorators/req-user.decorator"; import { User } from "./user.entity"; +@ApiTags("users") @Controller("api/v1/users") export class UsersController { @Get("me")