Skip to content

Commit

Permalink
feat: echange pdf versioning to header
Browse files Browse the repository at this point in the history
Signed-off-by: hxtree <[email protected]>
  • Loading branch information
hxtree committed Oct 14, 2023
1 parent 90a29e6 commit 60c7070
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 22 deletions.
13 changes: 0 additions & 13 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/config/rush/repo-state.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
{
"pnpmShrinkwrapHash": "ebb79fccecf409936dd8366f90b17a26b30e9b81",
"pnpmShrinkwrapHash": "6ac8d44a89914f6b48f857d90784482fdfe527f2",
"preferredVersionsHash": "8ae0ba5bd02ec9c5763773a15e27aee08a6567f6"
}
4 changes: 4 additions & 0 deletions platform/bundlers/src/profiles/nestjs-bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export async function nestJsBundler(options: NestJsBundlerOptions) {

try {
const externalModules = [
// nestjs
'express',
'reflect-metadata',
'rxjs',
Expand All @@ -32,6 +33,9 @@ export async function nestJsBundler(options: NestJsBundlerOptions) {
'node-cache',
'reflect-metadata',
'rxjs',
// chromium
'puppeteer',
'chrome-aws-lambda',
];

await build({
Expand Down
3 changes: 1 addition & 2 deletions services/html-to-pdf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@
"@cats-cradle/validation-schemas": "workspace:*",
"@nestjs/testing": "9.2.1",
"@nestjs/axios": "~2.0.0",
"@sparticuz/chromium": "~117.0.0",
"puppeteer": "~21.3.8",
"@cats-cradle/faker-factory": "workspace:*",
"puppeteer": "~21.3.8",
"chrome-aws-lambda": "~10.1.0"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion services/html-to-pdf/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ async function bootstrap() {
);

nestApp.enableVersioning({
type: VersioningType.URI,
type: VersioningType.HEADER,
header: 'Accept-Version',
defaultVersion: '1',
});

Expand Down
3 changes: 2 additions & 1 deletion services/html-to-pdf/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ async function bootstrap() {
const app = await NestFactory.create(AppModule);

app.enableVersioning({
type: VersioningType.URI,
type: VersioningType.HEADER,
header: 'Accept-Version',
defaultVersion: '1',
});

Expand Down
4 changes: 2 additions & 2 deletions services/html-to-pdf/src/module/health/health.controller.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Controller, Get } from '@nestjs/common';
import { Controller, Get, VERSION_NEUTRAL } from '@nestjs/common';
import { HealthCheckService, HealthCheck } from '@nestjs/terminus';

@Controller('health')
@Controller({ path: 'health', version: ['1', VERSION_NEUTRAL] })
export class HealthController {
constructor(private health: HealthCheckService) {}

Expand Down
9 changes: 7 additions & 2 deletions services/html-to-pdf/src/module/pdf/pdf.controller.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import {
Controller, Post, Body, Res, Get,
Controller,
Post,
Body,
Res,
Get,
VERSION_NEUTRAL,
} from '@nestjs/common';
import { Response } from 'express';
import { PdfService } from './pdf.service';
import { CreateHtmlToPdfDto } from './create-html-to-pdf.dto';
import { CreateUrlToPdfDto } from './create-url-to-pdf.dto';

@Controller({ path: 'pdf', version: ['1'] })
@Controller({ path: 'pdf', version: ['1', VERSION_NEUTRAL] })
export class PdfController {
constructor(private readonly pdfService: PdfService) {}

Expand Down

0 comments on commit 60c7070

Please sign in to comment.