@things-factory/integration-lmd 4.3.332 → 4.3.335
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,15 +16,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
exports.LastMileDeliveryQuery = void 0;
|
|
17
17
|
const type_graphql_1 = require("type-graphql");
|
|
18
18
|
const typeorm_1 = require("typeorm");
|
|
19
|
-
const shell_1 = require("@things-factory/shell");
|
|
20
19
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
20
|
+
const shell_1 = require("@things-factory/shell");
|
|
21
21
|
const last_mile_delivery_1 = require("./last-mile-delivery");
|
|
22
22
|
const last_mile_delivery_type_1 = require("./last-mile-delivery-type");
|
|
23
23
|
let LastMileDeliveryQuery = class LastMileDeliveryQuery {
|
|
24
24
|
async lastMileDelivery(id, context) {
|
|
25
25
|
const { domain, user, tx } = context.state;
|
|
26
26
|
const result = await tx.getRepository(last_mile_delivery_1.LastMileDelivery).findOne({
|
|
27
|
-
where: { id },
|
|
27
|
+
where: { id },
|
|
28
|
+
relations: [
|
|
29
|
+
'lastMileDeliverySettings',
|
|
30
|
+
'lastMileDeliverySettings.geoCountry',
|
|
31
|
+
'lastMileDeliveryBizplaces',
|
|
32
|
+
'lastMileDeliveryBizplaces.bizplace'
|
|
33
|
+
]
|
|
28
34
|
});
|
|
29
35
|
return result;
|
|
30
36
|
}
|
|
@@ -34,6 +40,13 @@ let LastMileDeliveryQuery = class LastMileDeliveryQuery {
|
|
|
34
40
|
const [items, total] = await (0, typeorm_1.getRepository)(last_mile_delivery_1.LastMileDelivery).findAndCount(Object.assign(Object.assign({}, convertedParams), { relations: ['lastMileDeliverySettings'] }));
|
|
35
41
|
return { items, total };
|
|
36
42
|
}
|
|
43
|
+
async checkActiveLastMileDelivery(context) {
|
|
44
|
+
const { domain } = context.state;
|
|
45
|
+
const count = await (0, typeorm_1.getRepository)(last_mile_delivery_1.LastMileDelivery).count({
|
|
46
|
+
where: { domain, status: 'active' }
|
|
47
|
+
});
|
|
48
|
+
return count > 0;
|
|
49
|
+
}
|
|
37
50
|
async domain(lastMileDelivery) {
|
|
38
51
|
return await (0, typeorm_1.getRepository)(shell_1.Domain).findOne(lastMileDelivery.domainId);
|
|
39
52
|
}
|
|
@@ -61,6 +74,13 @@ __decorate([
|
|
|
61
74
|
__metadata("design:paramtypes", [typeof (_a = typeof shell_1.ListParam !== "undefined" && shell_1.ListParam) === "function" ? _a : Object, Object]),
|
|
62
75
|
__metadata("design:returntype", Promise)
|
|
63
76
|
], LastMileDeliveryQuery.prototype, "lastMileDeliveries", null);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, type_graphql_1.Query)(returns => Boolean),
|
|
79
|
+
__param(0, (0, type_graphql_1.Ctx)()),
|
|
80
|
+
__metadata("design:type", Function),
|
|
81
|
+
__metadata("design:paramtypes", [Object]),
|
|
82
|
+
__metadata("design:returntype", Promise)
|
|
83
|
+
], LastMileDeliveryQuery.prototype, "checkActiveLastMileDelivery", null);
|
|
64
84
|
__decorate([
|
|
65
85
|
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
|
|
66
86
|
__param(0, (0, type_graphql_1.Root)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"last-mile-delivery-query.js","sourceRoot":"","sources":["../../../server/service/last-mile-delivery/last-mile-delivery-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"last-mile-delivery-query.js","sourceRoot":"","sources":["../../../server/service/last-mile-delivery/last-mile-delivery-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CASqB;AACrB,qCAAuC;AAEvC,yDAAgD;AAChD,iDAI8B;AAE9B,6DAAuD;AACvD,uEAAgE;AAGzD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAG1B,AAAN,KAAK,CAAC,gBAAgB,CAAY,EAAU,EAAS,OAAY;QAC/D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E,CAAC,gBAAI,CAAC;IACb,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAmB,qCAAgB;;oDAEvD;AAtDU,qBAAqB;IADjC,IAAA,uBAAQ,EAAC,qCAAgB,CAAC;GACd,qBAAqB,CAuDjC;AAvDY,sDAAqB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/integration-lmd",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.335",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"nock": "^13.0.2",
|
|
50
50
|
"should": "^13.2.3"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "b475ac676bc9286c19f679300a012c1d0528761b"
|
|
53
53
|
}
|
|
@@ -1,12 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Arg,
|
|
3
|
+
Args,
|
|
4
|
+
Ctx,
|
|
5
|
+
Directive,
|
|
6
|
+
FieldResolver,
|
|
7
|
+
Query,
|
|
8
|
+
Resolver,
|
|
9
|
+
Root
|
|
10
|
+
} from 'type-graphql'
|
|
2
11
|
import { getRepository } from 'typeorm'
|
|
3
|
-
|
|
12
|
+
|
|
4
13
|
import { User } from '@things-factory/auth-base'
|
|
14
|
+
import {
|
|
15
|
+
convertListParams,
|
|
16
|
+
Domain,
|
|
17
|
+
ListParam
|
|
18
|
+
} from '@things-factory/shell'
|
|
19
|
+
|
|
5
20
|
import { LastMileDelivery } from './last-mile-delivery'
|
|
6
|
-
import { LastMileDeliverySetting } from '../last-mile-delivery-setting/last-mile-delivery-setting'
|
|
7
21
|
import { LastMileDeliveryList } from './last-mile-delivery-type'
|
|
8
|
-
import { LastMileDeliveryBizplace, LastMileDeliveryBizplaceStatus } from '../last-mile-delivery-bizplace/last-mile-delivery-bizplace'
|
|
9
|
-
import { LastMileDeliveryBizplaceList } from '../last-mile-delivery-bizplace/last-mile-delivery-bizplace-type'
|
|
10
22
|
|
|
11
23
|
@Resolver(LastMileDelivery)
|
|
12
24
|
export class LastMileDeliveryQuery {
|
|
@@ -15,7 +27,13 @@ export class LastMileDeliveryQuery {
|
|
|
15
27
|
async lastMileDelivery(@Arg('id') id: string, @Ctx() context: any): Promise<LastMileDelivery> {
|
|
16
28
|
const { domain, user, tx } = context.state
|
|
17
29
|
const result = await tx.getRepository(LastMileDelivery).findOne({
|
|
18
|
-
where: { id },
|
|
30
|
+
where: { id },
|
|
31
|
+
relations: [
|
|
32
|
+
'lastMileDeliverySettings',
|
|
33
|
+
'lastMileDeliverySettings.geoCountry',
|
|
34
|
+
'lastMileDeliveryBizplaces',
|
|
35
|
+
'lastMileDeliveryBizplaces.bizplace'
|
|
36
|
+
]
|
|
19
37
|
})
|
|
20
38
|
return result
|
|
21
39
|
}
|
|
@@ -25,11 +43,25 @@ export class LastMileDeliveryQuery {
|
|
|
25
43
|
const { domain } = context.state
|
|
26
44
|
|
|
27
45
|
const convertedParams = convertListParams(params, domain.id)
|
|
28
|
-
const [items, total] = await getRepository(LastMileDelivery).findAndCount({
|
|
46
|
+
const [items, total] = await getRepository(LastMileDelivery).findAndCount({
|
|
47
|
+
...convertedParams,
|
|
48
|
+
relations: ['lastMileDeliverySettings']
|
|
49
|
+
})
|
|
29
50
|
|
|
30
51
|
return { items, total }
|
|
31
52
|
}
|
|
32
53
|
|
|
54
|
+
@Query(returns => Boolean)
|
|
55
|
+
async checkActiveLastMileDelivery(@Ctx() context: any): Promise<Boolean> {
|
|
56
|
+
const { domain } = context.state
|
|
57
|
+
|
|
58
|
+
const count = await getRepository(LastMileDelivery).count({
|
|
59
|
+
where: { domain, status: 'active' }
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
return count > 0
|
|
63
|
+
}
|
|
64
|
+
|
|
33
65
|
@FieldResolver(type => Domain)
|
|
34
66
|
async domain(@Root() lastMileDelivery: LastMileDelivery): Promise<Domain> {
|
|
35
67
|
return await getRepository(Domain).findOne(lastMileDelivery.domainId)
|