@mikemajesty/microservice-crud 0.1.4 → 0.1.5
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 +1 -1
- package/src/cli.js +2 -1
- package/src/templates/mongo/core/entity/entity.js +3 -14
- package/src/templates/mongo/core/use-cases/delete.js +1 -1
- package/src/templates/mongo/modules/swagger.js +1 -1
- package/src/templates/postgres/core/entity/entity.js +3 -14
- package/src/templates/postgres/core/use-cases/delete.js +1 -1
- package/src/templates/postgres/modules/swagger.js +1 -1
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -245,7 +245,8 @@ export async function cli(args) {
|
|
|
245
245
|
|
|
246
246
|
try {
|
|
247
247
|
|
|
248
|
-
const dest =
|
|
248
|
+
const dest = '/home/mike/Documents/pessoal/nestjs-microservice-boilerplate-api'
|
|
249
|
+
// const dest = path.resolve(`${__dirname}/../../../../`)
|
|
249
250
|
|
|
250
251
|
const src = paths[0]
|
|
251
252
|
|
|
@@ -5,7 +5,7 @@ function capitalizeFirstLetter(string) {
|
|
|
5
5
|
|
|
6
6
|
const getCoreEntity = (name) => `import { z } from 'zod';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { BaseEntity, withID } from '@/utils/entity';
|
|
9
9
|
|
|
10
10
|
const ID = z.string().uuid();
|
|
11
11
|
const Name = z.string().min(1).max(200).trim();
|
|
@@ -23,24 +23,13 @@ export const ${capitalizeFirstLetter(name)}EntitySchema = z.object({
|
|
|
23
23
|
|
|
24
24
|
type ${capitalizeFirstLetter(name)} = z.infer<typeof ${capitalizeFirstLetter(name)}EntitySchema>;
|
|
25
25
|
|
|
26
|
-
export class ${capitalizeFirstLetter(name)}Entity
|
|
27
|
-
id: string;
|
|
28
|
-
|
|
26
|
+
export class ${capitalizeFirstLetter(name)}Entity extends BaseEntity<${capitalizeFirstLetter(name)}Entity>() {
|
|
29
27
|
name: string;
|
|
30
28
|
|
|
31
|
-
deletedAt?: Date;
|
|
32
|
-
|
|
33
|
-
createdAt: Date;
|
|
34
|
-
|
|
35
|
-
updatedAt: Date;
|
|
36
|
-
|
|
37
29
|
constructor(entity: ${capitalizeFirstLetter(name)}) {
|
|
30
|
+
super();
|
|
38
31
|
Object.assign(this, ${capitalizeFirstLetter(name)}EntitySchema.parse(withID(entity)));
|
|
39
32
|
}
|
|
40
|
-
|
|
41
|
-
setDelete() {
|
|
42
|
-
this.deletedAt = new Date();
|
|
43
|
-
}
|
|
44
33
|
}
|
|
45
34
|
`
|
|
46
35
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const pluralize = require('pluralize')
|
|
2
2
|
|
|
3
3
|
const getModuleSwagger = (name) => `import { CreatedModel } from '@/infra/repository/types';
|
|
4
|
-
import { Swagger } from '@/utils/swagger';
|
|
4
|
+
import { Swagger } from '@/utils/docs/swagger';
|
|
5
5
|
|
|
6
6
|
const entity = {
|
|
7
7
|
name: '<name>'
|
|
@@ -5,7 +5,7 @@ function capitalizeFirstLetter(string) {
|
|
|
5
5
|
|
|
6
6
|
const getCoreEntity = (name) => `import { z } from 'zod';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { BaseEntity, withID } from '@/utils/entity';
|
|
9
9
|
|
|
10
10
|
const ID = z.string().uuid();
|
|
11
11
|
const Name = z.string().min(1).max(200).trim();
|
|
@@ -23,24 +23,13 @@ export const ${capitalizeFirstLetter(name)}EntitySchema = z.object({
|
|
|
23
23
|
|
|
24
24
|
type ${capitalizeFirstLetter(name)} = z.infer<typeof ${capitalizeFirstLetter(name)}EntitySchema>;
|
|
25
25
|
|
|
26
|
-
export class ${capitalizeFirstLetter(name)}Entity
|
|
27
|
-
id: string;
|
|
28
|
-
|
|
26
|
+
export class ${capitalizeFirstLetter(name)}Entity extends BaseEntity<${capitalizeFirstLetter(name)}Entity>() {
|
|
29
27
|
name: string;
|
|
30
28
|
|
|
31
|
-
deletedAt?: Date;
|
|
32
|
-
|
|
33
|
-
createdAt: Date;
|
|
34
|
-
|
|
35
|
-
updatedAt: Date;
|
|
36
|
-
|
|
37
29
|
constructor(entity: ${capitalizeFirstLetter(name)}) {
|
|
30
|
+
super();
|
|
38
31
|
Object.assign(this, ${capitalizeFirstLetter(name)}EntitySchema.parse(withID(entity)));
|
|
39
32
|
}
|
|
40
|
-
|
|
41
|
-
setDelete() {
|
|
42
|
-
this.deletedAt = new Date();
|
|
43
|
-
}
|
|
44
33
|
}
|
|
45
34
|
`
|
|
46
35
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const pluralize = require('pluralize')
|
|
2
2
|
|
|
3
3
|
const getModuleSwagger = (name) => `import { CreatedModel } from '@/infra/repository/types';
|
|
4
|
-
import { Swagger } from '@/utils/swagger';
|
|
4
|
+
import { Swagger } from '@/utils/docs/swagger';
|
|
5
5
|
|
|
6
6
|
const entity = {
|
|
7
7
|
name: '<name>'
|