@things-factory/shell 6.0.107 → 6.0.113

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.
Files changed (33) hide show
  1. package/dist-server/service/domain/domain-resolver.d.ts +1 -0
  2. package/dist-server/service/domain/domain-resolver.js +16 -0
  3. package/dist-server/service/domain/domain-resolver.js.map +1 -1
  4. package/dist-server/service/domain/domain-types.d.ts +3 -0
  5. package/dist-server/service/domain/domain-types.js +8 -0
  6. package/dist-server/service/domain/domain-types.js.map +1 -1
  7. package/dist-server/service/domain/domain.d.ts +2 -0
  8. package/dist-server/service/domain/domain.js +23 -32
  9. package/dist-server/service/domain/domain.js.map +1 -1
  10. package/dist-server/service/index.d.ts +1 -1
  11. package/dist-server/tsconfig.tsbuildinfo +1 -1
  12. package/package.json +2 -2
  13. package/server/service/domain/domain-resolver.ts +14 -1
  14. package/server/service/domain/domain-types.ts +7 -1
  15. package/server/service/domain/domain.ts +20 -32
  16. package/dist-server/service/attribute/attribute-item-type.d.ts +0 -29
  17. package/dist-server/service/attribute/attribute-item-type.js +0 -81
  18. package/dist-server/service/attribute/attribute-item-type.js.map +0 -1
  19. package/dist-server/service/attribute/attribute-mutation.d.ts +0 -10
  20. package/dist-server/service/attribute/attribute-mutation.js +0 -130
  21. package/dist-server/service/attribute/attribute-mutation.js.map +0 -1
  22. package/dist-server/service/attribute/attribute-query.d.ts +0 -8
  23. package/dist-server/service/attribute/attribute-query.js +0 -60
  24. package/dist-server/service/attribute/attribute-query.js.map +0 -1
  25. package/dist-server/service/attribute/attribute-type.d.ts +0 -19
  26. package/dist-server/service/attribute/attribute-type.js +0 -70
  27. package/dist-server/service/attribute/attribute-type.js.map +0 -1
  28. package/dist-server/service/attribute/attribute.d.ts +0 -9
  29. package/dist-server/service/attribute/attribute.js +0 -52
  30. package/dist-server/service/attribute/attribute.js.map +0 -1
  31. package/dist-server/service/attribute/index.d.ts +0 -5
  32. package/dist-server/service/attribute/index.js +0 -9
  33. package/dist-server/service/attribute/index.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/shell",
3
- "version": "6.0.107",
3
+ "version": "6.0.113",
4
4
  "description": "Core module for framework",
5
5
  "bin": {
6
6
  "things-factory": "bin/things-factory",
@@ -129,5 +129,5 @@
129
129
  "pg": "^8.7.3",
130
130
  "sqlite3": "^5.0.8"
131
131
  },
132
- "gitHead": "fa6d3ad23a445081db89b26e75a696fb46a38bd6"
132
+ "gitHead": "1f753c3122911f7e014edae7e469784cdfb8678e"
133
133
  }
@@ -1,4 +1,4 @@
1
- import { Arg, Args, Ctx, Directive, Mutation, Query, Resolver } from 'type-graphql'
1
+ import { Arg, Args, Ctx, Directive, Mutation, Query, Resolver, FieldResolver, Root } from 'type-graphql'
2
2
  import { In, Repository } from 'typeorm'
3
3
 
4
4
  import { slugger } from '@things-factory/utils'
@@ -92,6 +92,10 @@ export class DomainResolver {
92
92
  const repository = getRepository(Domain)
93
93
  const domain: Domain = await repository.findOneBy({ name })
94
94
 
95
+ if (patch.parent && patch.parent.id == domain.id) {
96
+ delete patch.parent
97
+ }
98
+
95
99
  return await repository.save({
96
100
  ...domain,
97
101
  ...patch
@@ -116,6 +120,10 @@ export class DomainResolver {
116
120
  updateRecord.subdomain = slugger(updateRecord.name)
117
121
  }
118
122
 
123
+ if (updateRecord.parent && updateRecord.parent.id == domain.id) {
124
+ delete updateRecord.parent
125
+ }
126
+
119
127
  await domainRepo.save({
120
128
  ...domain,
121
129
  ...updateRecord
@@ -125,4 +133,9 @@ export class DomainResolver {
125
133
 
126
134
  return true
127
135
  }
136
+
137
+ @FieldResolver(type => Domain)
138
+ async parent(@Root() domain: Domain): Promise<Domain> {
139
+ return domain.parentId && (await getRepository(Domain).findOneBy({ id: domain.parentId }))
140
+ }
128
141
  }
@@ -1,6 +1,6 @@
1
1
  import { ObjectType, InputType, Field, Int } from 'type-graphql'
2
2
  import { Domain } from './domain'
3
- import { ScalarObject } from '../common-types'
3
+ import { ObjectRef, ScalarObject } from '../common-types'
4
4
 
5
5
  @InputType()
6
6
  export class DomainInput {
@@ -31,6 +31,12 @@ export class DomainPatch {
31
31
  @Field({ nullable: true })
32
32
  subdomain?: string
33
33
 
34
+ @Field({ nullable: true })
35
+ owner?: string
36
+
37
+ @Field(type => ObjectRef, { nullable: true })
38
+ parent?: ObjectRef
39
+
34
40
  @Field({ nullable: true })
35
41
  brandName?: string
36
42
 
@@ -1,5 +1,5 @@
1
- import { Column, CreateDateColumn, Entity, Index, UpdateDateColumn } from 'typeorm'
2
- import { ObjectType, Field, ID } from 'type-graphql'
1
+ import { Column, CreateDateColumn, ManyToOne, RelationId, Entity, Index, UpdateDateColumn } from 'typeorm'
2
+ import { ObjectType, Directive, Field, ID } from 'type-graphql'
3
3
  import { config } from '@things-factory/env'
4
4
  import { ScalarObject } from '../common-types'
5
5
 
@@ -47,57 +47,47 @@ export class Domain {
47
47
  readonly id: string
48
48
 
49
49
  @Field()
50
- @Column({
51
- unique: true
52
- })
50
+ @Column({ unique: true })
53
51
  name: string
54
52
 
55
53
  @Field({ nullable: true })
56
- @Column({
57
- nullable: true
58
- })
54
+ @Column({ nullable: true })
59
55
  description: string
60
56
 
61
57
  @Field({ nullable: true })
62
- @Column({
63
- nullable: true
64
- })
58
+ @Column({ nullable: true })
65
59
  extType: string
66
60
 
67
61
  @Field({ nullable: true })
68
- @Column({
69
- nullable: true
70
- })
62
+ @Column({ nullable: true })
71
63
  timezone: string
72
64
 
65
+ @Directive('@deprecated(reason: "Use `parent`")')
73
66
  @Field({ nullable: true })
74
- @Column({
75
- default: false
76
- })
67
+ @Column({ default: false })
77
68
  systemFlag: boolean
78
69
 
79
70
  @Field({ nullable: true })
80
- @Column({
81
- nullable: true
82
- })
71
+ @Column({ nullable: true })
83
72
  subdomain: string
84
73
 
85
74
  @Field({ nullable: true })
86
- @Column({
87
- nullable: true
88
- })
75
+ @ManyToOne(type => Domain, { nullable: true })
76
+ parent: Domain
77
+
78
+ @RelationId((domain: Domain) => domain.parent)
79
+ parentId?: string
80
+
81
+ @Field({ nullable: true })
82
+ @Column({ nullable: true })
89
83
  brandName: string
90
84
 
91
85
  @Field({ nullable: true })
92
- @Column({
93
- nullable: true
94
- })
86
+ @Column({ nullable: true })
95
87
  brandImage: string
96
88
 
97
89
  @Field({ nullable: true })
98
- @Column({
99
- nullable: true
100
- })
90
+ @Column({ nullable: true })
101
91
  contentImage: string
102
92
 
103
93
  @Field({ nullable: true })
@@ -105,9 +95,7 @@ export class Domain {
105
95
  owner: string
106
96
 
107
97
  @Field({ nullable: true })
108
- @Column({
109
- nullable: true
110
- })
98
+ @Column({ nullable: true })
111
99
  theme: string
112
100
 
113
101
  @Column('simple-json', { nullable: true })
@@ -1,29 +0,0 @@
1
- export declare enum AttributeItemType {
2
- number = "number",
3
- text = "text",
4
- boolean = "boolean",
5
- select = "select",
6
- date = "date",
7
- datetime = "datetime",
8
- file = "file"
9
- }
10
- export declare class AttributeItem {
11
- name: string;
12
- description?: string;
13
- active?: boolean;
14
- hidden?: boolean;
15
- type?: AttributeItemType;
16
- options?: {
17
- [option: string]: any;
18
- };
19
- }
20
- export declare class AttributeItemPatch {
21
- name?: string;
22
- description?: string;
23
- type?: AttributeItemType;
24
- options?: {
25
- [option: string]: any;
26
- };
27
- active?: boolean;
28
- hidden?: boolean;
29
- }
@@ -1,81 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AttributeItemPatch = exports.AttributeItem = exports.AttributeItemType = void 0;
4
- const tslib_1 = require("tslib");
5
- const type_graphql_1 = require("type-graphql");
6
- const common_types_1 = require("../common-types");
7
- var AttributeItemType;
8
- (function (AttributeItemType) {
9
- AttributeItemType["number"] = "number";
10
- AttributeItemType["text"] = "text";
11
- AttributeItemType["boolean"] = "boolean";
12
- AttributeItemType["select"] = "select";
13
- AttributeItemType["date"] = "date";
14
- AttributeItemType["datetime"] = "datetime";
15
- AttributeItemType["file"] = "file";
16
- })(AttributeItemType = exports.AttributeItemType || (exports.AttributeItemType = {}));
17
- (0, type_graphql_1.registerEnumType)(AttributeItemType, {
18
- name: 'AttributeItemType',
19
- description: 'type enumeration of a attribute-item'
20
- });
21
- let AttributeItem = class AttributeItem {
22
- };
23
- tslib_1.__decorate([
24
- (0, type_graphql_1.Field)(),
25
- tslib_1.__metadata("design:type", String)
26
- ], AttributeItem.prototype, "name", void 0);
27
- tslib_1.__decorate([
28
- (0, type_graphql_1.Field)({ nullable: true }),
29
- tslib_1.__metadata("design:type", String)
30
- ], AttributeItem.prototype, "description", void 0);
31
- tslib_1.__decorate([
32
- (0, type_graphql_1.Field)({ nullable: true }),
33
- tslib_1.__metadata("design:type", Boolean)
34
- ], AttributeItem.prototype, "active", void 0);
35
- tslib_1.__decorate([
36
- (0, type_graphql_1.Field)({ nullable: true }),
37
- tslib_1.__metadata("design:type", Boolean)
38
- ], AttributeItem.prototype, "hidden", void 0);
39
- tslib_1.__decorate([
40
- (0, type_graphql_1.Field)({ nullable: true }),
41
- tslib_1.__metadata("design:type", String)
42
- ], AttributeItem.prototype, "type", void 0);
43
- tslib_1.__decorate([
44
- (0, type_graphql_1.Field)(type => common_types_1.ScalarObject, { nullable: true }),
45
- tslib_1.__metadata("design:type", Object)
46
- ], AttributeItem.prototype, "options", void 0);
47
- AttributeItem = tslib_1.__decorate([
48
- (0, type_graphql_1.ObjectType)({ description: 'Entity for AttributeItem' })
49
- ], AttributeItem);
50
- exports.AttributeItem = AttributeItem;
51
- let AttributeItemPatch = class AttributeItemPatch {
52
- };
53
- tslib_1.__decorate([
54
- (0, type_graphql_1.Field)({ nullable: true }),
55
- tslib_1.__metadata("design:type", String)
56
- ], AttributeItemPatch.prototype, "name", void 0);
57
- tslib_1.__decorate([
58
- (0, type_graphql_1.Field)({ nullable: true }),
59
- tslib_1.__metadata("design:type", String)
60
- ], AttributeItemPatch.prototype, "description", void 0);
61
- tslib_1.__decorate([
62
- (0, type_graphql_1.Field)(type => AttributeItemType, { nullable: true }),
63
- tslib_1.__metadata("design:type", String)
64
- ], AttributeItemPatch.prototype, "type", void 0);
65
- tslib_1.__decorate([
66
- (0, type_graphql_1.Field)(type => common_types_1.ScalarObject, { nullable: true }),
67
- tslib_1.__metadata("design:type", Object)
68
- ], AttributeItemPatch.prototype, "options", void 0);
69
- tslib_1.__decorate([
70
- (0, type_graphql_1.Field)({ nullable: true }),
71
- tslib_1.__metadata("design:type", Boolean)
72
- ], AttributeItemPatch.prototype, "active", void 0);
73
- tslib_1.__decorate([
74
- (0, type_graphql_1.Field)({ nullable: true }),
75
- tslib_1.__metadata("design:type", Boolean)
76
- ], AttributeItemPatch.prototype, "hidden", void 0);
77
- AttributeItemPatch = tslib_1.__decorate([
78
- (0, type_graphql_1.InputType)()
79
- ], AttributeItemPatch);
80
- exports.AttributeItemPatch = AttributeItemPatch;
81
- //# sourceMappingURL=attribute-item-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attribute-item-type.js","sourceRoot":"","sources":["../../../server/service/attribute/attribute-item-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAkF;AAClF,kDAA8C;AAE9C,IAAY,iBAQX;AARD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,kCAAa,CAAA;IACb,wCAAmB,CAAA;IACnB,sCAAiB,CAAA;IACjB,kCAAa,CAAA;IACb,0CAAqB,CAAA;IACrB,kCAAa,CAAA;AACf,CAAC,EARW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAQ5B;AAED,IAAA,+BAAgB,EAAC,iBAAiB,EAAE;IAClC,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,sCAAsC;CACpD,CAAC,CAAA;AAGK,IAAM,aAAa,GAAnB,MAAM,aAAa;CAkBzB,CAAA;AAjBC;IAAC,IAAA,oBAAK,GAAE;;2CACI;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACF;AAExB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,2BAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACb;AAjBxB,aAAa;IADzB,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,0BAA0B,EAAE,CAAC;GAC3C,aAAa,CAkBzB;AAlBY,sCAAa;AAqBnB,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAkB9B,CAAA;AAjBC;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACb;AAEb;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAiB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDAC7B;AAExB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,2BAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACb;AAEnC;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACV;AAjBL,kBAAkB;IAD9B,IAAA,wBAAS,GAAE;GACC,kBAAkB,CAkB9B;AAlBY,gDAAkB","sourcesContent":["import { Field, InputType, Int, ObjectType, registerEnumType } from 'type-graphql'\nimport { ScalarObject } from '../common-types'\n\nexport enum AttributeItemType {\n number = 'number',\n text = 'text',\n boolean = 'boolean',\n select = 'select',\n date = 'date',\n datetime = 'datetime',\n file = 'file'\n}\n\nregisterEnumType(AttributeItemType, {\n name: 'AttributeItemType',\n description: 'type enumeration of a attribute-item'\n})\n\n@ObjectType({ description: 'Entity for AttributeItem' })\nexport class AttributeItem {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n hidden?: boolean\n\n @Field({ nullable: true })\n type?: AttributeItemType\n\n @Field(type => ScalarObject, { nullable: true })\n options?: { [option: string]: any }\n}\n\n@InputType()\nexport class AttributeItemPatch {\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => AttributeItemType, { nullable: true })\n type?: AttributeItemType\n\n @Field(type => ScalarObject, { nullable: true })\n options?: { [option: string]: any }\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n hidden?: boolean\n}\n"]}
@@ -1,10 +0,0 @@
1
- import { Attribute } from './attribute';
2
- import { NewAttribute, AttributePatch } from './attribute-type';
3
- export declare class AttributeMutation {
4
- createAttribute(attribute: NewAttribute, context: any): Promise<Attribute>;
5
- updateAttribute(id: string, patch: AttributePatch, context: any): Promise<Attribute>;
6
- updateMultipleAttribute(patches: AttributePatch[], context: any): Promise<Attribute[]>;
7
- deleteAttribute(id: string, context: any): Promise<boolean>;
8
- deleteAttributes(ids: string[], context: any): Promise<boolean>;
9
- importAttributes(attributes: AttributePatch[], context: any): Promise<boolean>;
10
- }
@@ -1,130 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AttributeMutation = void 0;
4
- const tslib_1 = require("tslib");
5
- const type_graphql_1 = require("type-graphql");
6
- const typeorm_1 = require("typeorm");
7
- const attribute_1 = require("./attribute");
8
- const attribute_type_1 = require("./attribute-type");
9
- let AttributeMutation = class AttributeMutation {
10
- async createAttribute(attribute, context) {
11
- const { tx } = context.state;
12
- return await tx.getRepository(attribute_1.Attribute).save(Object.assign({}, attribute));
13
- }
14
- async updateAttribute(id, patch, context) {
15
- const { tx } = context.state;
16
- const repository = tx.getRepository(attribute_1.Attribute);
17
- const attribute = await repository.findOne({
18
- where: { id }
19
- });
20
- return await repository.save(Object.assign(Object.assign({}, attribute), patch));
21
- }
22
- async updateMultipleAttribute(patches, context) {
23
- const { tx } = context.state;
24
- let results = [];
25
- const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
26
- const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
27
- const attributeRepo = tx.getRepository(attribute_1.Attribute);
28
- if (_createRecords.length > 0) {
29
- for (let i = 0; i < _createRecords.length; i++) {
30
- const newRecord = _createRecords[i];
31
- const result = await attributeRepo.save(Object.assign({}, newRecord));
32
- results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
33
- }
34
- }
35
- if (_updateRecords.length > 0) {
36
- for (let i = 0; i < _updateRecords.length; i++) {
37
- const updateRecord = _updateRecords[i];
38
- const attribute = await attributeRepo.findOneBy({ id: updateRecord.id });
39
- const result = await attributeRepo.save(Object.assign(Object.assign({}, attribute), updateRecord));
40
- results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
41
- }
42
- }
43
- return results;
44
- }
45
- async deleteAttribute(id, context) {
46
- const { tx } = context.state;
47
- await tx.getRepository(attribute_1.Attribute).delete({ id });
48
- return true;
49
- }
50
- async deleteAttributes(ids, context) {
51
- const { tx } = context.state;
52
- await tx.getRepository(attribute_1.Attribute).delete({
53
- id: (0, typeorm_1.In)(ids)
54
- });
55
- return true;
56
- }
57
- async importAttributes(attributes, context) {
58
- const { tx } = context.state;
59
- await Promise.all(attributes.map(async (attribute) => {
60
- await tx.getRepository(attribute_1.Attribute).save(attribute);
61
- }));
62
- return true;
63
- }
64
- };
65
- tslib_1.__decorate([
66
- (0, type_graphql_1.Directive)('@transaction'),
67
- (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
68
- (0, type_graphql_1.Mutation)(returns => attribute_1.Attribute, { description: 'To create new Attribute' }),
69
- tslib_1.__param(0, (0, type_graphql_1.Arg)('attribute')),
70
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
71
- tslib_1.__metadata("design:type", Function),
72
- tslib_1.__metadata("design:paramtypes", [attribute_type_1.NewAttribute, Object]),
73
- tslib_1.__metadata("design:returntype", Promise)
74
- ], AttributeMutation.prototype, "createAttribute", null);
75
- tslib_1.__decorate([
76
- (0, type_graphql_1.Directive)('@transaction'),
77
- (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
78
- (0, type_graphql_1.Mutation)(returns => attribute_1.Attribute, { description: 'To modify Attribute information' }),
79
- tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
80
- tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
81
- tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
82
- tslib_1.__metadata("design:type", Function),
83
- tslib_1.__metadata("design:paramtypes", [String, attribute_type_1.AttributePatch, Object]),
84
- tslib_1.__metadata("design:returntype", Promise)
85
- ], AttributeMutation.prototype, "updateAttribute", null);
86
- tslib_1.__decorate([
87
- (0, type_graphql_1.Directive)('@transaction'),
88
- (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
89
- (0, type_graphql_1.Mutation)(returns => [attribute_1.Attribute], { description: "To modify multiple Attributes' information" }),
90
- tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [attribute_type_1.AttributePatch])),
91
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
92
- tslib_1.__metadata("design:type", Function),
93
- tslib_1.__metadata("design:paramtypes", [Array, Object]),
94
- tslib_1.__metadata("design:returntype", Promise)
95
- ], AttributeMutation.prototype, "updateMultipleAttribute", null);
96
- tslib_1.__decorate([
97
- (0, type_graphql_1.Directive)('@transaction'),
98
- (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
99
- (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete Attribute' }),
100
- tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
101
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
102
- tslib_1.__metadata("design:type", Function),
103
- tslib_1.__metadata("design:paramtypes", [String, Object]),
104
- tslib_1.__metadata("design:returntype", Promise)
105
- ], AttributeMutation.prototype, "deleteAttribute", null);
106
- tslib_1.__decorate([
107
- (0, type_graphql_1.Directive)('@transaction'),
108
- (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
109
- (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple Attributes' }),
110
- tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
111
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
112
- tslib_1.__metadata("design:type", Function),
113
- tslib_1.__metadata("design:paramtypes", [Array, Object]),
114
- tslib_1.__metadata("design:returntype", Promise)
115
- ], AttributeMutation.prototype, "deleteAttributes", null);
116
- tslib_1.__decorate([
117
- (0, type_graphql_1.Directive)('@transaction'),
118
- (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
119
- (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple Attributes' }),
120
- tslib_1.__param(0, (0, type_graphql_1.Arg)('attributes', type => [attribute_type_1.AttributePatch])),
121
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
122
- tslib_1.__metadata("design:type", Function),
123
- tslib_1.__metadata("design:paramtypes", [Array, Object]),
124
- tslib_1.__metadata("design:returntype", Promise)
125
- ], AttributeMutation.prototype, "importAttributes", null);
126
- AttributeMutation = tslib_1.__decorate([
127
- (0, type_graphql_1.Resolver)(attribute_1.Attribute)
128
- ], AttributeMutation);
129
- exports.AttributeMutation = AttributeMutation;
130
- //# sourceMappingURL=attribute-mutation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attribute-mutation.js","sourceRoot":"","sources":["../../../server/service/attribute/attribute-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,q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A;;;;yDAWP;AApHU,iBAAiB;IAD7B,IAAA,uBAAQ,EAAC,qBAAS,CAAC;GACP,iBAAiB,CAqH7B;AArHY,8CAAiB","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { Attribute } from './attribute'\nimport { NewAttribute, AttributePatch } from './attribute-type'\n\n@Resolver(Attribute)\nexport class AttributeMutation {\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Attribute, { description: 'To create new Attribute' })\n async createAttribute(@Arg('attribute') attribute: NewAttribute, @Ctx() context: any): Promise<Attribute> {\n const { tx } = context.state\n\n return await tx.getRepository(Attribute).save({\n ...attribute\n })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Attribute, { description: 'To modify Attribute information' })\n async updateAttribute(\n @Arg('id') id: string,\n @Arg('patch') patch: AttributePatch,\n @Ctx() context: any\n ): Promise<Attribute> {\n const { tx } = context.state\n\n const repository = tx.getRepository(Attribute)\n const attribute = await repository.findOne({\n where: { id }\n })\n\n return await repository.save({\n ...attribute,\n ...patch\n })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => [Attribute], { description: \"To modify multiple Attributes' information\" })\n async updateMultipleAttribute(\n @Arg('patches', type => [AttributePatch]) patches: AttributePatch[],\n @Ctx() context: any\n ): Promise<Attribute[]> {\n const { tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const attributeRepo = tx.getRepository(Attribute)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await attributeRepo.save({\n ...newRecord\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n const attribute = await attributeRepo.findOneBy({ id: updateRecord.id })\n\n const result = await attributeRepo.save({\n ...attribute,\n ...updateRecord\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete Attribute' })\n async deleteAttribute(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(Attribute).delete({ id })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete multiple Attributes' })\n async deleteAttributes(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(Attribute).delete({\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, { description: 'To import multiple Attributes' })\n async importAttributes(\n @Arg('attributes', type => [AttributePatch]) attributes: AttributePatch[],\n @Ctx() context: any\n ): Promise<boolean> {\n const { tx } = context.state\n\n await Promise.all(\n attributes.map(async (attribute: AttributePatch) => {\n await tx.getRepository(Attribute).save(attribute)\n })\n )\n\n return true\n }\n}\n"]}
@@ -1,8 +0,0 @@
1
- import { Attribute } from './attribute';
2
- import { AttributeList } from './attribute-type';
3
- import { ListParam } from '../common-types';
4
- export declare class AttributeQuery {
5
- attribute(id: string, context: any): Promise<Attribute>;
6
- attributeByEntity(entity: string, context: any): Promise<Attribute>;
7
- attributes(params: ListParam, context: any): Promise<AttributeList>;
8
- }
@@ -1,60 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AttributeQuery = void 0;
4
- const tslib_1 = require("tslib");
5
- const type_graphql_1 = require("type-graphql");
6
- const attribute_1 = require("./attribute");
7
- const attribute_type_1 = require("./attribute-type");
8
- const common_types_1 = require("../common-types");
9
- const database_1 = require("../../initializers/database");
10
- const utils_1 = require("../../utils");
11
- let AttributeQuery = class AttributeQuery {
12
- async attribute(id, context) {
13
- return await (0, database_1.getRepository)(attribute_1.Attribute).findOne({
14
- where: { id }
15
- });
16
- }
17
- async attributeByEntity(entity, context) {
18
- return await (0, database_1.getRepository)(attribute_1.Attribute).findOne({
19
- where: { entity }
20
- });
21
- }
22
- async attributes(params, context) {
23
- const queryBuilder = (0, utils_1.getQueryBuilderFromListParams)({
24
- params,
25
- repository: await (0, database_1.getRepository)(attribute_1.Attribute),
26
- searchables: ['entity', 'description']
27
- });
28
- const [items, total] = await queryBuilder.getManyAndCount();
29
- return { items, total };
30
- }
31
- };
32
- tslib_1.__decorate([
33
- (0, type_graphql_1.Query)(returns => attribute_1.Attribute, { nullable: true, description: 'To fetch a Attribute' }),
34
- tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
35
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
36
- tslib_1.__metadata("design:type", Function),
37
- tslib_1.__metadata("design:paramtypes", [String, Object]),
38
- tslib_1.__metadata("design:returntype", Promise)
39
- ], AttributeQuery.prototype, "attribute", null);
40
- tslib_1.__decorate([
41
- (0, type_graphql_1.Query)(returns => attribute_1.Attribute, { nullable: true, description: 'To fetch a Attribute by Entity name' }),
42
- tslib_1.__param(0, (0, type_graphql_1.Arg)('entity')),
43
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
44
- tslib_1.__metadata("design:type", Function),
45
- tslib_1.__metadata("design:paramtypes", [String, Object]),
46
- tslib_1.__metadata("design:returntype", Promise)
47
- ], AttributeQuery.prototype, "attributeByEntity", null);
48
- tslib_1.__decorate([
49
- (0, type_graphql_1.Query)(returns => attribute_type_1.AttributeList, { description: 'To fetch multiple Attributes' }),
50
- tslib_1.__param(0, (0, type_graphql_1.Args)()),
51
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
52
- tslib_1.__metadata("design:type", Function),
53
- tslib_1.__metadata("design:paramtypes", [common_types_1.ListParam, Object]),
54
- tslib_1.__metadata("design:returntype", Promise)
55
- ], AttributeQuery.prototype, "attributes", null);
56
- AttributeQuery = tslib_1.__decorate([
57
- (0, type_graphql_1.Resolver)(attribute_1.Attribute)
58
- ], AttributeQuery);
59
- exports.AttributeQuery = AttributeQuery;
60
- //# sourceMappingURL=attribute-query.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attribute-query.js","sourceRoot":"","sources":["../../../server/service/attribute/attribute-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,2CAAuC;AACvC,qDAAgD;AAChD,kDAA2C;AAC3C,0DAA2D;AAC3D,uCAA2D;AAGpD,IAAM,cAAc,GAApB,MAAM,cAAc;IAEnB,AAAN,KAAK,CAAC,SAAS,CAAY,EAAU,EAAS,OAAY;QACxD,OAAO,MAAM,IAAA,wBAAa,EAAC,qBAAS,CAAC,CAAC,OAAO,CAAC;YAC5C,KAAK,EAAE,EAAE,EAAE,EAAE;SACd,CAAC,CAAA;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,iBAAiB,CAAgB,MAAc,EAAS,OAAY;QACxE,OAAO,MAAM,IAAA,wBAAa,EAAC,qBAAS,CAAC,CAAC,OAAO,CAAC;YAC5C,KAAK,EAAE,EAAE,MAAM,EAAE;SAClB,CAAC,CAAA;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,UAAU,CAAS,MAAiB,EAAS,OAAY;QAC7D,MAAM,YAAY,GAAG,IAAA,qCAA6B,EAAC;YACjD,MAAM;YACN,UAAU,EAAE,MAAM,IAAA,wBAAa,EAAC,qBAAS,CAAC;YAC1C,WAAW,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC;SACvC,CAAC,CAAA;QAEF,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,YAAY,CAAC,eAAe,EAAE,CAAA;QAE3D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACzB,CAAC;CACF,CAAA;AAzBO;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,qBAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,sBAAsB,EAAE,CAAC;IACrE,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+CAI5C;AAGK;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,qBAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,qCAAqC,EAAE,CAAC;IAC5E,mBAAA,IAAA,kBAAG,EAAC,QAAQ,CAAC,CAAA;IAAkB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;uDAI5D;AAGK;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,8BAAa,EAAE,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;IAC/D,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,wBAAS;;gDAUzC;AA1BU,cAAc;IAD1B,IAAA,uBAAQ,EAAC,qBAAS,CAAC;GACP,cAAc,CA2B1B;AA3BY,wCAAc","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Attribute } from './attribute'\nimport { AttributeList } from './attribute-type'\nimport { ListParam } from '../common-types'\nimport { getRepository } from '../../initializers/database'\nimport { getQueryBuilderFromListParams } from '../../utils'\n\n@Resolver(Attribute)\nexport class AttributeQuery {\n @Query(returns => Attribute!, { nullable: true, description: 'To fetch a Attribute' })\n async attribute(@Arg('id') id: string, @Ctx() context: any): Promise<Attribute> {\n return await getRepository(Attribute).findOne({\n where: { id }\n })\n }\n\n @Query(returns => Attribute!, { nullable: true, description: 'To fetch a Attribute by Entity name' })\n async attributeByEntity(@Arg('entity') entity: string, @Ctx() context: any): Promise<Attribute> {\n return await getRepository(Attribute).findOne({\n where: { entity }\n })\n }\n\n @Query(returns => AttributeList, { description: 'To fetch multiple Attributes' })\n async attributes(@Args() params: ListParam, @Ctx() context: any): Promise<AttributeList> {\n const queryBuilder = getQueryBuilderFromListParams({\n params,\n repository: await getRepository(Attribute),\n searchables: ['entity', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n}\n"]}
@@ -1,19 +0,0 @@
1
- import { Attribute } from './attribute';
2
- import { AttributeItemPatch } from './attribute-item-type';
3
- export declare class NewAttribute {
4
- entity: string;
5
- description?: string;
6
- items?: AttributeItemPatch[];
7
- active?: boolean;
8
- }
9
- export declare class AttributePatch {
10
- id?: string;
11
- entity?: string;
12
- description?: string;
13
- items?: AttributeItemPatch[];
14
- cuFlag?: string;
15
- }
16
- export declare class AttributeList {
17
- items: Attribute[];
18
- total: number;
19
- }
@@ -1,70 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AttributeList = exports.AttributePatch = exports.NewAttribute = void 0;
4
- const tslib_1 = require("tslib");
5
- const type_graphql_1 = require("type-graphql");
6
- const attribute_1 = require("./attribute");
7
- const attribute_item_type_1 = require("./attribute-item-type");
8
- let NewAttribute = class NewAttribute {
9
- };
10
- tslib_1.__decorate([
11
- (0, type_graphql_1.Field)(),
12
- tslib_1.__metadata("design:type", String)
13
- ], NewAttribute.prototype, "entity", void 0);
14
- tslib_1.__decorate([
15
- (0, type_graphql_1.Field)({ nullable: true }),
16
- tslib_1.__metadata("design:type", String)
17
- ], NewAttribute.prototype, "description", void 0);
18
- tslib_1.__decorate([
19
- (0, type_graphql_1.Field)(type => [attribute_item_type_1.AttributeItemPatch], { nullable: true }),
20
- tslib_1.__metadata("design:type", Array)
21
- ], NewAttribute.prototype, "items", void 0);
22
- tslib_1.__decorate([
23
- (0, type_graphql_1.Field)({ nullable: true }),
24
- tslib_1.__metadata("design:type", Boolean)
25
- ], NewAttribute.prototype, "active", void 0);
26
- NewAttribute = tslib_1.__decorate([
27
- (0, type_graphql_1.InputType)()
28
- ], NewAttribute);
29
- exports.NewAttribute = NewAttribute;
30
- let AttributePatch = class AttributePatch {
31
- };
32
- tslib_1.__decorate([
33
- (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
34
- tslib_1.__metadata("design:type", String)
35
- ], AttributePatch.prototype, "id", void 0);
36
- tslib_1.__decorate([
37
- (0, type_graphql_1.Field)({ nullable: true }),
38
- tslib_1.__metadata("design:type", String)
39
- ], AttributePatch.prototype, "entity", void 0);
40
- tslib_1.__decorate([
41
- (0, type_graphql_1.Field)({ nullable: true }),
42
- tslib_1.__metadata("design:type", String)
43
- ], AttributePatch.prototype, "description", void 0);
44
- tslib_1.__decorate([
45
- (0, type_graphql_1.Field)(type => [attribute_item_type_1.AttributeItemPatch], { nullable: true }),
46
- tslib_1.__metadata("design:type", Array)
47
- ], AttributePatch.prototype, "items", void 0);
48
- tslib_1.__decorate([
49
- (0, type_graphql_1.Field)({ nullable: true }),
50
- tslib_1.__metadata("design:type", String)
51
- ], AttributePatch.prototype, "cuFlag", void 0);
52
- AttributePatch = tslib_1.__decorate([
53
- (0, type_graphql_1.InputType)()
54
- ], AttributePatch);
55
- exports.AttributePatch = AttributePatch;
56
- let AttributeList = class AttributeList {
57
- };
58
- tslib_1.__decorate([
59
- (0, type_graphql_1.Field)(type => [attribute_1.Attribute]),
60
- tslib_1.__metadata("design:type", Array)
61
- ], AttributeList.prototype, "items", void 0);
62
- tslib_1.__decorate([
63
- (0, type_graphql_1.Field)(type => type_graphql_1.Int),
64
- tslib_1.__metadata("design:type", Number)
65
- ], AttributeList.prototype, "total", void 0);
66
- AttributeList = tslib_1.__decorate([
67
- (0, type_graphql_1.ObjectType)()
68
- ], AttributeList);
69
- exports.AttributeList = AttributeList;
70
- //# sourceMappingURL=attribute-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attribute-type.js","sourceRoot":"","sources":["../../../server/service/attribute/attribute-type.ts"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4CACT;AAElB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;4CACN;AALF,aAAa;IADzB,IAAA,yBAAU,GAAE;GACA,aAAa,CAMzB;AANY,sCAAa","sourcesContent":["import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'\n\nimport { Attribute } from './attribute'\nimport { AttributeItemPatch } from './attribute-item-type'\n\n@InputType()\nexport class NewAttribute {\n @Field()\n entity: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => [AttributeItemPatch], { nullable: true })\n items?: AttributeItemPatch[]\n\n @Field({ nullable: true })\n active?: boolean\n}\n\n@InputType()\nexport class AttributePatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n entity?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => [AttributeItemPatch], { nullable: true })\n items?: AttributeItemPatch[]\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class AttributeList {\n @Field(type => [Attribute])\n items: Attribute[]\n\n @Field(type => Int)\n total: number\n}\n"]}
@@ -1,9 +0,0 @@
1
- import { AttributeItem } from './attribute-item-type';
2
- export declare class Attribute {
3
- readonly id: string;
4
- entity: string;
5
- description: string;
6
- items: AttributeItem[];
7
- createdAt?: Date;
8
- updatedAt?: Date;
9
- }