fix(api): missing OpenAPI route tags

This commit is contained in:
Julian Tölle 2022-07-12 20:32:55 +02:00
parent 290cc3d046
commit d6af6f9cba
6 changed files with 10 additions and 3 deletions

View file

@ -6,6 +6,7 @@ import {
UseFilters, UseFilters,
UseGuards, UseGuards,
} from "@nestjs/common"; } from "@nestjs/common";
import { ApiTags } from "@nestjs/swagger";
import type { Response } from "express"; import type { Response } from "express";
import { User } from "../users/user.entity"; import { User } from "../users/user.entity";
import { AuthSession } from "./auth-session.entity"; import { AuthSession } from "./auth-session.entity";
@ -19,6 +20,7 @@ import {
} from "./guards/auth-strategies.guard"; } from "./guards/auth-strategies.guard";
import { SpotifyAuthFilter } from "./spotify.filter"; import { SpotifyAuthFilter } from "./spotify.filter";
@ApiTags("auth")
@Controller("api/v1/auth") @Controller("api/v1/auth")
export class AuthController { export class AuthController {
constructor(private readonly authService: AuthService) {} constructor(private readonly authService: AuthService) {}

View file

@ -1,5 +1,6 @@
import { Controller, Get } from "@nestjs/common"; import { Controller, Get } from "@nestjs/common";
import { ConfigService } from "@nestjs/config"; import { ConfigService } from "@nestjs/config";
import { ApiTags } from "@nestjs/swagger";
import { import {
HealthCheck, HealthCheck,
HealthCheckResult, HealthCheckResult,
@ -9,6 +10,7 @@ import {
} from "@nestjs/terminus"; } from "@nestjs/terminus";
import { configureScope, Scope } from "@sentry/node"; import { configureScope, Scope } from "@sentry/node";
@ApiTags("health")
@Controller("api/v1/health") @Controller("api/v1/health")
export class HealthCheckController { export class HealthCheckController {
constructor( constructor(

View file

@ -1,4 +1,5 @@
import { Controller, Get, Query } from "@nestjs/common"; import { Controller, Get, Query } from "@nestjs/common";
import { ApiTags } from "@nestjs/swagger";
import { Pagination } from "nestjs-typeorm-paginate"; import { Pagination } from "nestjs-typeorm-paginate";
import { AuthAccessToken } from "../auth/decorators/auth-access-token.decorator"; import { AuthAccessToken } from "../auth/decorators/auth-access-token.decorator";
import { ReqUser } from "../auth/decorators/req-user.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 { Listen } from "./listen.entity";
import { ListensService } from "./listens.service"; import { ListensService } from "./listens.service";
@ApiTags("listens")
@Controller("api/v1/listens") @Controller("api/v1/listens")
export class ListensController { export class ListensController {
constructor(private readonly listensService: ListensService) {} constructor(private readonly listensService: ListensService) {}

View file

@ -80,9 +80,6 @@ async function bootstrap() {
.setDescription("Track and analyze your Spotify Listens") .setDescription("Track and analyze your Spotify Listens")
.setVersion("1.0") .setVersion("1.0")
.addBearerAuth() .addBearerAuth()
.addTag("user")
.addTag("listens")
.addTag("auth")
.build(); .build();
const document = SwaggerModule.createDocument(app, options); const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup("api/docs", app, document); SwaggerModule.setup("api/docs", app, document);

View file

@ -1,4 +1,5 @@
import { Controller, Get, Query } from "@nestjs/common"; import { Controller, Get, Query } from "@nestjs/common";
import { ApiTags } from "@nestjs/swagger";
import { AuthAccessToken } from "../auth/decorators/auth-access-token.decorator"; import { AuthAccessToken } from "../auth/decorators/auth-access-token.decorator";
import { ReqUser } from "../auth/decorators/req-user.decorator"; import { ReqUser } from "../auth/decorators/req-user.decorator";
import { User } from "../users/user.entity"; import { User } from "../users/user.entity";
@ -11,6 +12,7 @@ import { TopTracksReportDto } from "./dto/top-tracks-report.dto";
import { ReportsService } from "./reports.service"; import { ReportsService } from "./reports.service";
import { Timeframe } from "./timeframe.enum"; import { Timeframe } from "./timeframe.enum";
@ApiTags("reports")
@Controller("api/v1/reports") @Controller("api/v1/reports")
export class ReportsController { export class ReportsController {
constructor(private readonly reportsService: ReportsService) {} constructor(private readonly reportsService: ReportsService) {}

View file

@ -1,8 +1,10 @@
import { Controller, Get } from "@nestjs/common"; import { Controller, Get } from "@nestjs/common";
import { ApiTags } from "@nestjs/swagger";
import { AuthAccessToken } from "../auth/decorators/auth-access-token.decorator"; import { AuthAccessToken } from "../auth/decorators/auth-access-token.decorator";
import { ReqUser } from "../auth/decorators/req-user.decorator"; import { ReqUser } from "../auth/decorators/req-user.decorator";
import { User } from "./user.entity"; import { User } from "./user.entity";
@ApiTags("users")
@Controller("api/v1/users") @Controller("api/v1/users")
export class UsersController { export class UsersController {
@Get("me") @Get("me")