@things-factory/quotation 9.0.0-beta.24 → 9.0.0-beta.27

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 (78) hide show
  1. package/package.json +5 -5
  2. package/dist-client/actions/main.d.ts +0 -1
  3. package/dist-client/actions/main.js +0 -2
  4. package/dist-client/actions/main.js.map +0 -1
  5. package/dist-client/activities/activity-quotation-edit.d.ts +0 -14
  6. package/dist-client/activities/activity-quotation-edit.js +0 -87
  7. package/dist-client/activities/activity-quotation-edit.js.map +0 -1
  8. package/dist-client/activities/activity-quotation-view.d.ts +0 -14
  9. package/dist-client/activities/activity-quotation-view.js +0 -87
  10. package/dist-client/activities/activity-quotation-view.js.map +0 -1
  11. package/dist-client/bootstrap.d.ts +0 -1
  12. package/dist-client/bootstrap.js +0 -8
  13. package/dist-client/bootstrap.js.map +0 -1
  14. package/dist-client/index.d.ts +0 -1
  15. package/dist-client/index.js +0 -2
  16. package/dist-client/index.js.map +0 -1
  17. package/dist-client/pages/main.d.ts +0 -1
  18. package/dist-client/pages/main.js +0 -27
  19. package/dist-client/pages/main.js.map +0 -1
  20. package/dist-client/pages/quotation/quotation-importer.d.ts +0 -23
  21. package/dist-client/pages/quotation/quotation-importer.js +0 -94
  22. package/dist-client/pages/quotation/quotation-importer.js.map +0 -1
  23. package/dist-client/pages/quotation/quotation-list-page.d.ts +0 -61
  24. package/dist-client/pages/quotation/quotation-list-page.js +0 -306
  25. package/dist-client/pages/quotation/quotation-list-page.js.map +0 -1
  26. package/dist-client/reducers/main.d.ts +0 -6
  27. package/dist-client/reducers/main.js +0 -14
  28. package/dist-client/reducers/main.js.map +0 -1
  29. package/dist-client/route.d.ts +0 -1
  30. package/dist-client/route.js +0 -11
  31. package/dist-client/route.js.map +0 -1
  32. package/dist-client/tsconfig.tsbuildinfo +0 -1
  33. package/dist-server/activities/activity-quotation.d.ts +0 -42
  34. package/dist-server/activities/activity-quotation.js +0 -114
  35. package/dist-server/activities/activity-quotation.js.map +0 -1
  36. package/dist-server/activities/index.d.ts +0 -1
  37. package/dist-server/activities/index.js +0 -17
  38. package/dist-server/activities/index.js.map +0 -1
  39. package/dist-server/controllers/index.d.ts +0 -0
  40. package/dist-server/controllers/index.js +0 -1
  41. package/dist-server/controllers/index.js.map +0 -1
  42. package/dist-server/index.d.ts +0 -3
  43. package/dist-server/index.js +0 -7
  44. package/dist-server/index.js.map +0 -1
  45. package/dist-server/middlewares/index.d.ts +0 -1
  46. package/dist-server/middlewares/index.js +0 -7
  47. package/dist-server/middlewares/index.js.map +0 -1
  48. package/dist-server/migrations/index.d.ts +0 -1
  49. package/dist-server/migrations/index.js +0 -12
  50. package/dist-server/migrations/index.js.map +0 -1
  51. package/dist-server/routes.d.ts +0 -0
  52. package/dist-server/routes.js +0 -24
  53. package/dist-server/routes.js.map +0 -1
  54. package/dist-server/service/index.d.ts +0 -6
  55. package/dist-server/service/index.js +0 -23
  56. package/dist-server/service/index.js.map +0 -1
  57. package/dist-server/service/quotation/event-subscriber.d.ts +0 -7
  58. package/dist-server/service/quotation/event-subscriber.js +0 -21
  59. package/dist-server/service/quotation/event-subscriber.js.map +0 -1
  60. package/dist-server/service/quotation/index.d.ts +0 -7
  61. package/dist-server/service/quotation/index.js +0 -12
  62. package/dist-server/service/quotation/index.js.map +0 -1
  63. package/dist-server/service/quotation/quotation-history.d.ts +0 -25
  64. package/dist-server/service/quotation/quotation-history.js +0 -132
  65. package/dist-server/service/quotation/quotation-history.js.map +0 -1
  66. package/dist-server/service/quotation/quotation-mutation.d.ts +0 -10
  67. package/dist-server/service/quotation/quotation-mutation.js +0 -168
  68. package/dist-server/service/quotation/quotation-mutation.js.map +0 -1
  69. package/dist-server/service/quotation/quotation-query.d.ts +0 -12
  70. package/dist-server/service/quotation/quotation-query.js +0 -97
  71. package/dist-server/service/quotation/quotation-query.js.map +0 -1
  72. package/dist-server/service/quotation/quotation-type.d.ts +0 -23
  73. package/dist-server/service/quotation/quotation-type.js +0 -86
  74. package/dist-server/service/quotation/quotation-type.js.map +0 -1
  75. package/dist-server/service/quotation/quotation.d.ts +0 -25
  76. package/dist-server/service/quotation/quotation.js +0 -112
  77. package/dist-server/service/quotation/quotation.js.map +0 -1
  78. package/dist-server/tsconfig.tsbuildinfo +0 -1
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initMiddlewares = initMiddlewares;
4
- function initMiddlewares(app) {
5
- /* can add middlewares into app */
6
- }
7
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/middlewares/index.ts"],"names":[],"mappings":";;AAAA,0CAEC;AAFD,SAAgB,eAAe,CAAC,GAAG;IACjC,kCAAkC;AACpC,CAAC","sourcesContent":["export function initMiddlewares(app) {\n /* can add middlewares into app */\n}\n"]}
@@ -1 +0,0 @@
1
- export declare var migrations: any[];
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.migrations = void 0;
4
- const glob = require('glob');
5
- const path = require('path');
6
- exports.migrations = [];
7
- glob.sync(path.resolve(__dirname, '.', '**', '*.js')).forEach(function (file) {
8
- if (file.indexOf('index.js') !== -1)
9
- return;
10
- exports.migrations = exports.migrations.concat(Object.values(require(path.resolve(file))) || []);
11
- });
12
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
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"]}
File without changes
@@ -1,24 +0,0 @@
1
- process.on('bootstrap-module-global-public-route', (app, globalPublicRouter) => {
2
- /*
3
- * can add global public routes to application (auth not required, tenancy not required)
4
- *
5
- * ex) routes.get('/path', async(context, next) => {})
6
- * ex) routes.post('/path', async(context, next) => {})
7
- */
8
- });
9
- process.on('bootstrap-module-global-private-route', (app, globalPrivateRouter) => {
10
- /*
11
- * can add global private routes to application (auth required, tenancy not required)
12
- */
13
- });
14
- process.on('bootstrap-module-domain-public-route', (app, domainPublicRouter) => {
15
- /*
16
- * can add domain public routes to application (auth not required, tenancy required)
17
- */
18
- });
19
- process.on('bootstrap-module-domain-private-route', (app, domainPrivateRouter) => {
20
- /*
21
- * can add domain private routes to application (auth required, tenancy required)
22
- */
23
- });
24
- //# sourceMappingURL=routes.js.map
@@ -1 +0,0 @@
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,6 +0,0 @@
1
- export * from './quotation/quotation';
2
- export declare const entities: typeof import("./quotation/quotation").Quotation[];
3
- export declare const subscribers: typeof import("./quotation/event-subscriber").QuotationHistoryEntitySubscriber[];
4
- export declare const schema: {
5
- resolverClasses: (typeof import("./quotation/quotation-query").QuotationQuery | typeof import("./quotation/quotation-mutation").QuotationMutation)[];
6
- };
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.schema = exports.subscribers = exports.entities = void 0;
4
- const tslib_1 = require("tslib");
5
- /* EXPORT ENTITY TYPES */
6
- tslib_1.__exportStar(require("./quotation/quotation"), exports);
7
- /* IMPORT ENTITIES AND RESOLVERS */
8
- const quotation_1 = require("./quotation");
9
- exports.entities = [
10
- /* ENTITIES */
11
- ...quotation_1.entities,
12
- ];
13
- exports.subscribers = [
14
- /* SUBSCRIBERS */
15
- ...quotation_1.subscribers,
16
- ];
17
- exports.schema = {
18
- resolverClasses: [
19
- /* RESOLVER CLASSES */
20
- ...quotation_1.resolvers,
21
- ]
22
- };
23
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,yBAAyB;AACzB,gEAAqC;AAErC,mCAAmC;AACnC,2CAAiI;AAEpH,QAAA,QAAQ,GAAG;IACtB,cAAc;IACf,GAAG,oBAAiB;CACpB,CAAA;AAEY,QAAA,WAAW,GAAG;IACzB,iBAAiB;IAClB,GAAG,uBAAoB;CACvB,CAAA;AAEY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,sBAAsB;QACxB,GAAG,qBAAkB;KACpB;CACF,CAAA","sourcesContent":["/* EXPORT ENTITY TYPES */\nexport * from './quotation/quotation'\n\n/* IMPORT ENTITIES AND RESOLVERS */\nimport { entities as QuotationEntities, resolvers as QuotationResolvers, subscribers as QuotationSubscribers } from './quotation'\n\nexport const entities = [ \n /* ENTITIES */\n\t...QuotationEntities,\n] \n\nexport const subscribers = [\n /* SUBSCRIBERS */\n\t...QuotationSubscribers,\n]\n\nexport const schema = {\n resolverClasses: [\n /* RESOLVER CLASSES */\n\t\t...QuotationResolvers,\n ] \n}\n"]}
@@ -1,7 +0,0 @@
1
- import { HistoryEntitySubscriber } from '@operato/typeorm-history';
2
- import { Quotation } from './quotation';
3
- import { QuotationHistory } from './quotation-history';
4
- export declare class QuotationHistoryEntitySubscriber extends HistoryEntitySubscriber<Quotation, QuotationHistory> {
5
- get entity(): typeof Quotation;
6
- get historyEntity(): typeof QuotationHistory;
7
- }
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuotationHistoryEntitySubscriber = void 0;
4
- const tslib_1 = require("tslib");
5
- const typeorm_1 = require("typeorm");
6
- const typeorm_history_1 = require("@operato/typeorm-history");
7
- const quotation_1 = require("./quotation");
8
- const quotation_history_1 = require("./quotation-history");
9
- let QuotationHistoryEntitySubscriber = class QuotationHistoryEntitySubscriber extends typeorm_history_1.HistoryEntitySubscriber {
10
- get entity() {
11
- return quotation_1.Quotation;
12
- }
13
- get historyEntity() {
14
- return quotation_history_1.QuotationHistory;
15
- }
16
- };
17
- exports.QuotationHistoryEntitySubscriber = QuotationHistoryEntitySubscriber;
18
- exports.QuotationHistoryEntitySubscriber = QuotationHistoryEntitySubscriber = tslib_1.__decorate([
19
- (0, typeorm_1.EventSubscriber)()
20
- ], QuotationHistoryEntitySubscriber);
21
- //# sourceMappingURL=event-subscriber.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-subscriber.js","sourceRoot":"","sources":["../../../server/service/quotation/event-subscriber.ts"],"names":[],"mappings":";;;;AAAA,qCAAyC;AAEzC,8DAAkE;AAElE,2CAAuC;AACvC,2DAAsD;AAG/C,IAAM,gCAAgC,GAAtC,MAAM,gCAAiC,SAAQ,yCAAoD;IACxG,IAAW,MAAM;QACf,OAAO,qBAAS,CAAA;IAClB,CAAC;IAED,IAAW,aAAa;QACtB,OAAO,oCAAgB,CAAA;IACzB,CAAC;CACF,CAAA;AARY,4EAAgC;2CAAhC,gCAAgC;IAD5C,IAAA,yBAAe,GAAE;GACL,gCAAgC,CAQ5C","sourcesContent":["import { EventSubscriber } from 'typeorm'\n\nimport { HistoryEntitySubscriber } from '@operato/typeorm-history'\n\nimport { Quotation } from './quotation'\nimport { QuotationHistory } from './quotation-history'\n\n@EventSubscriber()\nexport class QuotationHistoryEntitySubscriber extends HistoryEntitySubscriber<Quotation, QuotationHistory> {\n public get entity() {\n return Quotation\n }\n\n public get historyEntity() {\n return QuotationHistory\n }\n}\n"]}
@@ -1,7 +0,0 @@
1
- import { Quotation } from './quotation';
2
- import { QuotationQuery } from './quotation-query';
3
- import { QuotationMutation } from './quotation-mutation';
4
- import { QuotationHistoryEntitySubscriber } from './event-subscriber';
5
- export declare const entities: (typeof Quotation)[];
6
- export declare const resolvers: (typeof QuotationQuery | typeof QuotationMutation)[];
7
- export declare const subscribers: (typeof QuotationHistoryEntitySubscriber)[];
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.subscribers = exports.resolvers = exports.entities = void 0;
4
- const quotation_1 = require("./quotation");
5
- const quotation_history_1 = require("./quotation-history");
6
- const quotation_query_1 = require("./quotation-query");
7
- const quotation_mutation_1 = require("./quotation-mutation");
8
- const event_subscriber_1 = require("./event-subscriber");
9
- exports.entities = [quotation_1.Quotation, quotation_history_1.QuotationHistory];
10
- exports.resolvers = [quotation_query_1.QuotationQuery, quotation_mutation_1.QuotationMutation];
11
- exports.subscribers = [event_subscriber_1.QuotationHistoryEntitySubscriber];
12
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/quotation/index.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AACvC,2DAAsD;AACtD,uDAAkD;AAClD,6DAAwD;AACxD,yDAAqE;AAExD,QAAA,QAAQ,GAAG,CAAC,qBAAS,EAAE,oCAAgB,CAAC,CAAA;AACxC,QAAA,SAAS,GAAG,CAAC,gCAAc,EAAE,sCAAiB,CAAC,CAAA;AAC/C,QAAA,WAAW,GAAG,CAAC,mDAAgC,CAAC,CAAA","sourcesContent":["import { Quotation } from './quotation'\nimport { QuotationHistory } from './quotation-history'\nimport { QuotationQuery } from './quotation-query'\nimport { QuotationMutation } from './quotation-mutation'\nimport { QuotationHistoryEntitySubscriber } from './event-subscriber'\n\nexport const entities = [Quotation, QuotationHistory]\nexport const resolvers = [QuotationQuery, QuotationMutation]\nexport const subscribers = [QuotationHistoryEntitySubscriber]\n"]}
@@ -1,25 +0,0 @@
1
- import { HistoryActionType, HistoryEntityInterface } from '@operato/typeorm-history';
2
- import { User } from '@things-factory/auth-base';
3
- import { Domain } from '@things-factory/shell';
4
- import { Quotation, QuotationStatus } from './quotation';
5
- export declare class QuotationHistory implements HistoryEntityInterface<Quotation> {
6
- readonly id: string;
7
- version?: number;
8
- domain?: Domain;
9
- domainId?: string;
10
- name: string;
11
- description?: string;
12
- active?: boolean;
13
- state?: QuotationStatus;
14
- params?: string;
15
- createdAt?: Date;
16
- updatedAt?: Date;
17
- deletedAt?: Date;
18
- creator?: User;
19
- creatorId?: string;
20
- updater?: User;
21
- updaterId?: string;
22
- thumbnail?: string;
23
- originalId: string;
24
- action: HistoryActionType;
25
- }
@@ -1,132 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuotationHistory = void 0;
4
- const tslib_1 = require("tslib");
5
- const type_graphql_1 = require("type-graphql");
6
- const typeorm_1 = require("typeorm");
7
- const typeorm_history_1 = require("@operato/typeorm-history");
8
- const auth_base_1 = require("@things-factory/auth-base");
9
- const env_1 = require("@things-factory/env");
10
- const shell_1 = require("@things-factory/shell");
11
- const quotation_1 = require("./quotation");
12
- const ORMCONFIG = env_1.config.get('ormconfig', {});
13
- const DATABASE_TYPE = ORMCONFIG.type;
14
- let QuotationHistory = class QuotationHistory {
15
- constructor() {
16
- this.version = 1;
17
- }
18
- };
19
- exports.QuotationHistory = QuotationHistory;
20
- tslib_1.__decorate([
21
- (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
22
- (0, type_graphql_1.Field)(type => type_graphql_1.ID),
23
- tslib_1.__metadata("design:type", String)
24
- ], QuotationHistory.prototype, "id", void 0);
25
- tslib_1.__decorate([
26
- (0, typeorm_1.Column)({ nullable: true, default: 1 }),
27
- (0, type_graphql_1.Field)({ nullable: true }),
28
- tslib_1.__metadata("design:type", Number)
29
- ], QuotationHistory.prototype, "version", void 0);
30
- tslib_1.__decorate([
31
- (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
32
- (0, type_graphql_1.Field)(type => shell_1.Domain),
33
- tslib_1.__metadata("design:type", shell_1.Domain)
34
- ], QuotationHistory.prototype, "domain", void 0);
35
- tslib_1.__decorate([
36
- (0, typeorm_1.RelationId)((quotation) => quotation.domain),
37
- tslib_1.__metadata("design:type", String)
38
- ], QuotationHistory.prototype, "domainId", void 0);
39
- tslib_1.__decorate([
40
- (0, typeorm_1.Column)(),
41
- (0, type_graphql_1.Field)(),
42
- tslib_1.__metadata("design:type", String)
43
- ], QuotationHistory.prototype, "name", void 0);
44
- tslib_1.__decorate([
45
- (0, typeorm_1.Column)({ nullable: true }),
46
- (0, type_graphql_1.Field)({ nullable: true }),
47
- tslib_1.__metadata("design:type", String)
48
- ], QuotationHistory.prototype, "description", void 0);
49
- tslib_1.__decorate([
50
- (0, typeorm_1.Column)({ nullable: true }),
51
- (0, type_graphql_1.Field)({ nullable: true }),
52
- tslib_1.__metadata("design:type", Boolean)
53
- ], QuotationHistory.prototype, "active", void 0);
54
- tslib_1.__decorate([
55
- (0, typeorm_1.Column)({ nullable: true }),
56
- (0, type_graphql_1.Field)({ nullable: true }),
57
- tslib_1.__metadata("design:type", String)
58
- ], QuotationHistory.prototype, "state", void 0);
59
- tslib_1.__decorate([
60
- (0, typeorm_1.Column)({ nullable: true }),
61
- (0, type_graphql_1.Field)({ nullable: true }),
62
- tslib_1.__metadata("design:type", String)
63
- ], QuotationHistory.prototype, "params", void 0);
64
- tslib_1.__decorate([
65
- (0, typeorm_1.Column)({ nullable: true }),
66
- (0, type_graphql_1.Field)({ nullable: true }),
67
- tslib_1.__metadata("design:type", Date)
68
- ], QuotationHistory.prototype, "createdAt", void 0);
69
- tslib_1.__decorate([
70
- (0, typeorm_1.Column)({ nullable: true }),
71
- (0, type_graphql_1.Field)({ nullable: true }),
72
- tslib_1.__metadata("design:type", Date)
73
- ], QuotationHistory.prototype, "updatedAt", void 0);
74
- tslib_1.__decorate([
75
- (0, typeorm_1.Column)({ nullable: true }),
76
- (0, type_graphql_1.Field)({ nullable: true }),
77
- tslib_1.__metadata("design:type", Date)
78
- ], QuotationHistory.prototype, "deletedAt", void 0);
79
- tslib_1.__decorate([
80
- (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
81
- (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
82
- tslib_1.__metadata("design:type", auth_base_1.User)
83
- ], QuotationHistory.prototype, "creator", void 0);
84
- tslib_1.__decorate([
85
- (0, typeorm_1.RelationId)((quotation) => quotation.creator),
86
- tslib_1.__metadata("design:type", String)
87
- ], QuotationHistory.prototype, "creatorId", void 0);
88
- tslib_1.__decorate([
89
- (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
90
- (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
91
- tslib_1.__metadata("design:type", auth_base_1.User)
92
- ], QuotationHistory.prototype, "updater", void 0);
93
- tslib_1.__decorate([
94
- (0, typeorm_1.RelationId)((quotation) => quotation.updater),
95
- tslib_1.__metadata("design:type", String)
96
- ], QuotationHistory.prototype, "updaterId", void 0);
97
- tslib_1.__decorate([
98
- (0, type_graphql_1.Field)(type => String, { nullable: true }),
99
- tslib_1.__metadata("design:type", String)
100
- ], QuotationHistory.prototype, "thumbnail", void 0);
101
- tslib_1.__decorate([
102
- (0, typeorm_history_1.HistoryOriginalIdColumn)(),
103
- tslib_1.__metadata("design:type", String)
104
- ], QuotationHistory.prototype, "originalId", void 0);
105
- tslib_1.__decorate([
106
- (0, typeorm_history_1.HistoryActionColumn)({
107
- nullable: false,
108
- type: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
109
- ? 'enum'
110
- : DATABASE_TYPE == 'oracle'
111
- ? 'varchar2'
112
- : DATABASE_TYPE == 'mssql'
113
- ? 'nvarchar'
114
- : 'varchar',
115
- enum: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
116
- ? typeorm_history_1.HistoryActionType
117
- : undefined,
118
- length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined : 10
119
- }),
120
- tslib_1.__metadata("design:type", String)
121
- ], QuotationHistory.prototype, "action", void 0);
122
- exports.QuotationHistory = QuotationHistory = tslib_1.__decorate([
123
- (0, typeorm_1.Entity)(),
124
- (0, typeorm_1.Index)('ix_quotation_history_0', (quotationHistory) => [quotationHistory.originalId, quotationHistory.version], { unique: true }),
125
- (0, typeorm_1.Index)('ix_quotation_history_1', (quotationHistory) => [
126
- quotationHistory.domain,
127
- quotationHistory.originalId,
128
- quotationHistory.version
129
- ], { unique: true }),
130
- (0, type_graphql_1.ObjectType)({ description: 'History Entity of Quotation' })
131
- ], QuotationHistory);
132
- //# sourceMappingURL=quotation-history.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"quotation-history.js","sourceRoot":"","sources":["../../../server/service/quotation/quotation-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAA8F;AAE9F,8DAKiC;AACjC,yDAAsD;AACtD,6CAA4C;AAC5C,iDAA8C;AAE9C,2CAAwD;AAExD,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAkB7B,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAAtB;QAOL,YAAO,GAAY,CAAC,CAAA;IA8EtB,CAAC;CAAA,CAAA;AArFY,4CAAgB;AAGlB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;4CACC;AAInB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACtC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACN;AAIpB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cA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AAS;YACnF,CAAC,CAAC,mCAAiB;YACnB,CAAC,CAAC,SAAS;QACf,MAAM,EAAE,aAAa,IAAI,UAAU,IAAI,aAAa,IAAI,OAAO,IAAI,aAAa,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;KAC/G,CAAC;;gDAC+B;2BApFtB,gBAAgB;IAhB5B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,wBAAwB,EACxB,CAAC,gBAAkC,EAAE,EAAE,CAAC,CAAC,gBAAgB,CAAC,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAC/F,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,eAAK,EACJ,wBAAwB,EACxB,CAAC,gBAAkC,EAAE,EAAE,CAAC;QACtC,gBAAgB,CAAC,MAAM;QACvB,gBAAgB,CAAC,UAAU;QAC3B,gBAAgB,CAAC,OAAO;KACzB,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;GAC9C,gBAAgB,CAqF5B","sourcesContent":["import { Field, ID, ObjectType } from 'type-graphql'\nimport { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'\n\nimport {\n HistoryActionColumn,\n HistoryActionType,\n HistoryEntityInterface,\n HistoryOriginalIdColumn\n} from '@operato/typeorm-history'\nimport { Role, User } from '@things-factory/auth-base'\nimport { config } from '@things-factory/env'\nimport { Domain } from '@things-factory/shell'\n\nimport { Quotation, QuotationStatus } from './quotation'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\n@Entity()\n@Index(\n 'ix_quotation_history_0',\n (quotationHistory: QuotationHistory) => [quotationHistory.originalId, quotationHistory.version],\n { unique: true }\n)\n@Index(\n 'ix_quotation_history_1',\n (quotationHistory: QuotationHistory) => [\n quotationHistory.domain,\n quotationHistory.originalId,\n quotationHistory.version\n ],\n { unique: true }\n)\n@ObjectType({ description: 'History Entity of Quotation' })\nexport class QuotationHistory implements HistoryEntityInterface<Quotation> {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Column({ nullable: true, default: 1 })\n @Field({ nullable: true })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field(type => Domain)\n domain?: Domain\n\n @RelationId((quotation: Quotation) => quotation.domain)\n domainId?: string\n\n @Column()\n @Field()\n name: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n active?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n state?: QuotationStatus\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n params?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n createdAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n updatedAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((quotation: Quotation) => quotation.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((quotation: Quotation) => quotation.updater)\n updaterId?: string\n\n @Field(type => String, { nullable: true })\n thumbnail?: string\n\n @HistoryOriginalIdColumn()\n public originalId!: string\n\n @HistoryActionColumn({\n nullable: false,\n type:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'enum'\n : DATABASE_TYPE == 'oracle'\n ? 'varchar2'\n : DATABASE_TYPE == 'mssql'\n ? 'nvarchar'\n : 'varchar',\n enum:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? HistoryActionType\n : undefined,\n length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined : 10\n })\n public action!: HistoryActionType\n}\n"]}
@@ -1,10 +0,0 @@
1
- import { Quotation } from './quotation';
2
- import { NewQuotation, QuotationPatch } from './quotation-type';
3
- export declare class QuotationMutation {
4
- createQuotation(quotation: NewQuotation, context: ResolverContext): Promise<Quotation>;
5
- updateQuotation(id: string, patch: QuotationPatch, context: ResolverContext): Promise<Quotation>;
6
- updateMultipleQuotation(patches: QuotationPatch[], context: ResolverContext): Promise<Quotation[]>;
7
- deleteQuotation(id: string, context: ResolverContext): Promise<boolean>;
8
- deleteQuotations(ids: string[], context: ResolverContext): Promise<boolean>;
9
- importQuotations(quotations: QuotationPatch[], context: ResolverContext): Promise<boolean>;
10
- }
@@ -1,168 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuotationMutation = void 0;
4
- const tslib_1 = require("tslib");
5
- const type_graphql_1 = require("type-graphql");
6
- const typeorm_1 = require("typeorm");
7
- const attachment_base_1 = require("@things-factory/attachment-base");
8
- const quotation_1 = require("./quotation");
9
- const quotation_type_1 = require("./quotation-type");
10
- let QuotationMutation = class QuotationMutation {
11
- async createQuotation(quotation, context) {
12
- const { domain, user, tx } = context.state;
13
- const result = await tx.getRepository(quotation_1.Quotation).save(Object.assign(Object.assign({}, quotation), { domain, creator: user, updater: user }));
14
- if (quotation.thumbnail) {
15
- await (0, attachment_base_1.createAttachment)(null, {
16
- attachment: {
17
- file: quotation.thumbnail,
18
- refType: quotation_1.Quotation.name,
19
- refBy: result.id
20
- }
21
- }, context);
22
- }
23
- return result;
24
- }
25
- async updateQuotation(id, patch, context) {
26
- const { domain, user, tx } = context.state;
27
- const repository = tx.getRepository(quotation_1.Quotation);
28
- const quotation = await repository.findOne({
29
- where: { domain: { id: domain.id }, id }
30
- });
31
- const result = await repository.save(Object.assign(Object.assign(Object.assign({}, quotation), patch), { updater: user }));
32
- if (patch.thumbnail) {
33
- await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [result.id] }, context);
34
- await (0, attachment_base_1.createAttachment)(null, {
35
- attachment: {
36
- file: patch.thumbnail,
37
- refType: quotation_1.Quotation.name,
38
- refBy: result.id
39
- }
40
- }, context);
41
- }
42
- return result;
43
- }
44
- async updateMultipleQuotation(patches, context) {
45
- const { domain, user, tx } = context.state;
46
- let results = [];
47
- const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
48
- const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
49
- const quotationRepo = tx.getRepository(quotation_1.Quotation);
50
- if (_createRecords.length > 0) {
51
- for (let i = 0; i < _createRecords.length; i++) {
52
- const newRecord = _createRecords[i];
53
- const result = await quotationRepo.save(Object.assign(Object.assign({}, newRecord), { domain, creator: user, updater: user }));
54
- if (newRecord.thumbnail) {
55
- await (0, attachment_base_1.createAttachment)(null, {
56
- attachment: {
57
- file: newRecord.thumbnail,
58
- refType: quotation_1.Quotation.name,
59
- refBy: result.id
60
- }
61
- }, context);
62
- }
63
- results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
64
- }
65
- }
66
- if (_updateRecords.length > 0) {
67
- for (let i = 0; i < _updateRecords.length; i++) {
68
- const updateRecord = _updateRecords[i];
69
- const quotation = await quotationRepo.findOneBy({ id: updateRecord.id });
70
- const result = await quotationRepo.save(Object.assign(Object.assign(Object.assign({}, quotation), updateRecord), { updater: user }));
71
- if (updateRecord.thumbnail) {
72
- await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [result.id] }, context);
73
- await (0, attachment_base_1.createAttachment)(null, {
74
- attachment: {
75
- file: updateRecord.thumbnail,
76
- refType: quotation_1.Quotation.name,
77
- refBy: result.id
78
- }
79
- }, context);
80
- }
81
- results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
82
- }
83
- }
84
- return results;
85
- }
86
- async deleteQuotation(id, context) {
87
- const { domain, tx } = context.state;
88
- await tx.getRepository(quotation_1.Quotation).delete({ domain: { id: domain.id }, id });
89
- await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [id] }, context);
90
- return true;
91
- }
92
- async deleteQuotations(ids, context) {
93
- const { domain, tx } = context.state;
94
- await tx.getRepository(quotation_1.Quotation).delete({
95
- domain: { id: domain.id },
96
- id: (0, typeorm_1.In)(ids)
97
- });
98
- await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: ids }, context);
99
- return true;
100
- }
101
- async importQuotations(quotations, context) {
102
- const { domain, tx } = context.state;
103
- await Promise.all(quotations.map(async (quotation) => {
104
- const createdQuotation = await tx.getRepository(quotation_1.Quotation).save(Object.assign({ domain }, quotation));
105
- }));
106
- return true;
107
- }
108
- };
109
- exports.QuotationMutation = QuotationMutation;
110
- tslib_1.__decorate([
111
- (0, type_graphql_1.Directive)('@transaction'),
112
- (0, type_graphql_1.Mutation)(returns => quotation_1.Quotation, { description: 'To create new Quotation' }),
113
- tslib_1.__param(0, (0, type_graphql_1.Arg)('quotation')),
114
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
115
- tslib_1.__metadata("design:type", Function),
116
- tslib_1.__metadata("design:paramtypes", [quotation_type_1.NewQuotation, Object]),
117
- tslib_1.__metadata("design:returntype", Promise)
118
- ], QuotationMutation.prototype, "createQuotation", null);
119
- tslib_1.__decorate([
120
- (0, type_graphql_1.Directive)('@transaction'),
121
- (0, type_graphql_1.Mutation)(returns => quotation_1.Quotation, { description: 'To modify Quotation information' }),
122
- tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
123
- tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
124
- tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
125
- tslib_1.__metadata("design:type", Function),
126
- tslib_1.__metadata("design:paramtypes", [String, quotation_type_1.QuotationPatch, Object]),
127
- tslib_1.__metadata("design:returntype", Promise)
128
- ], QuotationMutation.prototype, "updateQuotation", null);
129
- tslib_1.__decorate([
130
- (0, type_graphql_1.Directive)('@transaction'),
131
- (0, type_graphql_1.Mutation)(returns => [quotation_1.Quotation], { description: "To modify multiple Quotations' information" }),
132
- tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [quotation_type_1.QuotationPatch])),
133
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
134
- tslib_1.__metadata("design:type", Function),
135
- tslib_1.__metadata("design:paramtypes", [Array, Object]),
136
- tslib_1.__metadata("design:returntype", Promise)
137
- ], QuotationMutation.prototype, "updateMultipleQuotation", null);
138
- tslib_1.__decorate([
139
- (0, type_graphql_1.Directive)('@transaction'),
140
- (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete Quotation' }),
141
- tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
142
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
143
- tslib_1.__metadata("design:type", Function),
144
- tslib_1.__metadata("design:paramtypes", [String, Object]),
145
- tslib_1.__metadata("design:returntype", Promise)
146
- ], QuotationMutation.prototype, "deleteQuotation", null);
147
- tslib_1.__decorate([
148
- (0, type_graphql_1.Directive)('@transaction'),
149
- (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple Quotations' }),
150
- tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
151
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
152
- tslib_1.__metadata("design:type", Function),
153
- tslib_1.__metadata("design:paramtypes", [Array, Object]),
154
- tslib_1.__metadata("design:returntype", Promise)
155
- ], QuotationMutation.prototype, "deleteQuotations", null);
156
- tslib_1.__decorate([
157
- (0, type_graphql_1.Directive)('@transaction'),
158
- (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple Quotations' }),
159
- tslib_1.__param(0, (0, type_graphql_1.Arg)('quotations', type => [quotation_type_1.QuotationPatch])),
160
- tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
161
- tslib_1.__metadata("design:type", Function),
162
- tslib_1.__metadata("design:paramtypes", [Array, Object]),
163
- tslib_1.__metadata("design:returntype", Promise)
164
- ], QuotationMutation.prototype, "importQuotations", null);
165
- exports.QuotationMutation = QuotationMutation = tslib_1.__decorate([
166
- (0, type_graphql_1.Resolver)(quotation_1.Quotation)
167
- ], QuotationMutation);
168
- //# sourceMappingURL=quotation-mutation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"quotation-mutation.js","sourceRoot":"","sources":["../../../server/service/quotation/quotation-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,qEAA0F;AAE1F,2CAAuC;AACvC,qDAA+D;AAGxD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAGtB,AAAN,KAAK,CAAC,eAAe,CAAmB,SAAuB,EAAS,OAAwB;QAC9F,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,qBAAS,CAAC,CAAC,IAAI,iCAChD,SAAS,KACZ,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,IAAI,SAAS,CAAC,SAAS,EAAE,CAAC;YACxB,MAAM,IAAA,kCAAgB,EACpB,IAAI,EACJ;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,SAAS,CAAC,SAAS;oBACzB,OAAO,EAAE,qBAAS,CAAC,IAAI;oBACvB,KAAK,EAAE,MAAM,CAAC,EAAE;iBACjB;aACF,EACD,OAAO,CACR,CAAA;QACH,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;IAIK,AAAN,KAAK,CAAC,eAAe,CACR,EAAU,EACP,KAAqB,EAC5B,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,qBAAS,CAAC,CAAA;QAC9C,MAAM,SAAS,GAAG,M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AA,IAAA,kBAAG,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,+BAAc,CAAC,CAAC,CAAA;IACxC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;gEAqEP;AAIK;IAFL,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;AAIK;IAFL,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;AAIK;IAFL,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,YAAY,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,+BAAc,CAAC,CAAC,CAAA;IAC3C,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;yDAWP;4BA3LU,iBAAiB;IAD7B,IAAA,uBAAQ,EAAC,qBAAS,CAAC;GACP,iBAAiB,CA4L7B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'\n\nimport { Quotation } from './quotation'\nimport { NewQuotation, QuotationPatch } from './quotation-type'\n\n@Resolver(Quotation)\nexport class QuotationMutation {\n @Directive('@transaction')\n @Mutation(returns => Quotation, { description: 'To create new Quotation' })\n async createQuotation(@Arg('quotation') quotation: NewQuotation, @Ctx() context: ResolverContext): Promise<Quotation> {\n const { domain, user, tx } = context.state\n\n const result = await tx.getRepository(Quotation).save({\n ...quotation,\n domain,\n creator: user,\n updater: user\n })\n\n if (quotation.thumbnail) {\n await createAttachment(\n null,\n {\n attachment: {\n file: quotation.thumbnail,\n refType: Quotation.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => Quotation, { description: 'To modify Quotation information' })\n async updateQuotation(\n @Arg('id') id: string,\n @Arg('patch') patch: QuotationPatch,\n @Ctx() context: ResolverContext\n ): Promise<Quotation> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(Quotation)\n const quotation = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...quotation,\n ...patch,\n updater: user\n })\n\n if (patch.thumbnail) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: patch.thumbnail,\n refType: Quotation.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [Quotation], { description: \"To modify multiple Quotations' information\" })\n async updateMultipleQuotation(\n @Arg('patches', type => [QuotationPatch]) patches: QuotationPatch[],\n @Ctx() context: ResolverContext\n ): Promise<Quotation[]> {\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 quotationRepo = tx.getRepository(Quotation)\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 quotationRepo.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: Quotation.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 updateRecord = _updateRecords[i]\n const quotation = await quotationRepo.findOneBy({ id: updateRecord.id })\n\n const result = await quotationRepo.save({\n ...quotation,\n ...updateRecord,\n updater: user\n })\n\n if (updateRecord.thumbnail) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: updateRecord.thumbnail,\n refType: Quotation.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 Quotation' })\n async deleteQuotation(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Quotation).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 Quotations' })\n async deleteQuotations(\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(Quotation).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 @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple Quotations' })\n async importQuotations(\n @Arg('quotations', type => [QuotationPatch]) quotations: QuotationPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n quotations.map(async (quotation: QuotationPatch) => {\n const createdQuotation: Quotation = await tx.getRepository(Quotation).save({ domain, ...quotation })\n })\n )\n\n return true\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- import { Domain, ListParam } from '@things-factory/shell';
2
- import { User } from '@things-factory/auth-base';
3
- import { Quotation } from './quotation';
4
- import { QuotationList } from './quotation-type';
5
- export declare class QuotationQuery {
6
- quotation(id: string, context: ResolverContext): Promise<Quotation>;
7
- quotations(params: ListParam, context: ResolverContext): Promise<QuotationList>;
8
- thumbnail(quotation: Quotation): Promise<string | undefined>;
9
- domain(quotation: Quotation): Promise<Domain>;
10
- updater(quotation: Quotation): Promise<User>;
11
- creator(quotation: Quotation): Promise<User>;
12
- }