@things-factory/shell 6.0.101 → 6.0.104
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/client/scene/scene-viewer.js +1 -1
- package/dist-server/service/attribute/attribute-item-type.d.ts +29 -0
- package/dist-server/service/attribute/attribute-item-type.js +81 -0
- package/dist-server/service/attribute/attribute-item-type.js.map +1 -0
- package/dist-server/service/attribute/attribute-mutation.d.ts +10 -0
- package/dist-server/service/attribute/attribute-mutation.js +130 -0
- package/dist-server/service/attribute/attribute-mutation.js.map +1 -0
- package/dist-server/service/attribute/attribute-query.d.ts +8 -0
- package/dist-server/service/attribute/attribute-query.js +60 -0
- package/dist-server/service/attribute/attribute-query.js.map +1 -0
- package/dist-server/service/attribute/attribute-type.d.ts +19 -0
- package/dist-server/service/attribute/attribute-type.js +70 -0
- package/dist-server/service/attribute/attribute-type.js.map +1 -0
- package/dist-server/service/attribute/attribute.d.ts +9 -0
- package/dist-server/service/attribute/attribute.js +52 -0
- package/dist-server/service/attribute/attribute.js.map +1 -0
- package/dist-server/service/attribute/index.d.ts +5 -0
- package/dist-server/service/attribute/index.js +9 -0
- package/dist-server/service/attribute/index.js.map +1 -0
- package/dist-server/service/attribute-set/attribute-set-item-type.d.ts +31 -0
- package/dist-server/service/attribute-set/attribute-set-item-type.js +89 -0
- package/dist-server/service/attribute-set/attribute-set-item-type.js.map +1 -0
- package/dist-server/service/attribute-set/attribute-set-mutation.d.ts +10 -0
- package/dist-server/service/attribute-set/attribute-set-mutation.js +130 -0
- package/dist-server/service/attribute-set/attribute-set-mutation.js.map +1 -0
- package/dist-server/service/attribute-set/attribute-set-query.d.ts +8 -0
- package/dist-server/service/attribute-set/attribute-set-query.js +60 -0
- package/dist-server/service/attribute-set/attribute-set-query.js.map +1 -0
- package/dist-server/service/attribute-set/attribute-set-type.d.ts +19 -0
- package/dist-server/service/attribute-set/attribute-set-type.js +70 -0
- package/dist-server/service/attribute-set/attribute-set-type.js.map +1 -0
- package/dist-server/service/attribute-set/attribute-set.d.ts +9 -0
- package/dist-server/service/attribute-set/attribute-set.js +52 -0
- package/dist-server/service/attribute-set/attribute-set.js.map +1 -0
- package/dist-server/service/attribute-set/index.d.ts +5 -0
- package/dist-server/service/attribute-set/index.js +9 -0
- package/dist-server/service/attribute-set/index.js.map +1 -0
- package/dist-server/service/domain/domain-types.d.ts +1 -0
- package/dist-server/service/domain/domain-types.js +5 -0
- package/dist-server/service/domain/domain-types.js.map +1 -1
- package/dist-server/service/domain/domain.d.ts +1 -0
- package/dist-server/service/domain/domain.js +6 -0
- package/dist-server/service/domain/domain.js.map +1 -1
- package/dist-server/service/index.d.ts +3 -2
- package/dist-server/service/index.js +4 -2
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/shell/attribute.md +160 -0
- package/package.json +2 -2
- package/server/service/attribute-set/attribute-set-item-type.ts +65 -0
- package/server/service/attribute-set/attribute-set-mutation.ts +125 -0
- package/server/service/attribute-set/attribute-set-query.ts +36 -0
- package/server/service/attribute-set/attribute-set-type.ts +46 -0
- package/server/service/attribute-set/attribute-set.ts +35 -0
- package/server/service/attribute-set/index.ts +6 -0
- package/server/service/domain/domain-types.ts +4 -1
- package/server/service/domain/domain.ts +5 -0
- package/server/service/index.ts +5 -8
@@ -0,0 +1,29 @@
|
|
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
|
+
}
|
@@ -0,0 +1,81 @@
|
|
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
|
@@ -0,0 +1 @@
|
|
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"]}
|
@@ -0,0 +1,10 @@
|
|
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
|
+
}
|
@@ -0,0 +1,130 @@
|
|
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
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"attribute-mutation.js","sourceRoot":"","sources":["../../../server/service/attribute/attribute-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,2CAAuC;AACvC,qDAA+D;AAGxD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAItB,AAAN,KAAK,CAAC,eAAe,CAAmB,SAAuB,EAAS,OAAY;QAClF,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE5B,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,qBAAS,CAAC,CAAC,IAAI,mBACxC,SAAS,EACZ,CAAA;IACJ,CAAC;IAKK,AAAN,KAAK,CAAC,eAAe,CACR,EAAU,EACP,KAAqB,EAC5B,OAAY;QAEnB,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE5B,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,qBAAS,CAAC,CAAA;QAC9C,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YACzC,KAAK,EAAE,EAAE,EAAE,EAAE;SAC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AAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,oCAAoC,CAAC;IAC/C,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IACvD,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAAiB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;yDAQzE;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,oCAAoC,CAAC;IAC/C,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IAE5E,mBAAA,IAAA,kBAAG,EAAC,YAAY,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,+BAAc,CAAC,CAAC,CAAA;IAC3C,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;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"]}
|
@@ -0,0 +1,8 @@
|
|
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
|
+
}
|
@@ -0,0 +1,60 @@
|
|
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
|
@@ -0,0 +1 @@
|
|
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"]}
|
@@ -0,0 +1,19 @@
|
|
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
|
+
}
|
@@ -0,0 +1,70 @@
|
|
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
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"attribute-type.js","sourceRoot":"","sources":["../../../server/service/attribute/attribute-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AAEpE,2CAAuC;AACvC,+DAA0D;AAGnD,IAAM,YAAY,GAAlB,MAAM,YAAY;CAYxB,CAAA;AAXC;IAAC,IAAA,oBAAK,GAAE;;4CACM;AAEd;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,wCAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CAC5B;AAE5B;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACV;AAXL,YAAY;IADxB,IAAA,wBAAS,GAAE;GACC,YAAY,CAYxB;AAZY,oCAAY;AAelB,IAAM,cAAc,GAApB,MAAM,cAAc;CAe1B,CAAA;AAdC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CAC3B;AAEX;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACX;AAEf;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,wCAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CAC5B;AAE5B;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACX;AAdJ,cAAc;IAD1B,IAAA,wBAAS,GAAE;GACC,cAAc,CAe1B;AAfY,wCAAc;AAkBpB,IAAM,aAAa,GAAnB,MAAM,aAAa;CAMzB,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,qBAAS,CAAC,CAAC;;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"]}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Attribute = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const typeorm_1 = require("typeorm");
|
6
|
+
const type_graphql_1 = require("type-graphql");
|
7
|
+
const attribute_item_type_1 = require("./attribute-item-type");
|
8
|
+
let Attribute = class Attribute {
|
9
|
+
constructor() {
|
10
|
+
this.entity = '';
|
11
|
+
this.description = '';
|
12
|
+
}
|
13
|
+
};
|
14
|
+
tslib_1.__decorate([
|
15
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
16
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
17
|
+
tslib_1.__metadata("design:type", String)
|
18
|
+
], Attribute.prototype, "id", void 0);
|
19
|
+
tslib_1.__decorate([
|
20
|
+
(0, typeorm_1.Column)({ nullable: true, default: '' }),
|
21
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
22
|
+
tslib_1.__metadata("design:type", String)
|
23
|
+
], Attribute.prototype, "entity", void 0);
|
24
|
+
tslib_1.__decorate([
|
25
|
+
(0, typeorm_1.Column)({ nullable: true, default: '' }),
|
26
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
27
|
+
tslib_1.__metadata("design:type", String)
|
28
|
+
], Attribute.prototype, "description", void 0);
|
29
|
+
tslib_1.__decorate([
|
30
|
+
(0, typeorm_1.Column)('simple-json', { nullable: true }),
|
31
|
+
(0, type_graphql_1.Field)(type => [attribute_item_type_1.AttributeItem], { nullable: true }),
|
32
|
+
tslib_1.__metadata("design:type", Array)
|
33
|
+
], Attribute.prototype, "items", void 0);
|
34
|
+
tslib_1.__decorate([
|
35
|
+
(0, typeorm_1.CreateDateColumn)(),
|
36
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
37
|
+
tslib_1.__metadata("design:type", Date)
|
38
|
+
], Attribute.prototype, "createdAt", void 0);
|
39
|
+
tslib_1.__decorate([
|
40
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
41
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
42
|
+
tslib_1.__metadata("design:type", Date)
|
43
|
+
], Attribute.prototype, "updatedAt", void 0);
|
44
|
+
Attribute = tslib_1.__decorate([
|
45
|
+
(0, typeorm_1.Entity)(),
|
46
|
+
(0, typeorm_1.Index)('ix_attribute_0', (attribute) => [attribute.entity], {
|
47
|
+
unique: true
|
48
|
+
}),
|
49
|
+
(0, type_graphql_1.ObjectType)({ description: 'Entity for Attribute' })
|
50
|
+
], Attribute);
|
51
|
+
exports.Attribute = Attribute;
|
52
|
+
//# sourceMappingURL=attribute.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"attribute.js","sourceRoot":"","sources":["../../../server/service/attribute/attribute.ts"],"names":[],"mappings":";;;;AAAA,qCAA2G;AAC3G,+CAAoD;AAEpD,+DAAqD;AAO9C,IAAM,SAAS,GAAf,MAAM,SAAS;IAAf;QAOL,WAAM,GAAW,EAAE,CAAA;QAInB,gBAAW,GAAW,EAAE,CAAA;IAa1B,CAAC;CAAA,CAAA;AAvBC;IAAC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;qCACC;AAEnB;IAAC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACvC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACP;AAEnB;IAAC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACvC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACF;AAExB;IAAC,IAAA,gBAAM,EAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACzC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,mCAAa,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCAC7B;AAEtB;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACd,IAAI;4CAAA;AAEhB;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACd,IAAI;4CAAA;AAvBL,SAAS;IALrB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,gBAAgB,EAAE,CAAC,SAAoB,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE;QACrE,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,sBAAsB,EAAE,CAAC;GACvC,SAAS,CAwBrB;AAxBY,8BAAS","sourcesContent":["import { CreateDateColumn, UpdateDateColumn, Entity, Index, Column, PrimaryGeneratedColumn } from 'typeorm'\nimport { ObjectType, Field, ID } from 'type-graphql'\n\nimport { AttributeItem } from './attribute-item-type'\n\n@Entity()\n@Index('ix_attribute_0', (attribute: Attribute) => [attribute.entity], {\n unique: true\n})\n@ObjectType({ description: 'Entity for Attribute' })\nexport class Attribute {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Column({ nullable: true, default: '' })\n @Field({ nullable: true })\n entity: string = ''\n\n @Column({ nullable: true, default: '' })\n @Field({ nullable: true })\n description: string = ''\n\n @Column('simple-json', { nullable: true })\n @Field(type => [AttributeItem], { nullable: true })\n items: AttributeItem[]\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n}\n"]}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { Attribute } from './attribute';
|
2
|
+
import { AttributeQuery } from './attribute-query';
|
3
|
+
import { AttributeMutation } from './attribute-mutation';
|
4
|
+
export declare const entities: (typeof Attribute)[];
|
5
|
+
export declare const resolvers: (typeof AttributeMutation | typeof AttributeQuery)[];
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.resolvers = exports.entities = void 0;
|
4
|
+
const attribute_1 = require("./attribute");
|
5
|
+
const attribute_query_1 = require("./attribute-query");
|
6
|
+
const attribute_mutation_1 = require("./attribute-mutation");
|
7
|
+
exports.entities = [attribute_1.Attribute];
|
8
|
+
exports.resolvers = [attribute_query_1.AttributeQuery, attribute_mutation_1.AttributeMutation];
|
9
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/attribute/index.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AACvC,uDAAkD;AAClD,6DAAwD;AAE3C,QAAA,QAAQ,GAAG,CAAC,qBAAS,CAAC,CAAA;AACtB,QAAA,SAAS,GAAG,CAAC,gCAAc,EAAE,sCAAiB,CAAC,CAAA","sourcesContent":["import { Attribute } from './attribute'\nimport { AttributeQuery } from './attribute-query'\nimport { AttributeMutation } from './attribute-mutation'\n\nexport const entities = [Attribute]\nexport const resolvers = [AttributeQuery, AttributeMutation]\n"]}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
export declare enum AttributeSetItemType {
|
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 AttributeSetItem {
|
11
|
+
name: string;
|
12
|
+
description?: string;
|
13
|
+
tag?: string;
|
14
|
+
active?: boolean;
|
15
|
+
hidden?: boolean;
|
16
|
+
type?: AttributeSetItemType;
|
17
|
+
options?: {
|
18
|
+
[option: string]: any;
|
19
|
+
};
|
20
|
+
}
|
21
|
+
export declare class AttributeSetItemPatch {
|
22
|
+
name?: string;
|
23
|
+
description?: string;
|
24
|
+
tag?: string;
|
25
|
+
type?: AttributeSetItemType;
|
26
|
+
options?: {
|
27
|
+
[option: string]: any;
|
28
|
+
};
|
29
|
+
active?: boolean;
|
30
|
+
hidden?: boolean;
|
31
|
+
}
|