@things-factory/routing-base 5.0.7 → 6.0.0-alpha.0

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 (48) hide show
  1. package/dist-server/controllers/index.js.map +1 -1
  2. package/dist-server/index.js +4 -17
  3. package/dist-server/index.js.map +1 -1
  4. package/dist-server/middlewares/index.js.map +1 -1
  5. package/dist-server/migrations/index.js.map +1 -1
  6. package/dist-server/routes.js +0 -1
  7. package/dist-server/routes.js.map +1 -1
  8. package/dist-server/service/index.js +13 -26
  9. package/dist-server/service/index.js.map +1 -1
  10. package/dist-server/service/operation/index.js +3 -16
  11. package/dist-server/service/operation/index.js.map +1 -1
  12. package/dist-server/service/operation/operation-mutation.js +37 -48
  13. package/dist-server/service/operation/operation-mutation.js.map +1 -1
  14. package/dist-server/service/operation/operation-query.js +42 -55
  15. package/dist-server/service/operation/operation-query.js.map +1 -1
  16. package/dist-server/service/operation/operation-type.js +41 -52
  17. package/dist-server/service/operation/operation-type.js.map +1 -1
  18. package/dist-server/service/operation/operation.js +34 -43
  19. package/dist-server/service/operation/operation.js.map +1 -1
  20. package/dist-server/service/routing/index.js +3 -16
  21. package/dist-server/service/routing/index.js.map +1 -1
  22. package/dist-server/service/routing/routing-mutation.js +37 -48
  23. package/dist-server/service/routing/routing-mutation.js.map +1 -1
  24. package/dist-server/service/routing/routing-query.js +38 -51
  25. package/dist-server/service/routing/routing-query.js.map +1 -1
  26. package/dist-server/service/routing/routing-type.js +28 -36
  27. package/dist-server/service/routing/routing-type.js.map +1 -1
  28. package/dist-server/service/routing/routing.js +28 -37
  29. package/dist-server/service/routing/routing.js.map +1 -1
  30. package/dist-server/service/routing-item/index.js +3 -16
  31. package/dist-server/service/routing-item/index.js.map +1 -1
  32. package/dist-server/service/routing-item/routing-item-mutation.js +37 -48
  33. package/dist-server/service/routing-item/routing-item-mutation.js.map +1 -1
  34. package/dist-server/service/routing-item/routing-item-query.js +40 -53
  35. package/dist-server/service/routing-item/routing-item-query.js.map +1 -1
  36. package/dist-server/service/routing-item/routing-item-type.js +40 -49
  37. package/dist-server/service/routing-item/routing-item-type.js.map +1 -1
  38. package/dist-server/service/routing-item/routing-item.js +38 -47
  39. package/dist-server/service/routing-item/routing-item.js.map +1 -1
  40. package/dist-server/tsconfig.tsbuildinfo +1 -0
  41. package/package.json +5 -5
  42. package/server/routes.ts +0 -2
  43. package/server/service/operation/operation-mutation.ts +15 -9
  44. package/server/service/operation/operation-query.ts +8 -9
  45. package/server/service/routing/routing-mutation.ts +12 -14
  46. package/server/service/routing/routing-query.ts +19 -12
  47. package/server/service/routing-item/routing-item-mutation.ts +17 -20
  48. package/server/service/routing-item/routing-item-query.ts +10 -11
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/controllers/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/controllers/index.ts"],"names":[],"mappings":"","sourcesContent":[""]}
@@ -1,21 +1,8 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
17
4
  require("./routes");
18
- __exportStar(require("./migrations"), exports);
19
- __exportStar(require("./middlewares"), exports);
20
- __exportStar(require("./service"), exports);
5
+ tslib_1.__exportStar(require("./migrations"), exports);
6
+ tslib_1.__exportStar(require("./middlewares"), exports);
7
+ tslib_1.__exportStar(require("./service"), exports);
21
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oBAAiB;AAEjB,+CAA4B;AAC5B,gDAA6B;AAC7B,4CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;AAAA,oBAAiB;AAEjB,uDAA4B;AAC5B,wDAA6B;AAC7B,oDAAyB","sourcesContent":["import './routes'\n\nexport * from './migrations'\nexport * from './middlewares'\nexport * from './service'\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/middlewares/index.ts"],"names":[],"mappings":";;;AAAA,SAAgB,eAAe,CAAC,GAAG;IACjC,kCAAkC;AACpC,CAAC;AAFD,0CAEC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/middlewares/index.ts"],"names":[],"mappings":";;;AAAA,SAAgB,eAAe,CAAC,GAAG;IACjC,kCAAkC;AACpC,CAAC;AAFD,0CAEC","sourcesContent":["export function initMiddlewares(app) {\n /* can add middlewares into app */\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/migrations/index.ts"],"names":[],"mappings":";;;AAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAEjB,QAAA,UAAU,GAAG,EAAE,CAAA;AAE1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAS,IAAI;IACzE,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAAE,OAAM;IAC3C,kBAAU,GAAG,kBAAU,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AAClF,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/migrations/index.ts"],"names":[],"mappings":";;;AAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAEjB,QAAA,UAAU,GAAG,EAAE,CAAA;AAE1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAS,IAAI;IACzE,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAAE,OAAM;IAC3C,kBAAU,GAAG,kBAAU,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AAClF,CAAC,CAAC,CAAA","sourcesContent":["const glob = require('glob')\nconst path = require('path')\n\nexport var migrations = []\n\nglob.sync(path.resolve(__dirname, '.', '**', '*.js')).forEach(function(file) {\n if (file.indexOf('index.js') !== -1) return\n migrations = migrations.concat(Object.values(require(path.resolve(file))) || [])\n})\n"]}
@@ -1,4 +1,3 @@
1
- const debug = require('debug')('things-factory:routing-base:routes');
2
1
  process.on('bootstrap-module-global-public-route', (app, globalPublicRouter) => {
3
2
  /*
4
3
  * can add global public routes to application (auth not required, tenancy not required)
@@ -1 +1 @@
1
- {"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,oCAAoC,CAAC,CAAA;AAEpE,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF;;;;;OAKG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE;IACtF;;OAEG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF;;OAEG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE;IACtF;;OAEG;AACL,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF;;;;;OAKG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE;IACtF;;OAEG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF;;OAEG;AACL,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE;IACtF;;OAEG;AACL,CAAC,CAAC,CAAA","sourcesContent":["process.on('bootstrap-module-global-public-route' as any, (app, globalPublicRouter) => {\n /*\n * can add global public routes to application (auth not required, tenancy not required)\n *\n * ex) routes.get('/path', async(context, next) => {})\n * ex) routes.post('/path', async(context, next) => {})\n */\n})\n\nprocess.on('bootstrap-module-global-private-route' as any, (app, globalPrivateRouter) => {\n /*\n * can add global private routes to application (auth required, tenancy not required)\n */\n})\n\nprocess.on('bootstrap-module-domain-public-route' as any, (app, domainPublicRouter) => {\n /*\n * can add domain public routes to application (auth not required, tenancy required)\n */\n})\n\nprocess.on('bootstrap-module-domain-private-route' as any, (app, domainPrivateRouter) => {\n /*\n * can add domain private routes to application (auth required, tenancy required)\n */\n})\n"]}
@@ -1,39 +1,26 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
3
  exports.schema = exports.entities = void 0;
4
+ const tslib_1 = require("tslib");
18
5
  const operation_1 = require("./operation");
19
6
  const routing_1 = require("./routing");
20
7
  const routing_item_1 = require("./routing-item");
21
8
  /* EXPORT ENTITY TYPES */
22
- __exportStar(require("./routing/routing"), exports);
23
- __exportStar(require("./routing-item/routing-item"), exports);
24
- __exportStar(require("./operation/operation"), exports);
9
+ tslib_1.__exportStar(require("./routing/routing"), exports);
10
+ tslib_1.__exportStar(require("./routing-item/routing-item"), exports);
11
+ tslib_1.__exportStar(require("./operation/operation"), exports);
25
12
  /* EXPORT TYPES */
26
- __exportStar(require("./routing/routing-type"), exports);
27
- __exportStar(require("./operation/operation-type"), exports);
28
- __exportStar(require("./routing-item/routing-item-type"), exports);
13
+ tslib_1.__exportStar(require("./routing/routing-type"), exports);
14
+ tslib_1.__exportStar(require("./operation/operation-type"), exports);
15
+ tslib_1.__exportStar(require("./routing-item/routing-item-type"), exports);
29
16
  /* EXPORT MUTAIONS */
30
- __exportStar(require("./routing/routing-mutation"), exports);
31
- __exportStar(require("./operation/operation-mutation"), exports);
32
- __exportStar(require("./routing-item/routing-item-mutation"), exports);
17
+ tslib_1.__exportStar(require("./routing/routing-mutation"), exports);
18
+ tslib_1.__exportStar(require("./operation/operation-mutation"), exports);
19
+ tslib_1.__exportStar(require("./routing-item/routing-item-mutation"), exports);
33
20
  /* EXPORT QUERIES */
34
- __exportStar(require("./routing/routing-query"), exports);
35
- __exportStar(require("./operation/operation-query"), exports);
36
- __exportStar(require("./routing-item/routing-item-query"), exports);
21
+ tslib_1.__exportStar(require("./routing/routing-query"), exports);
22
+ tslib_1.__exportStar(require("./operation/operation-query"), exports);
23
+ tslib_1.__exportStar(require("./routing-item/routing-item-query"), exports);
37
24
  exports.entities = [
38
25
  /* ENTITIES */
39
26
  ...routing_1.entities,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAGoB;AACpB,uCAGkB;AAClB,iDAGuB;AAEvB,yBAAyB;AACzB,oDAAiC;AACjC,8DAA2C;AAC3C,wDAAqC;AAErC,kBAAkB;AAClB,yDAAsC;AACtC,6DAA0C;AAC1C,mEAAgD;AAEhD,qBAAqB;AACrB,6DAA0C;AAC1C,iEAA8C;AAC9C,uEAAoD;AAEpD,oBAAoB;AACpB,0DAAuC;AACvC,8DAA2C;AAC3C,oEAAiD;AAEpC,QAAA,QAAQ,GAAG;IACtB,cAAc;IACd,GAAG,kBAAe;IAClB,GAAG,uBAAmB;IACtB,GAAG,oBAAiB;CACrB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE,CAAC,GAAG,mBAAgB,EAAE,GAAG,wBAAoB,EAAE,GAAG,qBAAkB,CAAC;CACvF,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,2CAGoB;AACpB,uCAGkB;AAClB,iDAGuB;AAEvB,yBAAyB;AACzB,4DAAiC;AACjC,sEAA2C;AAC3C,gEAAqC;AAErC,kBAAkB;AAClB,iEAAsC;AACtC,qEAA0C;AAC1C,2EAAgD;AAEhD,qBAAqB;AACrB,qEAA0C;AAC1C,yEAA8C;AAC9C,+EAAoD;AAEpD,oBAAoB;AACpB,kEAAuC;AACvC,sEAA2C;AAC3C,4EAAiD;AAEpC,QAAA,QAAQ,GAAG;IACtB,cAAc;IACd,GAAG,kBAAe;IAClB,GAAG,uBAAmB;IACtB,GAAG,oBAAiB;CACrB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE,CAAC,GAAG,mBAAgB,EAAE,GAAG,wBAAoB,EAAE,GAAG,qBAAkB,CAAC;CACvF,CAAA","sourcesContent":["import {\n entities as OperationEntities,\n resolvers as OperationResolvers\n} from './operation'\nimport {\n entities as RoutingEntities,\n resolvers as RoutingResolvers\n} from './routing'\nimport {\n entities as RoutingItemEntities,\n resolvers as RoutingItemResolvers\n} from './routing-item'\n\n/* EXPORT ENTITY TYPES */\nexport * from './routing/routing'\nexport * from './routing-item/routing-item'\nexport * from './operation/operation'\n\n/* EXPORT TYPES */\nexport * from './routing/routing-type'\nexport * from './operation/operation-type'\nexport * from './routing-item/routing-item-type'\n\n/* EXPORT MUTAIONS */\nexport * from './routing/routing-mutation'\nexport * from './operation/operation-mutation'\nexport * from './routing-item/routing-item-mutation'\n\n/* EXPORT QUERIES */\nexport * from './routing/routing-query'\nexport * from './operation/operation-query'\nexport * from './routing-item/routing-item-query'\n\nexport const entities = [\n /* ENTITIES */\n ...RoutingEntities,\n ...RoutingItemEntities,\n ...OperationEntities\n]\n\nexport const schema = {\n resolverClasses: [...RoutingResolvers, ...RoutingItemResolvers, ...OperationResolvers]\n}\n"]}
@@ -1,25 +1,12 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
3
  exports.resolvers = exports.entities = void 0;
4
+ const tslib_1 = require("tslib");
18
5
  const operation_1 = require("./operation");
19
6
  const operation_mutation_1 = require("./operation-mutation");
20
7
  const operation_query_1 = require("./operation-query");
21
8
  exports.entities = [operation_1.Operation];
22
9
  exports.resolvers = [operation_query_1.OperationQuery, operation_mutation_1.OperationMutation];
23
- __exportStar(require("./operation-query"), exports);
24
- __exportStar(require("./operation-mutation"), exports);
10
+ tslib_1.__exportStar(require("./operation-query"), exports);
11
+ tslib_1.__exportStar(require("./operation-mutation"), exports);
25
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/operation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAuC;AACvC,6DAAwD;AACxD,uDAAkD;AAErC,QAAA,QAAQ,GAAG,CAAC,qBAAS,CAAC,CAAA;AACtB,QAAA,SAAS,GAAG,CAAC,gCAAc,EAAE,sCAAiB,CAAC,CAAA;AAE5D,oDAAiC;AACjC,uDAAoC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/operation/index.ts"],"names":[],"mappings":";;;;AAAA,2CAAuC;AACvC,6DAAwD;AACxD,uDAAkD;AAErC,QAAA,QAAQ,GAAG,CAAC,qBAAS,CAAC,CAAA;AACtB,QAAA,SAAS,GAAG,CAAC,gCAAc,EAAE,sCAAiB,CAAC,CAAA;AAE5D,4DAAiC;AACjC,+DAAoC","sourcesContent":["import { Operation } from './operation'\nimport { OperationMutation } from './operation-mutation'\nimport { OperationQuery } from './operation-query'\n\nexport const entities = [Operation]\nexport const resolvers = [OperationQuery, OperationMutation]\n\nexport * from './operation-query'\nexport * from './operation-mutation'\n"]}
@@ -1,18 +1,7 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
2
  Object.defineProperty(exports, "__esModule", { value: true });
15
3
  exports.OperationMutation = void 0;
4
+ const tslib_1 = require("tslib");
16
5
  const type_graphql_1 = require("type-graphql");
17
6
  const typeorm_1 = require("typeorm");
18
7
  const attachment_base_1 = require("@things-factory/attachment-base");
@@ -37,7 +26,7 @@ let OperationMutation = class OperationMutation {
37
26
  const { domain, user, tx } = context.state;
38
27
  const repository = tx.getRepository(operation_1.Operation);
39
28
  const operation = await repository.findOne({
40
- where: { domain, id }
29
+ where: { domain: { id: domain.id }, id }
41
30
  });
42
31
  const result = await repository.save(Object.assign(Object.assign(Object.assign({}, operation), patch), { updater: user }));
43
32
  if (patch.thumbnail) {
@@ -78,7 +67,7 @@ let OperationMutation = class OperationMutation {
78
67
  if (_updateRecords.length > 0) {
79
68
  for (let i = 0; i < _updateRecords.length; i++) {
80
69
  const newRecord = _updateRecords[i];
81
- const operation = await operationRepo.findOne(newRecord.id);
70
+ const operation = await operationRepo.findOneBy({ id: newRecord.id });
82
71
  const result = await operationRepo.save(Object.assign(Object.assign(Object.assign({}, operation), newRecord), { updater: user }));
83
72
  if (newRecord.thumbnail) {
84
73
  await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [result.id] }, context);
@@ -97,67 +86,67 @@ let OperationMutation = class OperationMutation {
97
86
  }
98
87
  async deleteOperation(id, context) {
99
88
  const { domain, tx } = context.state;
100
- await tx.getRepository(operation_1.Operation).delete({ domain, id });
89
+ await tx.getRepository(operation_1.Operation).delete({ domain: { id: domain.id }, id });
101
90
  await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [id] }, context);
102
91
  return true;
103
92
  }
104
93
  async deleteOperations(ids, context) {
105
94
  const { domain, tx } = context.state;
106
95
  await tx.getRepository(operation_1.Operation).delete({
107
- domain,
96
+ domain: { id: domain.id },
108
97
  id: (0, typeorm_1.In)(ids)
109
98
  });
110
99
  await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: ids }, context);
111
100
  return true;
112
101
  }
113
102
  };
114
- __decorate([
103
+ tslib_1.__decorate([
115
104
  (0, type_graphql_1.Directive)('@transaction'),
116
105
  (0, type_graphql_1.Mutation)(returns => operation_1.Operation, { description: 'To create new Operation' }),
117
- __param(0, (0, type_graphql_1.Arg)('operation')),
118
- __param(1, (0, type_graphql_1.Ctx)()),
119
- __metadata("design:type", Function),
120
- __metadata("design:paramtypes", [operation_type_1.NewOperation, Object]),
121
- __metadata("design:returntype", Promise)
106
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('operation')),
107
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
108
+ tslib_1.__metadata("design:type", Function),
109
+ tslib_1.__metadata("design:paramtypes", [operation_type_1.NewOperation, Object]),
110
+ tslib_1.__metadata("design:returntype", Promise)
122
111
  ], OperationMutation.prototype, "createOperation", null);
123
- __decorate([
112
+ tslib_1.__decorate([
124
113
  (0, type_graphql_1.Directive)('@transaction'),
125
114
  (0, type_graphql_1.Mutation)(returns => operation_1.Operation, { description: 'To modify Operation information' }),
126
- __param(0, (0, type_graphql_1.Arg)('id')),
127
- __param(1, (0, type_graphql_1.Arg)('patch')),
128
- __param(2, (0, type_graphql_1.Ctx)()),
129
- __metadata("design:type", Function),
130
- __metadata("design:paramtypes", [String, operation_type_1.OperationPatch, Object]),
131
- __metadata("design:returntype", Promise)
115
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
116
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
117
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
118
+ tslib_1.__metadata("design:type", Function),
119
+ tslib_1.__metadata("design:paramtypes", [String, operation_type_1.OperationPatch, Object]),
120
+ tslib_1.__metadata("design:returntype", Promise)
132
121
  ], OperationMutation.prototype, "updateOperation", null);
133
- __decorate([
122
+ tslib_1.__decorate([
134
123
  (0, type_graphql_1.Directive)('@transaction'),
135
124
  (0, type_graphql_1.Mutation)(returns => [operation_1.Operation], { description: "To modify multiple Operations' information" }),
136
- __param(0, (0, type_graphql_1.Arg)('patches', type => [operation_type_1.OperationPatch])),
137
- __param(1, (0, type_graphql_1.Ctx)()),
138
- __metadata("design:type", Function),
139
- __metadata("design:paramtypes", [Array, Object]),
140
- __metadata("design:returntype", Promise)
125
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [operation_type_1.OperationPatch])),
126
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
127
+ tslib_1.__metadata("design:type", Function),
128
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
129
+ tslib_1.__metadata("design:returntype", Promise)
141
130
  ], OperationMutation.prototype, "updateMultipleOperation", null);
142
- __decorate([
131
+ tslib_1.__decorate([
143
132
  (0, type_graphql_1.Directive)('@transaction'),
144
133
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete Operation' }),
145
- __param(0, (0, type_graphql_1.Arg)('id')),
146
- __param(1, (0, type_graphql_1.Ctx)()),
147
- __metadata("design:type", Function),
148
- __metadata("design:paramtypes", [String, Object]),
149
- __metadata("design:returntype", Promise)
134
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
135
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
136
+ tslib_1.__metadata("design:type", Function),
137
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
138
+ tslib_1.__metadata("design:returntype", Promise)
150
139
  ], OperationMutation.prototype, "deleteOperation", null);
151
- __decorate([
140
+ tslib_1.__decorate([
152
141
  (0, type_graphql_1.Directive)('@transaction'),
153
142
  (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple operations' }),
154
- __param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
155
- __param(1, (0, type_graphql_1.Ctx)()),
156
- __metadata("design:type", Function),
157
- __metadata("design:paramtypes", [Array, Object]),
158
- __metadata("design:returntype", Promise)
143
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
144
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
145
+ tslib_1.__metadata("design:type", Function),
146
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
147
+ tslib_1.__metadata("design:returntype", Promise)
159
148
  ], OperationMutation.prototype, "deleteOperations", null);
160
- OperationMutation = __decorate([
149
+ OperationMutation = tslib_1.__decorate([
161
150
  (0, type_graphql_1.Resolver)(operation_1.Operation)
162
151
  ], OperationMutation);
163
152
  exports.OperationMutation = OperationMutation;
@@ -1 +1 @@
1
- {"version":3,"file":"operation-mutation.js","sourceRoot":"","sources":["../../../server/service/operation/operation-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA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ACT,mBAAA,IAAA,kBAAG,EAAC,OAAO,CAAC,CAAA;IACZ,mBAAA,IAAA,kBAAG,GAAE,CAAA;;qDADe,+BAAc;;wDAiCpC;AAID;IAFC,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC,qBAAS,CAAC,EAAE,EAAE,WAAW,EAAE,4CAA4C,EAAE,CAAC;IAE7F,mBAAA,IAAA,kBAAG,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,+BAAc,CAAC,CAAC,CAAA;IACxC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;gEAqEP;AAID;IAFC,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,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;IAE5E,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;yDAYP;AA9KU,iBAAiB;IAD7B,IAAA,uBAAQ,EAAC,qBAAS,CAAC;GACP,iBAAiB,CA+K7B;AA/KY,8CAAiB","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'\n\nimport { Operation } from './operation'\nimport { NewOperation, OperationPatch } from './operation-type'\n\n@Resolver(Operation)\nexport class OperationMutation {\n @Directive('@transaction')\n @Mutation(returns => Operation, { description: 'To create new Operation' })\n async createOperation(\n @Arg('operation') operation: NewOperation,\n @Ctx() context: ResolverContext\n ): Promise<Operation> {\n const { domain, user, tx } = context.state\n\n const result = await tx.getRepository(Operation).save({\n ...operation,\n domain,\n creator: user,\n updater: user\n })\n\n if (operation.thumbnail) {\n await createAttachment(\n null,\n {\n attachment: {\n file: operation.thumbnail,\n refType: Operation.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => Operation, { description: 'To modify Operation information' })\n async updateOperation(\n @Arg('id') id: string,\n @Arg('patch') patch: OperationPatch,\n @Ctx() context: ResolverContext\n ): Promise<Operation> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(Operation)\n const operation = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...operation,\n ...patch,\n updater: user\n })\n\n if (patch.thumbnail) {\n // ?? { refBys: [operation.id] }\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: patch.thumbnail,\n refType: Operation.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [Operation], { description: \"To modify multiple Operations' information\" })\n async updateMultipleOperation(\n @Arg('patches', type => [OperationPatch]) patches: OperationPatch[],\n @Ctx() context: ResolverContext\n ): Promise<Operation[]> {\n const { domain, user, 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 operationRepo = tx.getRepository(Operation)\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 operationRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n if (newRecord.thumbnail) {\n await createAttachment(\n null,\n {\n attachment: {\n file: newRecord.thumbnail,\n refType: Operation.name,\n refBy: result.id\n }\n },\n context\n )\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 newRecord = _updateRecords[i]\n const operation = await operationRepo.findOneBy({ id: newRecord.id })\n\n const result = await operationRepo.save({\n ...operation,\n ...newRecord,\n updater: user\n })\n\n if (newRecord.thumbnail) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: newRecord.thumbnail,\n refType: Operation.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete Operation' })\n async deleteOperation(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Operation).delete({ domain: { id: domain.id }, id })\n await deleteAttachmentsByRef(null, { refBys: [id] }, context)\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple operations' })\n async deleteOperations(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Operation).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n await deleteAttachmentsByRef(null, { refBys: ids }, context)\n\n return true\n }\n}\n"]}
@@ -1,21 +1,8 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
- var _a;
15
2
  Object.defineProperty(exports, "__esModule", { value: true });
16
3
  exports.OperationQuery = void 0;
4
+ const tslib_1 = require("tslib");
17
5
  const type_graphql_1 = require("type-graphql");
18
- const typeorm_1 = require("typeorm");
19
6
  const attachment_base_1 = require("@things-factory/attachment-base");
20
7
  const auth_base_1 = require("@things-factory/auth-base");
21
8
  const shell_1 = require("@things-factory/shell");
@@ -24,14 +11,14 @@ const operation_type_1 = require("./operation-type");
24
11
  let OperationQuery = class OperationQuery {
25
12
  async operation(id, context) {
26
13
  const { domain } = context.state;
27
- return await (0, typeorm_1.getRepository)(operation_1.Operation).findOne({
28
- where: { domain, id }
14
+ return await (0, shell_1.getRepository)(operation_1.Operation).findOne({
15
+ where: { domain: { id: domain.id }, id }
29
16
  });
30
17
  }
31
18
  async operations(params, context) {
32
19
  const { domain } = context.state;
33
20
  const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
34
- repository: (0, typeorm_1.getRepository)(operation_1.Operation),
21
+ repository: (0, shell_1.getRepository)(operation_1.Operation),
35
22
  params,
36
23
  domain,
37
24
  searchables: ['name', 'description']
@@ -40,69 +27,69 @@ let OperationQuery = class OperationQuery {
40
27
  return { items, total };
41
28
  }
42
29
  async domain(operation) {
43
- return await (0, typeorm_1.getRepository)(shell_1.Domain).findOne(operation.domainId);
30
+ return await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: operation.domainId });
44
31
  }
45
32
  async updater(operation) {
46
- return await (0, typeorm_1.getRepository)(auth_base_1.User).findOne(operation.updaterId);
33
+ return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: operation.updaterId });
47
34
  }
48
35
  async creator(operation) {
49
- return await (0, typeorm_1.getRepository)(auth_base_1.User).findOne(operation.creatorId);
36
+ return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: operation.creatorId });
50
37
  }
51
38
  async thumbnail(operation) {
52
- const attachment = await (0, typeorm_1.getRepository)(attachment_base_1.Attachment).findOne({
39
+ const attachment = await (0, shell_1.getRepository)(attachment_base_1.Attachment).findOne({
53
40
  where: {
54
- domain: operation.domainId,
41
+ domain: { id: operation.domainId },
55
42
  refBy: operation.id
56
43
  }
57
44
  });
58
45
  return attachment === null || attachment === void 0 ? void 0 : attachment.fullpath;
59
46
  }
60
47
  };
61
- __decorate([
48
+ tslib_1.__decorate([
62
49
  (0, type_graphql_1.Query)(returns => operation_1.Operation, { description: 'To fetch a Operation' }),
63
- __param(0, (0, type_graphql_1.Arg)('id')),
64
- __param(1, (0, type_graphql_1.Ctx)()),
65
- __metadata("design:type", Function),
66
- __metadata("design:paramtypes", [String, Object]),
67
- __metadata("design:returntype", Promise)
50
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
51
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
52
+ tslib_1.__metadata("design:type", Function),
53
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
54
+ tslib_1.__metadata("design:returntype", Promise)
68
55
  ], OperationQuery.prototype, "operation", null);
69
- __decorate([
56
+ tslib_1.__decorate([
70
57
  (0, type_graphql_1.Query)(returns => operation_type_1.OperationList, { description: 'To fetch multiple Operations' }),
71
- __param(0, (0, type_graphql_1.Args)()),
72
- __param(1, (0, type_graphql_1.Ctx)()),
73
- __metadata("design:type", Function),
74
- __metadata("design:paramtypes", [typeof (_a = typeof shell_1.ListParam !== "undefined" && shell_1.ListParam) === "function" ? _a : Object, Object]),
75
- __metadata("design:returntype", Promise)
58
+ tslib_1.__param(0, (0, type_graphql_1.Args)()),
59
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
60
+ tslib_1.__metadata("design:type", Function),
61
+ tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
62
+ tslib_1.__metadata("design:returntype", Promise)
76
63
  ], OperationQuery.prototype, "operations", null);
77
- __decorate([
64
+ tslib_1.__decorate([
78
65
  (0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
79
- __param(0, (0, type_graphql_1.Root)()),
80
- __metadata("design:type", Function),
81
- __metadata("design:paramtypes", [operation_1.Operation]),
82
- __metadata("design:returntype", Promise)
66
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
67
+ tslib_1.__metadata("design:type", Function),
68
+ tslib_1.__metadata("design:paramtypes", [operation_1.Operation]),
69
+ tslib_1.__metadata("design:returntype", Promise)
83
70
  ], OperationQuery.prototype, "domain", null);
84
- __decorate([
71
+ tslib_1.__decorate([
85
72
  (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
86
- __param(0, (0, type_graphql_1.Root)()),
87
- __metadata("design:type", Function),
88
- __metadata("design:paramtypes", [operation_1.Operation]),
89
- __metadata("design:returntype", Promise)
73
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
74
+ tslib_1.__metadata("design:type", Function),
75
+ tslib_1.__metadata("design:paramtypes", [operation_1.Operation]),
76
+ tslib_1.__metadata("design:returntype", Promise)
90
77
  ], OperationQuery.prototype, "updater", null);
91
- __decorate([
78
+ tslib_1.__decorate([
92
79
  (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
93
- __param(0, (0, type_graphql_1.Root)()),
94
- __metadata("design:type", Function),
95
- __metadata("design:paramtypes", [operation_1.Operation]),
96
- __metadata("design:returntype", Promise)
80
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
81
+ tslib_1.__metadata("design:type", Function),
82
+ tslib_1.__metadata("design:paramtypes", [operation_1.Operation]),
83
+ tslib_1.__metadata("design:returntype", Promise)
97
84
  ], OperationQuery.prototype, "creator", null);
98
- __decorate([
85
+ tslib_1.__decorate([
99
86
  (0, type_graphql_1.FieldResolver)(type => String),
100
- __param(0, (0, type_graphql_1.Root)()),
101
- __metadata("design:type", Function),
102
- __metadata("design:paramtypes", [operation_1.Operation]),
103
- __metadata("design:returntype", Promise)
87
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
88
+ tslib_1.__metadata("design:type", Function),
89
+ tslib_1.__metadata("design:paramtypes", [operation_1.Operation]),
90
+ tslib_1.__metadata("design:returntype", Promise)
104
91
  ], OperationQuery.prototype, "thumbnail", null);
105
- OperationQuery = __decorate([
92
+ OperationQuery = tslib_1.__decorate([
106
93
  (0, type_graphql_1.Resolver)(operation_1.Operation)
107
94
  ], OperationQuery);
108
95
  exports.OperationQuery = OperationQuery;
@@ -1 +1 @@
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,iDAAwF;AAExF,2CAAuC;AACvC,qDAAgD;AAGhD,IAAa,cAAc,GAA3B,MAAa,cAAc;IAEzB,KAAK,CAAC,SAAS,CAAY,EAAU,EAAS,OAAY;QACxD,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,uBAAa,EAAC,qBAAS,CAAC,CAAC,OAAO,CAAC;YAC5C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;SACtB,CAAC,CAAA;IACJ,CAAC;IAGD,KAAK,CAAC,UAAU,CAAS,MAAiB,EAAS,OAAY;QAC7D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,YAAY,GAAG,IAAA,qCAA6B,EAAC;YACjD,UAAU,EAAE,IAAA,uBAAa,EAAC,qBAAS,CAAC;YACpC,MAAM;YACN,MAAM;YACN,WAAW,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC;SACrC,CAAC,CAAA;QAEF,MAAM,CAAC,KAAK,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E,CAAA;IAAqB,WAAA,IAAA,kBAAG,GAAE,CAAA;;yDAAjB,iBAAS,oBAAT,iBAAS;;gDAazC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAY,qBAAS;;4CAExC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAY,qBAAS;;6CAEzC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAY,qBAAS;;6CAEzC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC;IACb,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAY,qBAAS;;+CAS3C;AAnDU,cAAc;IAD1B,IAAA,uBAAQ,EAAC,qBAAS,CAAC;GACP,cAAc,CAoD1B;AApDY,wCAAc"}
1
+ {"version":3,"file":"operation-query.js","sourceRoot":"","sources":["../../../server/service/operation/operation-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AAEnF,qEAA4D;AAC5D,yDAAgD;AAChD,iDAAuG;AAEvG,2CAAuC;AACvC,qDAAgD;AAGhD,IAAa,cAAc,GAA3B,MAAa,cAAc;IAEzB,KAAK,CAAC,SAAS,CAAY,EAAU,EAAS,OAAwB;QACpE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,qBAAS,CAAC,CAAC,OAAO,CAAC;YAC5C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;IACJ,CAAC;IAGD,KAAK,CAAC,UAAU,CA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,CAAE,QAAQ,CAAA;IAC7B,CAAC;CACF,CAAA;AAlDC;IADC,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,qBAAS,EAAE,EAAE,WAAW,EAAE,sBAAsB,EAAE,CAAC;IACpD,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+CAM5C;AAGD;IADC,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,iBAAS;;gDAazC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAY,qBAAS;;4CAExC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAY,qBAAS;;6CAEzC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAY,qBAAS;;6CAEzC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAY,qBAAS;;+CAS3C;AAnDU,cAAc;IAD1B,IAAA,uBAAQ,EAAC,qBAAS,CAAC;GACP,cAAc,CAoD1B;AApDY,wCAAc","sourcesContent":["import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'\n\nimport { Attachment } from '@things-factory/attachment-base'\nimport { User } from '@things-factory/auth-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\n\nimport { Operation } from './operation'\nimport { OperationList } from './operation-type'\n\n@Resolver(Operation)\nexport class OperationQuery {\n @Query(returns => Operation, { description: 'To fetch a Operation' })\n async operation(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Operation> {\n const { domain } = context.state\n\n return await getRepository(Operation).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => OperationList, { description: 'To fetch multiple Operations' })\n async operations(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<OperationList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n repository: getRepository(Operation),\n params,\n domain,\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() operation: Operation): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: operation.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() operation: Operation): Promise<User> {\n return await getRepository(User).findOneBy({ id: operation.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() operation: Operation): Promise<User> {\n return await getRepository(User).findOneBy({ id: operation.creatorId })\n }\n\n @FieldResolver(type => String)\n async thumbnail(@Root() operation: Operation): Promise<string | undefined> {\n const attachment: Attachment = await getRepository(Attachment).findOne({\n where: {\n domain: { id: operation.domainId },\n refBy: operation.id\n }\n })\n\n return attachment?.fullpath\n }\n}\n"]}