-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: upgrade nestjs to v7 AB#23108
- Loading branch information
1 parent
45e5d55
commit 22c8991
Showing
13 changed files
with
1,162 additions
and
2,499 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,24 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { Controller, Get, Module } from '@nestjs/common'; | ||
import { ApiOperation, ApiTags } from '@nestjs/swagger'; | ||
import { | ||
HealthIndicatorResult, | ||
TerminusModule, | ||
TerminusModuleOptions, | ||
TypeOrmHealthIndicator, | ||
} from '@nestjs/terminus'; | ||
import { TypeOrmModule } from '@nestjs/typeorm'; | ||
|
||
const getTerminusOptions = ( | ||
db: TypeOrmHealthIndicator, | ||
): TerminusModuleOptions => ({ | ||
endpoints: [ | ||
{ | ||
url: '/health', | ||
// All the indicator which will be checked when requesting /health | ||
healthIndicators: [ | ||
// Set the timeout for a response to 300ms | ||
async (): Promise<HealthIndicatorResult> => | ||
db.pingCheck('database', { timeout: 300 }), | ||
], | ||
}, | ||
], | ||
}); | ||
@ApiTags('-- check API --') | ||
@Controller('health') | ||
export class HealthController { | ||
@ApiOperation({ summary: 'Check database connection' }) | ||
@Get() | ||
healthCheck(db: TypeOrmHealthIndicator) { | ||
async (): Promise<HealthIndicatorResult> => | ||
db.pingCheck('database', { timeout: 300 }); | ||
} | ||
} | ||
|
||
@Module({ | ||
imports: [ | ||
// Make sure TypeOrmModule is available in the module context | ||
TypeOrmModule.forRoot(), | ||
TerminusModule.forRootAsync({ | ||
// Inject the TypeOrmHealthIndicator provided by nestjs/terminus | ||
inject: [TypeOrmHealthIndicator], | ||
useFactory: getTerminusOptions, | ||
}), | ||
], | ||
controllers: [HealthController], | ||
imports: [TerminusModule], | ||
}) | ||
export class HealthModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export const FILE_UPLOAD_API_FORMAT = { | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
file: { | ||
type: 'string', | ||
format: 'binary', | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const IMAGE_UPLOAD_API_FORMAT = { | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
image: { | ||
type: 'string', | ||
format: 'binary', | ||
}, | ||
}, | ||
}, | ||
}; |