@things-factory/routing-base 4.0.32 → 4.0.36
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/dist-server/service/operation/operation-mutation.js +41 -2
- package/dist-server/service/operation/operation-mutation.js.map +1 -1
- package/dist-server/service/operation/operation-query.js +19 -2
- package/dist-server/service/operation/operation-query.js.map +1 -1
- package/dist-server/service/operation/operation-type.js +10 -0
- package/dist-server/service/operation/operation-type.js.map +1 -1
- package/dist-server/service/operation/operation.js +4 -0
- package/dist-server/service/operation/operation.js.map +1 -1
- package/package.json +5 -4
- package/server/service/operation/operation-mutation.ts +69 -4
- package/server/service/operation/operation-query.ts +19 -4
- package/server/service/operation/operation-type.ts +8 -7
- package/server/service/operation/operation.ts +4 -6
|
@@ -15,12 +15,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.OperationMutation = void 0;
|
|
16
16
|
const type_graphql_1 = require("type-graphql");
|
|
17
17
|
const typeorm_1 = require("typeorm");
|
|
18
|
+
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
18
19
|
const operation_1 = require("./operation");
|
|
19
20
|
const operation_type_1 = require("./operation-type");
|
|
20
21
|
let OperationMutation = class OperationMutation {
|
|
21
22
|
async createOperation(operation, context) {
|
|
22
23
|
const { domain, user, tx } = context.state;
|
|
23
|
-
|
|
24
|
+
const result = await tx.getRepository(operation_1.Operation).save(Object.assign(Object.assign({}, operation), { domain, creator: user, updater: user }));
|
|
25
|
+
if (operation.thumbnail) {
|
|
26
|
+
await (0, attachment_base_1.createAttachment)(null, {
|
|
27
|
+
attachment: {
|
|
28
|
+
file: operation.thumbnail,
|
|
29
|
+
refBy: result.id
|
|
30
|
+
}
|
|
31
|
+
}, context);
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
24
34
|
}
|
|
25
35
|
async updateOperation(id, patch, context) {
|
|
26
36
|
const { domain, user, tx } = context.state;
|
|
@@ -28,7 +38,17 @@ let OperationMutation = class OperationMutation {
|
|
|
28
38
|
const operation = await repository.findOne({
|
|
29
39
|
where: { domain, id }
|
|
30
40
|
});
|
|
31
|
-
|
|
41
|
+
const result = await repository.save(Object.assign(Object.assign(Object.assign({}, operation), patch), { updater: user }));
|
|
42
|
+
if (patch.thumbnail) {
|
|
43
|
+
await (0, attachment_base_1.deleteAttachmentsByRef)(null, [operation.id], context);
|
|
44
|
+
await (0, attachment_base_1.createAttachment)(null, {
|
|
45
|
+
attachment: {
|
|
46
|
+
file: patch.thumbnail,
|
|
47
|
+
refBy: operation.id
|
|
48
|
+
}
|
|
49
|
+
}, context);
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
32
52
|
}
|
|
33
53
|
async updateMultipleOperation(patches, context) {
|
|
34
54
|
const { domain, user, tx } = context.state;
|
|
@@ -40,6 +60,14 @@ let OperationMutation = class OperationMutation {
|
|
|
40
60
|
for (let i = 0; i < _createRecords.length; i++) {
|
|
41
61
|
const newRecord = _createRecords[i];
|
|
42
62
|
const result = await operationRepo.save(Object.assign(Object.assign({}, newRecord), { domain, creator: user, updater: user }));
|
|
63
|
+
if (newRecord.thumbnail) {
|
|
64
|
+
await (0, attachment_base_1.createAttachment)(null, {
|
|
65
|
+
attachment: {
|
|
66
|
+
file: newRecord.thumbnail,
|
|
67
|
+
refBy: result.id
|
|
68
|
+
}
|
|
69
|
+
}, context);
|
|
70
|
+
}
|
|
43
71
|
results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
|
|
44
72
|
}
|
|
45
73
|
}
|
|
@@ -48,6 +76,15 @@ let OperationMutation = class OperationMutation {
|
|
|
48
76
|
const newRecord = _updateRecords[i];
|
|
49
77
|
const operation = await operationRepo.findOne(newRecord.id);
|
|
50
78
|
const result = await operationRepo.save(Object.assign(Object.assign(Object.assign({}, operation), newRecord), { updater: user }));
|
|
79
|
+
if (newRecord.thumbnail) {
|
|
80
|
+
await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [operation.id] }, context);
|
|
81
|
+
await (0, attachment_base_1.createAttachment)(null, {
|
|
82
|
+
attachment: {
|
|
83
|
+
file: newRecord.thumbnail,
|
|
84
|
+
refBy: operation.id
|
|
85
|
+
}
|
|
86
|
+
}, context);
|
|
87
|
+
}
|
|
51
88
|
results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
|
|
52
89
|
}
|
|
53
90
|
}
|
|
@@ -56,6 +93,7 @@ let OperationMutation = class OperationMutation {
|
|
|
56
93
|
async deleteOperation(id, context) {
|
|
57
94
|
const { domain, tx } = context.state;
|
|
58
95
|
await tx.getRepository(operation_1.Operation).delete({ domain, id });
|
|
96
|
+
await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [id] }, context);
|
|
59
97
|
return true;
|
|
60
98
|
}
|
|
61
99
|
async deleteOperations(ids, context) {
|
|
@@ -64,6 +102,7 @@ let OperationMutation = class OperationMutation {
|
|
|
64
102
|
domain,
|
|
65
103
|
id: (0, typeorm_1.In)(ids)
|
|
66
104
|
});
|
|
105
|
+
await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: ids }, context);
|
|
67
106
|
return true;
|
|
68
107
|
}
|
|
69
108
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-mutation.js","sourceRoot":"","sources":["../../../server/service/operation/operation-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAsE;AACtE,
|
|
1
|
+
{"version":3,"file":"operation-mutation.js","sourceRoot":"","sources":["../../../server/service/operation/operation-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,qEAA0F;AAE1F,2CAAuC;AACvC,qDAA+D;AAG/D,IAAa,iBAAiB,GAA9B,MAAa,iBAAiB;IAG5B,KAAK,CAAC,eAAe,CAAmB,SAAuB,EAAS,OAAY;QAClF,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,C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,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;IAC9C,WAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;wDAOlD;AAID;IAFC,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IACvD,WAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAAiB,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;yDAWzE;AAnKU,iBAAiB;IAD7B,IAAA,uBAAQ,EAAC,qBAAS,CAAC;GACP,iBAAiB,CAoK7B;AApKY,8CAAiB"}
|
|
@@ -16,15 +16,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
exports.OperationQuery = void 0;
|
|
17
17
|
const type_graphql_1 = require("type-graphql");
|
|
18
18
|
const typeorm_1 = require("typeorm");
|
|
19
|
-
const
|
|
19
|
+
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
20
20
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
21
|
+
const shell_1 = require("@things-factory/shell");
|
|
21
22
|
const operation_1 = require("./operation");
|
|
22
23
|
const operation_type_1 = require("./operation-type");
|
|
23
24
|
let OperationQuery = class OperationQuery {
|
|
24
25
|
async operation(id, context) {
|
|
25
26
|
const { domain } = context.state;
|
|
26
27
|
return await (0, typeorm_1.getRepository)(operation_1.Operation).findOne({
|
|
27
|
-
where: { domain,
|
|
28
|
+
where: { domain, id }
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
31
|
async operations(params, context) {
|
|
@@ -42,6 +43,15 @@ let OperationQuery = class OperationQuery {
|
|
|
42
43
|
async creator(operation) {
|
|
43
44
|
return await (0, typeorm_1.getRepository)(auth_base_1.User).findOne(operation.creatorId);
|
|
44
45
|
}
|
|
46
|
+
async thumbnail(operation) {
|
|
47
|
+
const attachment = await (0, typeorm_1.getRepository)(attachment_base_1.Attachment).findOne({
|
|
48
|
+
where: {
|
|
49
|
+
domain: operation.domainId,
|
|
50
|
+
refBy: operation.id
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
return attachment === null || attachment === void 0 ? void 0 : attachment.fullpath;
|
|
54
|
+
}
|
|
45
55
|
};
|
|
46
56
|
__decorate([
|
|
47
57
|
(0, type_graphql_1.Query)(returns => operation_1.Operation, { description: 'To fetch a Operation' }),
|
|
@@ -80,6 +90,13 @@ __decorate([
|
|
|
80
90
|
__metadata("design:paramtypes", [operation_1.Operation]),
|
|
81
91
|
__metadata("design:returntype", Promise)
|
|
82
92
|
], OperationQuery.prototype, "creator", null);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, type_graphql_1.FieldResolver)(type => String),
|
|
95
|
+
__param(0, (0, type_graphql_1.Root)()),
|
|
96
|
+
__metadata("design:type", Function),
|
|
97
|
+
__metadata("design:paramtypes", [operation_1.Operation]),
|
|
98
|
+
__metadata("design:returntype", Promise)
|
|
99
|
+
], OperationQuery.prototype, "thumbnail", null);
|
|
83
100
|
OperationQuery = __decorate([
|
|
84
101
|
(0, type_graphql_1.Resolver)(operation_1.Operation)
|
|
85
102
|
], OperationQuery);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-query.js","sourceRoot":"","sources":["../../../server/service/operation/operation-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"operation-query.js","sourceRoot":"","sources":["../../../server/service/operation/operation-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAAmF;AACnF,qCAAuC;AAEvC,qEAA4D;AAC5D,yDAAgD;AAChD,iDAA4E;AAE5E,2CAAuC;AACvC,qDAAgD;AAGhD,IAAa,cAA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
|
|
@@ -8,8 +8,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
+
var _a, _b;
|
|
11
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
13
|
exports.OperationList = exports.OperationPatch = exports.NewOperation = void 0;
|
|
14
|
+
const graphql_upload_1 = require("graphql-upload");
|
|
13
15
|
const type_graphql_1 = require("type-graphql");
|
|
14
16
|
const operation_1 = require("./operation");
|
|
15
17
|
let NewOperation = class NewOperation {
|
|
@@ -38,6 +40,10 @@ __decorate([
|
|
|
38
40
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
39
41
|
__metadata("design:type", Boolean)
|
|
40
42
|
], NewOperation.prototype, "active", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, type_graphql_1.Field)(type => graphql_upload_1.GraphQLUpload, { nullable: true }),
|
|
45
|
+
__metadata("design:type", typeof (_a = typeof graphql_upload_1.FileUpload !== "undefined" && graphql_upload_1.FileUpload) === "function" ? _a : Object)
|
|
46
|
+
], NewOperation.prototype, "thumbnail", void 0);
|
|
41
47
|
NewOperation = __decorate([
|
|
42
48
|
(0, type_graphql_1.InputType)()
|
|
43
49
|
], NewOperation);
|
|
@@ -72,6 +78,10 @@ __decorate([
|
|
|
72
78
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
73
79
|
__metadata("design:type", Boolean)
|
|
74
80
|
], OperationPatch.prototype, "active", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, type_graphql_1.Field)(type => graphql_upload_1.GraphQLUpload, { nullable: true }),
|
|
83
|
+
__metadata("design:type", typeof (_b = typeof graphql_upload_1.FileUpload !== "undefined" && graphql_upload_1.FileUpload) === "function" ? _b : Object)
|
|
84
|
+
], OperationPatch.prototype, "thumbnail", void 0);
|
|
75
85
|
__decorate([
|
|
76
86
|
(0, type_graphql_1.Field)(),
|
|
77
87
|
__metadata("design:type", String)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-type.js","sourceRoot":"","sources":["../../../server/service/operation/operation-type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"operation-type.js","sourceRoot":"","sources":["../../../server/service/operation/operation-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mDAA0D;AAC1D,+CAAoE;AAEpE,2CAAuC;AAGvC,IAAa,YAAY,GAAzB,MAAa,YAAY;CAqBxB,CAAA;AAnBC;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;0CACf;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACA;AAG1B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sDACD;AAGzB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,8BAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kDACrC,2BAAU,oBAAV,2BAAU;+CAAA;AApBX,YAAY;IADxB,IAAA,wBAAS,GAAE;GACC,YAAY,CAqBxB;AArBY,oCAAY;AAwBzB,IAAa,cAAc,GAA3B,MAAa,cAAc;CA2B1B,CAAA;AAzBC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CAC3B;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACd;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yDACA;AAG1B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wDACD;AAGzB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,8BAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kDACrC,2BAAU,oBAAV,2BAAU;iDAAA;AAGtB;IADC,IAAA,oBAAK,GAAE;;8CACM;AA1BH,cAAc;IAD1B,IAAA,wBAAS,GAAE;GACC,cAAc,CA2B1B;AA3BY,wCAAc;AA8B3B,IAAa,aAAa,GAA1B,MAAa,aAAa;CAMzB,CAAA;AAJC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,qBAAS,CAAC,CAAC;;4CACT;AAGlB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;4CACN;AALF,aAAa;IADzB,IAAA,yBAAU,GAAE;GACA,aAAa,CAMzB;AANY,sCAAa"}
|
|
@@ -86,6 +86,10 @@ __decorate([
|
|
|
86
86
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
87
87
|
__metadata("design:type", Boolean)
|
|
88
88
|
], Operation.prototype, "active", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
(0, type_graphql_1.Field)(type => String, { nullable: true }),
|
|
91
|
+
__metadata("design:type", String)
|
|
92
|
+
], Operation.prototype, "thumbnail", void 0);
|
|
89
93
|
__decorate([
|
|
90
94
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
|
|
91
95
|
nullable: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../server/service/operation/operation.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../server/service/operation/operation.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+CAAsE;AACtE,qCASgB;AAEhB,yDAAgD;AAChD,iDAA8C;AAE9C,IAAY,eASX;AATD,WAAY,eAAe;IACzB,wCAAqB,CAAA;IACrB,wCAAqB,CAAA;IACrB,oCAAiB,CAAA;IACjB,oCAAiB,CAAA;IACjB,mCAAgB,CAAA;IAChB,8BAAW,CAAA;IACX,mCAAgB,CAAA;IAChB,gCAAa,CAAA;AACf,CAAC,EATW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAS1B;AAED,IAAA,+BAAgB,EAAC,eAAe,EAAE;IAChC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,kCAAkC;CAChD,CAAC,CAAA;AAKF,IAAa,SAAS,GAAtB,MAAa,SAAS;CA0ErB,CAAA;AAvEC;IAFC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;qCACpB;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;kDACnC,cAAM,oBAAN,cAAM;yCAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,SAAoB,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC;;2CACvC;AAIh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IAJC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kDAC9B,gBAAI,oBAAJ,gBAAI;0CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,SAAoB,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC;;4CACtC;AAIlB;IAFC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACd,IAAI;4CAAA;AAIhB;IAFC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACd,IAAI;4CAAA;AAzEL,SAAS;IAHrB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,gBAAgB,EAAE,CAAC,SAAoB,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACvG,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,sBAAsB,EAAE,CAAC;GACvC,SAAS,CA0ErB;AA1EY,8BAAS"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/routing-base",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.36",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@things-factory/
|
|
28
|
-
"@things-factory/
|
|
27
|
+
"@things-factory/attachment-base": "^4.0.36",
|
|
28
|
+
"@things-factory/auth-base": "^4.0.36",
|
|
29
|
+
"@things-factory/shell": "^4.0.36"
|
|
29
30
|
},
|
|
30
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "132ab9f8af8c34f73bcd81a9776769a6929e13ee"
|
|
31
32
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
|
|
2
|
+
import { In } from 'typeorm'
|
|
3
|
+
|
|
4
|
+
import { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'
|
|
5
|
+
|
|
3
6
|
import { Operation } from './operation'
|
|
4
7
|
import { NewOperation, OperationPatch } from './operation-type'
|
|
5
8
|
|
|
@@ -10,12 +13,27 @@ export class OperationMutation {
|
|
|
10
13
|
async createOperation(@Arg('operation') operation: NewOperation, @Ctx() context: any): Promise<Operation> {
|
|
11
14
|
const { domain, user, tx } = context.state
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
const result = await tx.getRepository(Operation).save({
|
|
14
17
|
...operation,
|
|
15
18
|
domain,
|
|
16
19
|
creator: user,
|
|
17
20
|
updater: user
|
|
18
21
|
})
|
|
22
|
+
|
|
23
|
+
if (operation.thumbnail) {
|
|
24
|
+
await createAttachment(
|
|
25
|
+
null,
|
|
26
|
+
{
|
|
27
|
+
attachment: {
|
|
28
|
+
file: operation.thumbnail,
|
|
29
|
+
refBy: result.id
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
context
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return result
|
|
19
37
|
}
|
|
20
38
|
|
|
21
39
|
@Directive('@transaction')
|
|
@@ -32,11 +50,27 @@ export class OperationMutation {
|
|
|
32
50
|
where: { domain, id }
|
|
33
51
|
})
|
|
34
52
|
|
|
35
|
-
|
|
53
|
+
const result = await repository.save({
|
|
36
54
|
...operation,
|
|
37
55
|
...patch,
|
|
38
56
|
updater: user
|
|
39
57
|
})
|
|
58
|
+
|
|
59
|
+
if (patch.thumbnail) {
|
|
60
|
+
await deleteAttachmentsByRef(null, [operation.id], context)
|
|
61
|
+
await createAttachment(
|
|
62
|
+
null,
|
|
63
|
+
{
|
|
64
|
+
attachment: {
|
|
65
|
+
file: patch.thumbnail,
|
|
66
|
+
refBy: operation.id
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
context
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return result
|
|
40
74
|
}
|
|
41
75
|
|
|
42
76
|
@Directive('@transaction')
|
|
@@ -63,6 +97,19 @@ export class OperationMutation {
|
|
|
63
97
|
updater: user
|
|
64
98
|
})
|
|
65
99
|
|
|
100
|
+
if (newRecord.thumbnail) {
|
|
101
|
+
await createAttachment(
|
|
102
|
+
null,
|
|
103
|
+
{
|
|
104
|
+
attachment: {
|
|
105
|
+
file: newRecord.thumbnail,
|
|
106
|
+
refBy: result.id
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
context
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
66
113
|
results.push({ ...result, cuFlag: '+' })
|
|
67
114
|
}
|
|
68
115
|
}
|
|
@@ -78,6 +125,20 @@ export class OperationMutation {
|
|
|
78
125
|
updater: user
|
|
79
126
|
})
|
|
80
127
|
|
|
128
|
+
if (newRecord.thumbnail) {
|
|
129
|
+
await deleteAttachmentsByRef(null, { refBys: [operation.id] }, context)
|
|
130
|
+
await createAttachment(
|
|
131
|
+
null,
|
|
132
|
+
{
|
|
133
|
+
attachment: {
|
|
134
|
+
file: newRecord.thumbnail,
|
|
135
|
+
refBy: operation.id
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
context
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
81
142
|
results.push({ ...result, cuFlag: 'M' })
|
|
82
143
|
}
|
|
83
144
|
}
|
|
@@ -91,6 +152,8 @@ export class OperationMutation {
|
|
|
91
152
|
const { domain, tx } = context.state
|
|
92
153
|
|
|
93
154
|
await tx.getRepository(Operation).delete({ domain, id })
|
|
155
|
+
await deleteAttachmentsByRef(null, { refBys: [id] }, context)
|
|
156
|
+
|
|
94
157
|
return true
|
|
95
158
|
}
|
|
96
159
|
|
|
@@ -104,6 +167,8 @@ export class OperationMutation {
|
|
|
104
167
|
id: In(ids)
|
|
105
168
|
})
|
|
106
169
|
|
|
170
|
+
await deleteAttachmentsByRef(null, { refBys: ids }, context)
|
|
171
|
+
|
|
107
172
|
return true
|
|
108
173
|
}
|
|
109
174
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
|
|
2
2
|
import { getRepository } from 'typeorm'
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import { Attachment } from '@things-factory/attachment-base'
|
|
4
5
|
import { User } from '@things-factory/auth-base'
|
|
5
|
-
import {
|
|
6
|
+
import { convertListParams, Domain, ListParam } from '@things-factory/shell'
|
|
7
|
+
|
|
8
|
+
import { Operation } from './operation'
|
|
6
9
|
import { OperationList } from './operation-type'
|
|
7
10
|
|
|
8
11
|
@Resolver(Operation)
|
|
@@ -12,7 +15,7 @@ export class OperationQuery {
|
|
|
12
15
|
const { domain } = context.state
|
|
13
16
|
|
|
14
17
|
return await getRepository(Operation).findOne({
|
|
15
|
-
where: { domain,
|
|
18
|
+
where: { domain, id }
|
|
16
19
|
})
|
|
17
20
|
}
|
|
18
21
|
|
|
@@ -40,4 +43,16 @@ export class OperationQuery {
|
|
|
40
43
|
async creator(@Root() operation: Operation): Promise<User> {
|
|
41
44
|
return await getRepository(User).findOne(operation.creatorId)
|
|
42
45
|
}
|
|
46
|
+
|
|
47
|
+
@FieldResolver(type => String)
|
|
48
|
+
async thumbnail(@Root() operation: Operation): Promise<string | undefined> {
|
|
49
|
+
const attachment: Attachment = await getRepository(Attachment).findOne({
|
|
50
|
+
where: {
|
|
51
|
+
domain: operation.domainId,
|
|
52
|
+
refBy: operation.id
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
return attachment?.fullpath
|
|
57
|
+
}
|
|
43
58
|
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
ID,
|
|
4
|
-
InputType,
|
|
5
|
-
Int,
|
|
6
|
-
ObjectType
|
|
7
|
-
} from 'type-graphql'
|
|
1
|
+
import { FileUpload, GraphQLUpload } from 'graphql-upload'
|
|
2
|
+
import { Field, ID, InputType, Int, ObjectType } from 'type-graphql'
|
|
8
3
|
|
|
9
4
|
import { Operation } from './operation'
|
|
10
5
|
|
|
@@ -27,6 +22,9 @@ export class NewOperation {
|
|
|
27
22
|
|
|
28
23
|
@Field({ nullable: true })
|
|
29
24
|
active?: boolean
|
|
25
|
+
|
|
26
|
+
@Field(type => GraphQLUpload, { nullable: true })
|
|
27
|
+
thumbnail?: FileUpload
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
@InputType()
|
|
@@ -52,6 +50,9 @@ export class OperationPatch {
|
|
|
52
50
|
@Field({ nullable: true })
|
|
53
51
|
active?: boolean
|
|
54
52
|
|
|
53
|
+
@Field(type => GraphQLUpload, { nullable: true })
|
|
54
|
+
thumbnail?: FileUpload
|
|
55
|
+
|
|
55
56
|
@Field()
|
|
56
57
|
cuFlag: string
|
|
57
58
|
}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Field,
|
|
3
|
-
ID,
|
|
4
|
-
ObjectType,
|
|
5
|
-
registerEnumType
|
|
6
|
-
} from 'type-graphql'
|
|
1
|
+
import { Field, ID, ObjectType, registerEnumType } from 'type-graphql'
|
|
7
2
|
import {
|
|
8
3
|
Column,
|
|
9
4
|
CreateDateColumn,
|
|
@@ -83,6 +78,9 @@ export class Operation {
|
|
|
83
78
|
@Field({ nullable: true })
|
|
84
79
|
active?: boolean
|
|
85
80
|
|
|
81
|
+
@Field(type => String, { nullable: true })
|
|
82
|
+
thumbnail?: string
|
|
83
|
+
|
|
86
84
|
@ManyToOne(type => User, {
|
|
87
85
|
nullable: true
|
|
88
86
|
})
|