Skip to content

Commit 48a2b19

Browse files
committed
Merge branch 'master' into feature/dark-mode
2 parents 6a62f73 + 330ddd6 commit 48a2b19

File tree

9 files changed

+39
-723
lines changed

9 files changed

+39
-723
lines changed

content/openapi/introduction.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ export interface ExpressSwaggerCustomOptions {
146146
validatorUrl?: string;
147147
url?: string;
148148
urls?: Record<'url' | 'name', string>[];
149+
patchDocumentOnRequest?: <TRequest = any, TResponse = any> (req: TRequest, res: TResponse, document: OpenAPIObject) => OpenAPIObject;
149150
}
150151
```
151152

content/recipes/swc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,14 @@ declare a `generate-metadata.ts` file near the `main.ts` file with the following
135135

136136
```ts
137137
import { PluginMetadataGenerator } from '@nestjs/cli/lib/compiler/plugins';
138-
import { ReadonlyVisitor } from '@nestjs/swagger';
138+
import { ReadonlyVisitor } from '@nestjs/swagger/dist/plugin';
139139

140140
const generator = new PluginMetadataGenerator();
141141
generator.generate({
142142
visitors: [new ReadonlyVisitor({ introspectComments: true, pathToSource: __dirname })],
143143
outputDir: __dirname,
144144
watch: true,
145-
tsconfigPath: 'tsconfig.build.json',
145+
tsconfigPath: 'apps/<name>/tsconfig.app.json',
146146
});
147147
```
148148

content/security/rate-limiting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export class WsThrottlerGuard extends ThrottlerGuard {
116116
}
117117
}
118118
```
119-
> info **Hint** If you using ws, it is necessary to replace the `_socket` with `conn`
119+
> info **Hint** If you are using ws, it is necessary to replace the `_socket` with `conn`
120120
121121
There's a few things to keep in mind when working with WebSockets:
122122

content/techniques/cookies.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ $ npm i -D @types/cookie-parser
1414
Once the installation is complete, apply the `cookie-parser` middleware as global middleware (for example, in your `main.ts` file).
1515

1616
```typescript
17-
import cookieParser from 'cookie-parser';
17+
import * as cookieParser from 'cookie-parser';
1818
// somewhere in your initialization file
1919
app.use(cookieParser());
2020
```
@@ -49,7 +49,7 @@ findAll(@Res({ passthrough: true }) response: Response) {
4949
}
5050
```
5151

52-
> warning **Warning** If you want to leave the response handling logic to the framework, remember to set the `passthrough` option to `true`, as shown above. Read more [here](/controllers#appendix-library-specific-approach).
52+
> warning **Warning** If you want to leave the response handling logic to the framework, remember to set the `passthrough` option to `true`, as shown above. Read more [here](/controllers#library-specific-approach).
5353
5454
> info **Hint** The `@Res()` decorator is imported from the `@nestjs/common`, while `Response` from the `express` package.
5555
@@ -98,7 +98,7 @@ findAll(@Res({ passthrough: true }) response: FastifyReply) {
9898

9999
To read more about `FastifyReply#setCookie()` method, check out this [page](https://github.com/fastify/fastify-cookie#sending).
100100

101-
> warning **Warning** If you want to leave the response handling logic to the framework, remember to set the `passthrough` option to `true`, as shown above. Read more [here](/controllers#appendix-library-specific-approach).
101+
> warning **Warning** If you want to leave the response handling logic to the framework, remember to set the `passthrough` option to `true`, as shown above. Read more [here](/controllers#library-specific-approach).
102102
103103
> info **Hint** The `@Res()` decorator is imported from the `@nestjs/common`, while `FastifyReply` from the `fastify` package.
104104

content/techniques/file-upload.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,18 @@ uploadFile(files) {
236236
}
237237
```
238238

239+
#### No files
240+
241+
To accept `multipart/form-data` but not allow any files to be uploaded, use the `NoFilesInterceptor`. This sets multipart data as attributes on the request body. Any files sent with the request will throw a `BadRequestException`.
242+
243+
```typescript
244+
@Post('upload')
245+
@UseInterceptors(NoFilesInterceptor())
246+
handleMultiPartData(@Body() body) {
247+
console.log(body)
248+
}
249+
```
250+
239251
#### Default options
240252

241253
You can specify multer options in the file interceptors as described above. To set default options, you can call the static `register()` method when you import the `MulterModule`, passing in supported options. You can use all options listed [here](https://github.com/expressjs/multer#multeropts).

content/techniques/sql.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -992,10 +992,10 @@ There are three types of relations:
992992
</tr>
993993
</table>
994994

995-
To define relations in entities, use the corresponding **decorators**. For example, to define that each `User` can have multiple photos, use the `@HasMany()` decorator.
995+
To define relations in models, use the corresponding **decorators**. For example, to define that each `User` can have multiple photos, use the `@HasMany()` decorator.
996996

997997
```typescript
998-
@@filename(user.entity)
998+
@@filename(user.model)
999999
import { Column, Model, Table, HasMany } from 'sequelize-typescript';
10001000
import { Photo } from '../photos/photo.model';
10011001

content/techniques/task-scheduling.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ The `getCronJob()` method returns the named cron job. The returned `CronJob` obj
258258

259259
> info **Hint** Use `toDate()` on `moment` objects to render them in human readable form.
260260
261-
**Create** a new cron job dynamically using the `SchedulerRegistry.addCronJob()` method, as follows:
261+
**Create** a new cron job dynamically using the `SchedulerRegistry#addCronJob` method, as follows:
262262

263263
```typescript
264264
addCronJob(name: string, seconds: string) {
@@ -275,11 +275,11 @@ addCronJob(name: string, seconds: string) {
275275
}
276276
```
277277

278-
In this code, we use the `CronJob` object from the `cron` package to create the cron job. The `CronJob` constructor takes a cron pattern (just like the `@Cron()` <a href="techniques/task-scheduling#declarative-cron-jobs">decorator</a>) as its first argument, and a callback to be executed when the cron timer fires as its second argument. The `SchedulerRegistry.addCronJob()` method takes two arguments: a name for the `CronJob`, and the `CronJob` object itself.
278+
In this code, we use the `CronJob` object from the `cron` package to create the cron job. The `CronJob` constructor takes a cron pattern (just like the `@Cron()` <a href="techniques/task-scheduling#declarative-cron-jobs">decorator</a>) as its first argument, and a callback to be executed when the cron timer fires as its second argument. The `SchedulerRegistry#addCronJob` method takes two arguments: a name for the `CronJob`, and the `CronJob` object itself.
279279

280280
> warning **Warning** Remember to inject the `SchedulerRegistry` before accessing it. Import `CronJob` from the `cron` package.
281281
282-
**Delete** a named cron job using the `SchedulerRegistry.deleteCronJob()` method, as follows:
282+
**Delete** a named cron job using the `SchedulerRegistry#deleteCronJob` method, as follows:
283283

284284
```typescript
285285
deleteCron(name: string) {
@@ -288,7 +288,7 @@ deleteCron(name: string) {
288288
}
289289
```
290290

291-
**List** all cron jobs using the `SchedulerRegistry.getCronJobs()` method as follows:
291+
**List** all cron jobs using the `SchedulerRegistry#getCronJobs` method as follows:
292292

293293
```typescript
294294
getCrons() {
@@ -309,7 +309,7 @@ The `getCronJobs()` method returns a `map`. In this code, we iterate over the ma
309309

310310
#### Dynamic intervals
311311

312-
Obtain a reference to an interval with the `SchedulerRegistry.getInterval()` method. As above, inject `SchedulerRegistry` using standard constructor injection:
312+
Obtain a reference to an interval with the `SchedulerRegistry#getInterval` method. As above, inject `SchedulerRegistry` using standard constructor injection:
313313

314314
```typescript
315315
constructor(private schedulerRegistry: SchedulerRegistry) {}
@@ -322,7 +322,7 @@ const interval = this.schedulerRegistry.getInterval('notifications');
322322
clearInterval(interval);
323323
```
324324

325-
**Create** a new interval dynamically using the `SchedulerRegistry.addInterval()` method, as follows:
325+
**Create** a new interval dynamically using the `SchedulerRegistry#addInterval` method, as follows:
326326

327327
```typescript
328328
addInterval(name: string, milliseconds: number) {
@@ -335,10 +335,10 @@ addInterval(name: string, milliseconds: number) {
335335
}
336336
```
337337

338-
In this code, we create a standard JavaScript interval, then pass it to the `ScheduleRegistry.addInterval()` method.
338+
In this code, we create a standard JavaScript interval, then pass it to the `SchedulerRegistry#addInterval` method.
339339
That method takes two arguments: a name for the interval, and the interval itself.
340340

341-
**Delete** a named interval using the `SchedulerRegistry.deleteInterval()` method, as follows:
341+
**Delete** a named interval using the `SchedulerRegistry#deleteInterval` method, as follows:
342342

343343
```typescript
344344
deleteInterval(name: string) {
@@ -347,7 +347,7 @@ deleteInterval(name: string) {
347347
}
348348
```
349349

350-
**List** all intervals using the `SchedulerRegistry.getIntervals()` method as follows:
350+
**List** all intervals using the `SchedulerRegistry#getIntervals` method as follows:
351351

352352
```typescript
353353
getIntervals() {
@@ -358,10 +358,10 @@ getIntervals() {
358358

359359
#### Dynamic timeouts
360360

361-
Obtain a reference to a timeout with the `SchedulerRegistry.getTimeout()` method. As above, inject `SchedulerRegistry` using standard constructor injection:
361+
Obtain a reference to a timeout with the `SchedulerRegistry#getTimeout` method. As above, inject `SchedulerRegistry` using standard constructor injection:
362362

363363
```typescript
364-
constructor(private schedulerRegistry: SchedulerRegistry) {}
364+
constructor(private readonly schedulerRegistry: SchedulerRegistry) {}
365365
```
366366

367367
And use it as follows:
@@ -371,7 +371,7 @@ const timeout = this.schedulerRegistry.getTimeout('notifications');
371371
clearTimeout(timeout);
372372
```
373373

374-
**Create** a new timeout dynamically using the `SchedulerRegistry.addTimeout()` method, as follows:
374+
**Create** a new timeout dynamically using the `SchedulerRegistry#addTimeout` method, as follows:
375375

376376
```typescript
377377
addTimeout(name: string, milliseconds: number) {
@@ -384,10 +384,10 @@ addTimeout(name: string, milliseconds: number) {
384384
}
385385
```
386386

387-
In this code, we create a standard JavaScript timeout, then pass it to the `ScheduleRegistry.addTimeout()` method.
387+
In this code, we create a standard JavaScript timeout, then pass it to the `SchedulerRegistry#addTimeout` method.
388388
That method takes two arguments: a name for the timeout, and the timeout itself.
389389

390-
**Delete** a named timeout using the `SchedulerRegistry.deleteTimeout()` method, as follows:
390+
**Delete** a named timeout using the `SchedulerRegistry#deleteTimeout` method, as follows:
391391

392392
```typescript
393393
deleteTimeout(name: string) {
@@ -396,7 +396,7 @@ deleteTimeout(name: string) {
396396
}
397397
```
398398

399-
**List** all timeouts using the `SchedulerRegistry.getTimeouts()` method as follows:
399+
**List** all timeouts using the `SchedulerRegistry#getTimeouts` method as follows:
400400

401401
```typescript
402402
getTimeouts() {

0 commit comments

Comments
 (0)