@things-factory/sales-base 4.1.7 → 4.1.8
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.
|
@@ -16,7 +16,15 @@ exports.OrderProductMutation = void 0;
|
|
|
16
16
|
const type_graphql_1 = require("type-graphql");
|
|
17
17
|
const typeorm_1 = require("typeorm");
|
|
18
18
|
const order_product_1 = require("./order-product");
|
|
19
|
+
const order_product_types_1 = require("./order-product-types");
|
|
19
20
|
let OrderProductMutation = class OrderProductMutation {
|
|
21
|
+
async updateOrderProduct(context, name, patch) {
|
|
22
|
+
const { tx, domain, user } = context.state;
|
|
23
|
+
let foundOP = await tx.getRepository(order_product_1.OrderProduct).findOne({
|
|
24
|
+
where: { domain, name }
|
|
25
|
+
});
|
|
26
|
+
return await tx.getRepository(order_product_1.OrderProduct).save(Object.assign(Object.assign(Object.assign({}, foundOP), patch), { updater: user }));
|
|
27
|
+
}
|
|
20
28
|
async deleteOrderProduct(name, context) {
|
|
21
29
|
const { tx, domain } = context.state;
|
|
22
30
|
await tx.getRepository(order_product_1.OrderProduct).delete({ domain, name });
|
|
@@ -31,6 +39,16 @@ let OrderProductMutation = class OrderProductMutation {
|
|
|
31
39
|
return true;
|
|
32
40
|
}
|
|
33
41
|
};
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
44
|
+
(0, type_graphql_1.Mutation)(returns => order_product_1.OrderProduct),
|
|
45
|
+
__param(0, (0, type_graphql_1.Ctx)()),
|
|
46
|
+
__param(1, (0, type_graphql_1.Arg)('name')),
|
|
47
|
+
__param(2, (0, type_graphql_1.Arg)('patch', type => order_product_types_1.OrderProductPatch)),
|
|
48
|
+
__metadata("design:type", Function),
|
|
49
|
+
__metadata("design:paramtypes", [Object, String, order_product_types_1.OrderProductPatch]),
|
|
50
|
+
__metadata("design:returntype", Promise)
|
|
51
|
+
], OrderProductMutation.prototype, "updateOrderProduct", null);
|
|
34
52
|
__decorate([
|
|
35
53
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
36
54
|
(0, type_graphql_1.Mutation)(returns => Boolean),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-product-mutation.js","sourceRoot":"","sources":["../../../server/service/order-product/order-product-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"order-product-mutation.js","sourceRoot":"","sources":["../../../server/service/order-product/order-product-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAsE;AACtE,qCAA2C;AAI3C,mDAA8C;AAC9C,+DAAyD;AAGzD,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;IAG/B,KAAK,CAAC,kBAAkB,CACf,OAAY,EACN,IAAY,EACgB,KAAwB;QAEjE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,IAAI,OAAO,GAAiB,MAAM,EAAE,CAAC,aAAa,CAAC,4BAAY,CAAC,CAAC,OAAO,CAAC;YACvE,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;SACxB,CAAC,CAAA;QAEF,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,4BAAY,CAAC,CAAC,IAAI,+CAAM,OAAO,GAAK,KAAK,KAAE,OAAO,EAAE,IAAI,IAAG,CAAA;IAC3F,CAAC;IAID,KAAK,CAAC,kBAAkB,CAAc,IAAY,EAAS,OAAY;QACrE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAA0C,OAAO,CAAC,KAAK,CAAA;QAE3E,MAAM,EAAE,CAAC,aAAa,CAAC,4BAAY,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;QAC7D,OAAO,IAAI,CAAA;IACb,CAAC;IAID,KAAK,CAAC,mBAAmB,CAAiC,KAAe,EAAS,OAAY;QAC5F,MAAM,EAAE,EAAE,EAAE,MAAM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main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@things-factory/setting-base": "^4.1.6",
|
|
35
35
|
"@things-factory/shell": "^4.1.6",
|
|
36
36
|
"@things-factory/transport-base": "^4.1.6",
|
|
37
|
-
"@things-factory/warehouse-base": "^4.1.
|
|
37
|
+
"@things-factory/warehouse-base": "^4.1.8"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "a2c80a6ae7adc79c5779b5ef9173c66d5a5d89b9"
|
|
40
40
|
}
|
|
@@ -1,10 +1,29 @@
|
|
|
1
|
-
import { Domain } from '@things-factory/shell'
|
|
2
1
|
import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
|
|
3
2
|
import { EntityManager, In } from 'typeorm'
|
|
3
|
+
|
|
4
|
+
import { Domain } from '@things-factory/shell'
|
|
5
|
+
|
|
4
6
|
import { OrderProduct } from './order-product'
|
|
7
|
+
import { OrderProductPatch } from './order-product-types'
|
|
5
8
|
|
|
6
9
|
@Resolver(OrderProduct)
|
|
7
10
|
export class OrderProductMutation {
|
|
11
|
+
@Directive('@transaction')
|
|
12
|
+
@Mutation(returns => OrderProduct)
|
|
13
|
+
async updateOrderProduct(
|
|
14
|
+
@Ctx() context: any,
|
|
15
|
+
@Arg('name') name: string,
|
|
16
|
+
@Arg('patch', type => OrderProductPatch) patch: OrderProductPatch
|
|
17
|
+
): Promise<OrderProduct> {
|
|
18
|
+
const { tx, domain, user } = context.state
|
|
19
|
+
|
|
20
|
+
let foundOP: OrderProduct = await tx.getRepository(OrderProduct).findOne({
|
|
21
|
+
where: { domain, name }
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
return await tx.getRepository(OrderProduct).save({ ...foundOP, ...patch, updater: user })
|
|
25
|
+
}
|
|
26
|
+
|
|
8
27
|
@Directive('@transaction')
|
|
9
28
|
@Mutation(returns => Boolean)
|
|
10
29
|
async deleteOrderProduct(@Arg('name') name: string, @Ctx() context: any): Promise<boolean> {
|