@mikemajesty/microservice-crud 4.5.15 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/postgres.README.md
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
#### Postgres CRUD
|
|
2
2
|
|
|
3
|
-
### Add Schema to Sequelize.
|
|
4
|
-
|
|
5
|
-
- Access the config.ts file
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
src/infra/database/postgres/service.ts
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
- Add your Postgres schema in the addModels function.
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
instance.addModels([NewSchema]);
|
|
15
|
-
```
|
|
16
|
-
|
|
17
3
|
### Add Module to microservice.
|
|
18
4
|
|
|
19
5
|
- Access the app.module.ts file
|
|
@@ -6,18 +6,22 @@ function capitalizeFirstLetter(string) {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
const getModuleControllerModule = (name) => `import { Controller, Get, Req } from '@nestjs/common';
|
|
9
|
-
import {
|
|
9
|
+
import { ApiResponse, ApiTags } from '@nestjs/swagger';
|
|
10
10
|
|
|
11
11
|
import { ApiRequest } from '@/utils/request';
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { SwaggerResponse } from './swagger';
|
|
14
14
|
|
|
15
15
|
@Controller('${pluralize(name)}')
|
|
16
|
+
<<<<<<< HEAD
|
|
17
|
+
@ApiTags('${pluralize(name)}')
|
|
18
|
+
=======
|
|
16
19
|
@ApiTags('${name}')
|
|
17
20
|
@ApiBearerAuth()
|
|
21
|
+
>>>>>>> 4620d9e9fb7378a4428710f30a5e36d07508a3b8
|
|
18
22
|
export class ${capitalizeFirstLetter(name)}Controller {
|
|
19
23
|
@Get()
|
|
20
|
-
@ApiResponse(
|
|
24
|
+
@ApiResponse(SwaggerResponse.get[200])
|
|
21
25
|
async get(@Req() {}: ApiRequest): Promise<string> {
|
|
22
26
|
return 'text';
|
|
23
27
|
}
|
|
@@ -2,24 +2,15 @@ function capitalizeFirstLetter(string) {
|
|
|
2
2
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
const getModuleModule = (name) => `import {
|
|
6
|
-
|
|
7
|
-
import { IsLoggedMiddleware } from '@/observables/middlewares';
|
|
8
|
-
import { RedisCacheModule } from '@/infra/cache/redis';
|
|
9
|
-
import { LoggerModule } from '@/infra/logger';
|
|
10
|
-
import { TokenLibModule } from '@/libs/token';
|
|
5
|
+
const getModuleModule = (name) => `import { Module } from '@nestjs/common';
|
|
11
6
|
|
|
12
7
|
import { ${capitalizeFirstLetter(name)}Controller } from './controller';
|
|
13
8
|
|
|
14
9
|
@Module({
|
|
15
|
-
imports: [
|
|
10
|
+
imports: [],
|
|
16
11
|
controllers: [${capitalizeFirstLetter(name)}Controller]
|
|
17
12
|
})
|
|
18
|
-
export class ${capitalizeFirstLetter(name)}Module
|
|
19
|
-
configure(consumer: MiddlewareConsumer) {
|
|
20
|
-
consumer.apply(IsLoggedMiddleware).forRoutes(${capitalizeFirstLetter(name)}Controller);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
13
|
+
export class ${capitalizeFirstLetter(name)}Module {}
|
|
23
14
|
`
|
|
24
15
|
|
|
25
16
|
module.exports = {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
const getModuleSwaggerModule = (name) => `import { Swagger } from '@/utils/docs/swagger';
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const SwaggerResponse = {
|
|
4
4
|
get: {
|
|
5
5
|
200: Swagger.defaultResponseJSON({
|
|
6
6
|
status: 200,
|
|
7
7
|
json: 'text',
|
|
8
|
-
description: '${name}
|
|
8
|
+
description: 'get ${name}.'
|
|
9
9
|
})
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export const
|
|
13
|
+
export const SwaggerRequest = {};
|
|
14
14
|
`
|
|
15
15
|
|
|
16
16
|
module.exports = {
|