@mikemajesty/microservice-crud 5.0.9 → 5.0.11
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/templates/mongo/core/entity/entity.js +2 -2
- package/src/templates/mongo/core/use-cases/delete.js +1 -1
- package/src/templates/postgres/core/entity/entity.js +3 -3
- package/src/templates/postgres/core/use-cases/create.js +4 -1
- package/src/templates/postgres/core/use-cases/delete.js +1 -1
- package/src/templates/postgres/core/use-cases/update.js +4 -1
package/package.json
CHANGED
|
@@ -23,11 +23,11 @@ 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 extends BaseEntity<${capitalizeFirstLetter(name)}Entity>() {
|
|
26
|
+
export class ${capitalizeFirstLetter(name)}Entity extends BaseEntity<${capitalizeFirstLetter(name)}Entity>(${capitalizeFirstLetter(name)}EntitySchema) {
|
|
27
27
|
name: string;
|
|
28
28
|
|
|
29
29
|
constructor(entity: ${capitalizeFirstLetter(name)}) {
|
|
30
|
-
super(
|
|
30
|
+
super();
|
|
31
31
|
Object.assign(this, this.validate(entity));
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -32,7 +32,7 @@ export class ${capitalizeFirstLetter(name)}DeleteUsecase implements IUsecase {
|
|
|
32
32
|
|
|
33
33
|
const ${name} = new ${capitalizeFirstLetter(name)}Entity(model);
|
|
34
34
|
|
|
35
|
-
${name}.
|
|
35
|
+
${name}.deactivated();
|
|
36
36
|
|
|
37
37
|
await this.${name}Repository.updateOne({ id: ${name}.id }, ${name});
|
|
38
38
|
|
|
@@ -5,7 +5,7 @@ function capitalizeFirstLetter(string) {
|
|
|
5
5
|
|
|
6
6
|
const getCoreEntity = (name) => `import { z } from 'zod';
|
|
7
7
|
|
|
8
|
-
import { BaseEntity
|
|
8
|
+
import { BaseEntity } from '@/utils/entity';
|
|
9
9
|
|
|
10
10
|
const ID = z.string().uuid();
|
|
11
11
|
const Name = z.string().min(1).max(200).trim();
|
|
@@ -23,11 +23,11 @@ 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 extends BaseEntity<${capitalizeFirstLetter(name)}Entity>() {
|
|
26
|
+
export class ${capitalizeFirstLetter(name)}Entity extends BaseEntity<${capitalizeFirstLetter(name)}Entity>(${capitalizeFirstLetter(name)}EntitySchema) {
|
|
27
27
|
name: string;
|
|
28
28
|
|
|
29
29
|
constructor(entity: ${capitalizeFirstLetter(name)}) {
|
|
30
|
-
super(
|
|
30
|
+
super();
|
|
31
31
|
Object.assign(this, this.validate(entity));
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -21,7 +21,10 @@ export type ${capitalizeFirstLetter(name)}CreateInput = z.infer<typeof ${capital
|
|
|
21
21
|
export type ${capitalizeFirstLetter(name)}CreateOutput = CreatedModel;
|
|
22
22
|
|
|
23
23
|
export class ${capitalizeFirstLetter(name)}CreateUsecase implements IUsecase {
|
|
24
|
-
constructor(
|
|
24
|
+
constructor(
|
|
25
|
+
private readonly ${name}Repository: I${capitalizeFirstLetter(name)}Repository,
|
|
26
|
+
private readonly loggerService: ILoggerAdapter
|
|
27
|
+
) {}
|
|
25
28
|
|
|
26
29
|
@ValidateSchema(${capitalizeFirstLetter(name)}CreateSchema)
|
|
27
30
|
async execute(input: ${capitalizeFirstLetter(name)}CreateInput): Promise<${capitalizeFirstLetter(name)}CreateOutput> {
|
|
@@ -32,7 +32,7 @@ export class ${capitalizeFirstLetter(name)}DeleteUsecase implements IUsecase {
|
|
|
32
32
|
|
|
33
33
|
const ${name} = new ${capitalizeFirstLetter(name)}Entity(model);
|
|
34
34
|
|
|
35
|
-
${name}.
|
|
35
|
+
${name}.deactivated();
|
|
36
36
|
|
|
37
37
|
await this.${name}Repository.updateOne({ id: ${name}.id }, ${name});
|
|
38
38
|
|
|
@@ -21,7 +21,10 @@ export type ${capitalizeFirstLetter(name)}UpdateInput = z.infer<typeof ${capital
|
|
|
21
21
|
export type ${capitalizeFirstLetter(name)}UpdateOutput = ${capitalizeFirstLetter(name)}Entity;
|
|
22
22
|
|
|
23
23
|
export class ${capitalizeFirstLetter(name)}UpdateUsecase implements IUsecase {
|
|
24
|
-
constructor(
|
|
24
|
+
constructor(
|
|
25
|
+
private readonly ${name}Repository: I${capitalizeFirstLetter(name)}Repository,
|
|
26
|
+
private readonly loggerService: ILoggerAdapter
|
|
27
|
+
) {}
|
|
25
28
|
|
|
26
29
|
@ValidateSchema(${capitalizeFirstLetter(name)}UpdateSchema)
|
|
27
30
|
async execute(input: ${capitalizeFirstLetter(name)}UpdateInput): Promise<${capitalizeFirstLetter(name)}UpdateOutput> {
|