@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikemajesty/microservice-crud",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Monorepo CLI",
5
5
  "main": "src/cli.js",
6
6
  "scripts": {
package/src/cli.js CHANGED
@@ -245,7 +245,8 @@ export async function cli(args) {
245
245
 
246
246
  try {
247
247
 
248
- const dest = path.resolve(`${__dirname}/../../../../`)
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 { IEntity, withID } from '@/utils/entity';
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 implements IEntity {
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
 
@@ -31,7 +31,7 @@ export class ${capitalizeFirstLetter(name)}DeleteUsecase {
31
31
 
32
32
  const ${name} = new ${capitalizeFirstLetter(name)}Entity(model);
33
33
 
34
- ${name}.setDelete();
34
+ ${name}.setDeleted();
35
35
 
36
36
  await this.${name}Repository.updateOne({ id: ${name}.id }, ${name});
37
37
 
@@ -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 { IEntity, withID } from '@/utils/entity';
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 implements IEntity {
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
 
@@ -32,7 +32,7 @@ export class ${capitalizeFirstLetter(name)}DeleteUsecase {
32
32
 
33
33
  const ${name} = new ${capitalizeFirstLetter(name)}Entity(model);
34
34
 
35
- ${name}.setDelete();
35
+ ${name}.setDeleted();
36
36
 
37
37
  await this.${name}Repository.updateOne({ id: ${name}.id }, ${name});
38
38
 
@@ -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>'