From 676257265886e7ad765e62beaad83ead30fc9073 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 2 Apr 2022 08:46:24 +0200 Subject: [PATCH] Feature/setup api versioning (#783) * Setup API versioning * Update changelog --- CHANGELOG.md | 1 + apps/api/src/main.ts | 9 ++- .../login-with-access-token-dialog.html | 2 +- .../src/app/pages/register/register-page.html | 2 +- apps/client/src/app/services/admin.service.ts | 16 ++--- apps/client/src/app/services/cache.service.ts | 2 +- apps/client/src/app/services/data.service.ts | 68 +++++++++---------- .../services/import-transactions.service.ts | 2 +- .../src/app/services/user/user.service.ts | 2 +- .../src/app/services/web-authn.service.ts | 30 ++++---- apps/client/src/main.ts | 2 +- 11 files changed, 70 insertions(+), 66 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c969c176..be4fb1f68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Added API versioning - Added more durations in the coupon system ### Changed diff --git a/apps/api/src/main.ts b/apps/api/src/main.ts index 5a077910e..cf565a36d 100644 --- a/apps/api/src/main.ts +++ b/apps/api/src/main.ts @@ -1,4 +1,4 @@ -import { Logger, ValidationPipe } from '@nestjs/common'; +import { Logger, ValidationPipe, VersioningType } from '@nestjs/common'; import { NestFactory } from '@nestjs/core'; import { AppModule } from './app/app.module'; @@ -7,8 +7,11 @@ import { environment } from './environments/environment'; async function bootstrap() { const app = await NestFactory.create(AppModule); app.enableCors(); - const globalPrefix = 'api'; - app.setGlobalPrefix(globalPrefix); + app.enableVersioning({ + defaultVersion: '1', + type: VersioningType.URI + }); + app.setGlobalPrefix('api'); app.useGlobalPipes( new ValidationPipe({ forbidNonWhitelisted: true, diff --git a/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.html b/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.html index 614c28bfe..2186368ca 100644 --- a/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.html +++ b/apps/client/src/app/components/login-with-access-token-dialog/login-with-access-token-dialog.html @@ -8,7 +8,7 @@