@things-factory/sales 0.0.0-stage → 10.1.177

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 (131) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/assets/images/hatiolab-logo.png +0 -0
  3. package/dist-client/bootstrap.d.ts +1 -0
  4. package/dist-client/bootstrap.js +5 -0
  5. package/dist-client/bootstrap.js.map +1 -0
  6. package/dist-client/entity360/opportunity-360.d.ts +12 -0
  7. package/dist-client/entity360/opportunity-360.js +114 -0
  8. package/dist-client/entity360/opportunity-360.js.map +1 -0
  9. package/dist-client/index.d.ts +4 -0
  10. package/dist-client/index.js +5 -0
  11. package/dist-client/index.js.map +1 -0
  12. package/dist-client/opportunity-attach.d.ts +17 -0
  13. package/dist-client/opportunity-attach.js +8 -0
  14. package/dist-client/opportunity-attach.js.map +1 -0
  15. package/dist-client/opportunity-words.d.ts +1 -0
  16. package/dist-client/opportunity-words.js +13 -0
  17. package/dist-client/opportunity-words.js.map +1 -0
  18. package/dist-client/pages/opportunity-editor.d.ts +83 -0
  19. package/dist-client/pages/opportunity-editor.js +528 -0
  20. package/dist-client/pages/opportunity-editor.js.map +1 -0
  21. package/dist-client/pages/opportunity-list.d.ts +40 -0
  22. package/dist-client/pages/opportunity-list.js +134 -0
  23. package/dist-client/pages/opportunity-list.js.map +1 -0
  24. package/dist-client/pages/quotation-editor.d.ts +54 -0
  25. package/dist-client/pages/quotation-editor.js +359 -0
  26. package/dist-client/pages/quotation-editor.js.map +1 -0
  27. package/dist-client/pages/quotation-list.d.ts +36 -0
  28. package/dist-client/pages/quotation-list.js +113 -0
  29. package/dist-client/pages/quotation-list.js.map +1 -0
  30. package/dist-client/quotation-attach.d.ts +16 -0
  31. package/dist-client/quotation-attach.js +8 -0
  32. package/dist-client/quotation-attach.js.map +1 -0
  33. package/dist-client/quotation-words.d.ts +1 -0
  34. package/dist-client/quotation-words.js +13 -0
  35. package/dist-client/quotation-words.js.map +1 -0
  36. package/dist-client/route.d.ts +1 -0
  37. package/dist-client/route.js +17 -0
  38. package/dist-client/route.js.map +1 -0
  39. package/dist-client/tsconfig.tsbuildinfo +1 -0
  40. package/dist-server/controllers/index.d.ts +0 -0
  41. package/dist-server/controllers/index.js +1 -0
  42. package/dist-server/controllers/index.js.map +1 -0
  43. package/dist-server/index.d.ts +4 -0
  44. package/dist-server/index.js +8 -0
  45. package/dist-server/index.js.map +1 -0
  46. package/dist-server/middlewares/index.d.ts +2 -0
  47. package/dist-server/middlewares/index.js +7 -0
  48. package/dist-server/middlewares/index.js.map +1 -0
  49. package/dist-server/migrations/index.d.ts +1 -0
  50. package/dist-server/migrations/index.js +12 -0
  51. package/dist-server/migrations/index.js.map +1 -0
  52. package/dist-server/routes.d.ts +0 -0
  53. package/dist-server/routes.js +24 -0
  54. package/dist-server/routes.js.map +1 -0
  55. package/dist-server/service/index.d.ts +16 -0
  56. package/dist-server/service/index.js +21 -0
  57. package/dist-server/service/index.js.map +1 -0
  58. package/dist-server/service/opportunity/index.d.ts +8 -0
  59. package/dist-server/service/opportunity/index.js +12 -0
  60. package/dist-server/service/opportunity/index.js.map +1 -0
  61. package/dist-server/service/opportunity/opportunity-event-query.d.ts +9 -0
  62. package/dist-server/service/opportunity/opportunity-event-query.js +55 -0
  63. package/dist-server/service/opportunity/opportunity-event-query.js.map +1 -0
  64. package/dist-server/service/opportunity/opportunity-event.d.ts +27 -0
  65. package/dist-server/service/opportunity/opportunity-event.js +115 -0
  66. package/dist-server/service/opportunity/opportunity-event.js.map +1 -0
  67. package/dist-server/service/opportunity/opportunity-mutation.d.ts +7 -0
  68. package/dist-server/service/opportunity/opportunity-mutation.js +64 -0
  69. package/dist-server/service/opportunity/opportunity-mutation.js.map +1 -0
  70. package/dist-server/service/opportunity/opportunity-query.d.ts +21 -0
  71. package/dist-server/service/opportunity/opportunity-query.js +156 -0
  72. package/dist-server/service/opportunity/opportunity-query.js.map +1 -0
  73. package/dist-server/service/opportunity/opportunity-rules.d.ts +22 -0
  74. package/dist-server/service/opportunity/opportunity-rules.js +59 -0
  75. package/dist-server/service/opportunity/opportunity-rules.js.map +1 -0
  76. package/dist-server/service/opportunity/opportunity-service.d.ts +19 -0
  77. package/dist-server/service/opportunity/opportunity-service.js +107 -0
  78. package/dist-server/service/opportunity/opportunity-service.js.map +1 -0
  79. package/dist-server/service/opportunity/opportunity-type.d.ts +23 -0
  80. package/dist-server/service/opportunity/opportunity-type.js +86 -0
  81. package/dist-server/service/opportunity/opportunity-type.js.map +1 -0
  82. package/dist-server/service/opportunity/opportunity.d.ts +35 -0
  83. package/dist-server/service/opportunity/opportunity.js +147 -0
  84. package/dist-server/service/opportunity/opportunity.js.map +1 -0
  85. package/dist-server/service/quotation/index.d.ts +10 -0
  86. package/dist-server/service/quotation/index.js +14 -0
  87. package/dist-server/service/quotation/index.js.map +1 -0
  88. package/dist-server/service/quotation/quotation-event-query.d.ts +9 -0
  89. package/dist-server/service/quotation/quotation-event-query.js +55 -0
  90. package/dist-server/service/quotation/quotation-event-query.js.map +1 -0
  91. package/dist-server/service/quotation/quotation-event.d.ts +22 -0
  92. package/dist-server/service/quotation/quotation-event.js +98 -0
  93. package/dist-server/service/quotation/quotation-event.js.map +1 -0
  94. package/dist-server/service/quotation/quotation-item-query.d.ts +8 -0
  95. package/dist-server/service/quotation/quotation-item-query.js +45 -0
  96. package/dist-server/service/quotation/quotation-item-query.js.map +1 -0
  97. package/dist-server/service/quotation/quotation-item.d.ts +18 -0
  98. package/dist-server/service/quotation/quotation-item.js +75 -0
  99. package/dist-server/service/quotation/quotation-item.js.map +1 -0
  100. package/dist-server/service/quotation/quotation-mutation.d.ts +11 -0
  101. package/dist-server/service/quotation/quotation-mutation.js +117 -0
  102. package/dist-server/service/quotation/quotation-mutation.js.map +1 -0
  103. package/dist-server/service/quotation/quotation-query.d.ts +19 -0
  104. package/dist-server/service/quotation/quotation-query.js +136 -0
  105. package/dist-server/service/quotation/quotation-query.js.map +1 -0
  106. package/dist-server/service/quotation/quotation-rules.d.ts +6 -0
  107. package/dist-server/service/quotation/quotation-rules.js +22 -0
  108. package/dist-server/service/quotation/quotation-rules.js.map +1 -0
  109. package/dist-server/service/quotation/quotation-service.d.ts +25 -0
  110. package/dist-server/service/quotation/quotation-service.js +127 -0
  111. package/dist-server/service/quotation/quotation-service.js.map +1 -0
  112. package/dist-server/service/quotation/quotation-type.d.ts +10 -0
  113. package/dist-server/service/quotation/quotation-type.js +36 -0
  114. package/dist-server/service/quotation/quotation-type.js.map +1 -0
  115. package/dist-server/service/quotation/quotation.d.ts +36 -0
  116. package/dist-server/service/quotation/quotation.js +121 -0
  117. package/dist-server/service/quotation/quotation.js.map +1 -0
  118. package/dist-server/service/sales-event.d.ts +15 -0
  119. package/dist-server/service/sales-event.js +12 -0
  120. package/dist-server/service/sales-event.js.map +1 -0
  121. package/dist-server/tsconfig.tsbuildinfo +1 -0
  122. package/helps/quotation/quotation.md +160 -0
  123. package/package.json +46 -4
  124. package/things-factory.config.js +13 -0
  125. package/translations/en.json +102 -0
  126. package/translations/es.json +102 -0
  127. package/translations/ja.json +102 -0
  128. package/translations/ko.json +102 -0
  129. package/translations/ms.json +102 -0
  130. package/translations/zh.json +102 -0
  131. package/README.md +0 -3
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuotationEventQuery = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const auth_base_1 = require("@things-factory/auth-base");
6
+ const shell_1 = require("@things-factory/shell");
7
+ const type_graphql_1 = require("type-graphql");
8
+ const quotation_event_1 = require("./quotation-event");
9
+ let QuotationEventQuery = class QuotationEventQuery {
10
+ actor(row) {
11
+ return row.actor ?? (row.actorId ? (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: row.actorId }) : undefined);
12
+ }
13
+ domain(row) {
14
+ return row.domain ?? (row.domainId ? (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: row.domainId }) : undefined);
15
+ }
16
+ creator(row) {
17
+ return row.creator ?? (row.creatorId ? (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: row.creatorId }) : undefined);
18
+ }
19
+ updater(row) {
20
+ return row.updater ?? (row.updaterId ? (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: row.updaterId }) : undefined);
21
+ }
22
+ };
23
+ exports.QuotationEventQuery = QuotationEventQuery;
24
+ tslib_1.__decorate([
25
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User, { nullable: true }),
26
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
27
+ tslib_1.__metadata("design:type", Function),
28
+ tslib_1.__metadata("design:paramtypes", [quotation_event_1.QuotationEvent]),
29
+ tslib_1.__metadata("design:returntype", void 0)
30
+ ], QuotationEventQuery.prototype, "actor", null);
31
+ tslib_1.__decorate([
32
+ (0, type_graphql_1.FieldResolver)(type => shell_1.Domain, { nullable: true }),
33
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
34
+ tslib_1.__metadata("design:type", Function),
35
+ tslib_1.__metadata("design:paramtypes", [quotation_event_1.QuotationEvent]),
36
+ tslib_1.__metadata("design:returntype", void 0)
37
+ ], QuotationEventQuery.prototype, "domain", null);
38
+ tslib_1.__decorate([
39
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User, { nullable: true }),
40
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
41
+ tslib_1.__metadata("design:type", Function),
42
+ tslib_1.__metadata("design:paramtypes", [quotation_event_1.QuotationEvent]),
43
+ tslib_1.__metadata("design:returntype", void 0)
44
+ ], QuotationEventQuery.prototype, "creator", null);
45
+ tslib_1.__decorate([
46
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User, { nullable: true }),
47
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
48
+ tslib_1.__metadata("design:type", Function),
49
+ tslib_1.__metadata("design:paramtypes", [quotation_event_1.QuotationEvent]),
50
+ tslib_1.__metadata("design:returntype", void 0)
51
+ ], QuotationEventQuery.prototype, "updater", null);
52
+ exports.QuotationEventQuery = QuotationEventQuery = tslib_1.__decorate([
53
+ (0, type_graphql_1.Resolver)(quotation_event_1.QuotationEvent)
54
+ ], QuotationEventQuery);
55
+ //# sourceMappingURL=quotation-event-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quotation-event-query.js","sourceRoot":"","sources":["../../../server/service/quotation/quotation-event-query.ts"],"names":[],"mappings":";;;;AAAA,yDAAgD;AAChD,iDAA6D;AAC7D,+CAA4D;AAE5D,uDAAkD;AAG3C,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAE9B,KAAK,CAAS,GAAmB;QAC/B,OAAO,GAAG,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAA,qBAAa,EAAC,gBAAI,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;IACpG,CAAC;IAED,MAAM,CAAS,GAAmB;QAChC,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAA,qBAAa,EAAC,cAAM,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;IACzG,CAAC;IAGD,OAAO,CAAS,GAAmB;QACjC,OAAO,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,qBAAa,EAAC,gBAAI,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;IAC1G,CAAC;IAGD,OAAO,CAAS,GAAmB;QACjC,OAAO,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,qBAAa,EAAC,gBAAI,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;IAC1G,CAAC;CACF,CAAA;AAnBY,kDAAmB;AAE9B;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACzC,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAM,gCAAc;;gDAEhC;AAED;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1C,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAM,gCAAc;;iDAEjC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvC,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAM,gCAAc;;kDAElC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvC,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAM,gCAAc;;kDAElC;8BAlBU,mBAAmB;IAD/B,IAAA,uBAAQ,EAAC,gCAAc,CAAC;GACZ,mBAAmB,CAmB/B","sourcesContent":["import { User } from '@things-factory/auth-base'\nimport { Domain, getRepository } from '@things-factory/shell'\nimport { FieldResolver, Resolver, Root } from 'type-graphql'\n\nimport { QuotationEvent } from './quotation-event'\n\n@Resolver(QuotationEvent)\nexport class QuotationEventQuery {\n @FieldResolver(type => User, { nullable: true })\n actor(@Root() row: QuotationEvent) {\n return row.actor ?? (row.actorId ? getRepository(User).findOneBy({ id: row.actorId }) : undefined)\n }\n @FieldResolver(type => Domain, { nullable: true })\n domain(@Root() row: QuotationEvent) {\n return row.domain ?? (row.domainId ? getRepository(Domain).findOneBy({ id: row.domainId }) : undefined)\n }\n\n @FieldResolver(type => User, { nullable: true })\n creator(@Root() row: QuotationEvent) {\n return row.creator ?? (row.creatorId ? getRepository(User).findOneBy({ id: row.creatorId }) : undefined)\n }\n\n @FieldResolver(type => User, { nullable: true })\n updater(@Root() row: QuotationEvent) {\n return row.updater ?? (row.updaterId ? getRepository(User).findOneBy({ id: row.updaterId }) : undefined)\n }\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import { User } from '@things-factory/auth-base';
2
+ import { Domain } from '@things-factory/shell';
3
+ import { Quotation } from './quotation';
4
+ export declare class QuotationEvent {
5
+ readonly id: string;
6
+ domain?: Domain;
7
+ domainId?: string;
8
+ quotation: Quotation;
9
+ quotationId: string;
10
+ action: string;
11
+ reason?: string;
12
+ snapshot: any;
13
+ actor?: User;
14
+ actorId?: string;
15
+ createdAt?: Date;
16
+ updatedAt?: Date;
17
+ deletedAt?: Date;
18
+ creator?: User;
19
+ creatorId?: string;
20
+ updater?: User;
21
+ updaterId?: string;
22
+ }
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuotationEvent = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const auth_base_1 = require("@things-factory/auth-base");
6
+ const shell_1 = require("@things-factory/shell");
7
+ const type_graphql_1 = require("type-graphql");
8
+ const typeorm_1 = require("typeorm");
9
+ const quotation_1 = require("./quotation");
10
+ let QuotationEvent = class QuotationEvent {
11
+ };
12
+ exports.QuotationEvent = QuotationEvent;
13
+ tslib_1.__decorate([
14
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
15
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID),
16
+ tslib_1.__metadata("design:type", String)
17
+ ], QuotationEvent.prototype, "id", void 0);
18
+ tslib_1.__decorate([
19
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
20
+ (0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true }),
21
+ tslib_1.__metadata("design:type", shell_1.Domain)
22
+ ], QuotationEvent.prototype, "domain", void 0);
23
+ tslib_1.__decorate([
24
+ (0, typeorm_1.RelationId)((event) => event.domain),
25
+ tslib_1.__metadata("design:type", String)
26
+ ], QuotationEvent.prototype, "domainId", void 0);
27
+ tslib_1.__decorate([
28
+ (0, typeorm_1.ManyToOne)(type => quotation_1.Quotation, { nullable: false }),
29
+ tslib_1.__metadata("design:type", quotation_1.Quotation)
30
+ ], QuotationEvent.prototype, "quotation", void 0);
31
+ tslib_1.__decorate([
32
+ (0, typeorm_1.RelationId)((event) => event.quotation),
33
+ (0, type_graphql_1.Field)({ description: 'The quotation the event happened to' }),
34
+ tslib_1.__metadata("design:type", String)
35
+ ], QuotationEvent.prototype, "quotationId", void 0);
36
+ tslib_1.__decorate([
37
+ (0, typeorm_1.Column)(),
38
+ (0, type_graphql_1.Field)({ description: 'What happened: CREATED, UPDATED, SENT, ACCEPTED, REJECTED, EXPIRED, REVISED or SUPERSEDED' }),
39
+ tslib_1.__metadata("design:type", String)
40
+ ], QuotationEvent.prototype, "action", void 0);
41
+ tslib_1.__decorate([
42
+ (0, typeorm_1.Column)({ nullable: true }),
43
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Why, when the buyer declined' }),
44
+ tslib_1.__metadata("design:type", String)
45
+ ], QuotationEvent.prototype, "reason", void 0);
46
+ tslib_1.__decorate([
47
+ (0, typeorm_1.Column)({ type: 'simple-json' }),
48
+ (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { description: 'The quotation as it stood after the action' }),
49
+ tslib_1.__metadata("design:type", Object)
50
+ ], QuotationEvent.prototype, "snapshot", void 0);
51
+ tslib_1.__decorate([
52
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
53
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
54
+ tslib_1.__metadata("design:type", auth_base_1.User)
55
+ ], QuotationEvent.prototype, "actor", void 0);
56
+ tslib_1.__decorate([
57
+ (0, typeorm_1.RelationId)((event) => event.actor),
58
+ tslib_1.__metadata("design:type", String)
59
+ ], QuotationEvent.prototype, "actorId", void 0);
60
+ tslib_1.__decorate([
61
+ (0, typeorm_1.CreateDateColumn)(),
62
+ (0, type_graphql_1.Field)({ nullable: true, description: 'When it happened' }),
63
+ tslib_1.__metadata("design:type", Date)
64
+ ], QuotationEvent.prototype, "createdAt", void 0);
65
+ tslib_1.__decorate([
66
+ (0, typeorm_1.UpdateDateColumn)(),
67
+ (0, type_graphql_1.Field)({ nullable: true, description: 'When the row last changed' }),
68
+ tslib_1.__metadata("design:type", Date)
69
+ ], QuotationEvent.prototype, "updatedAt", void 0);
70
+ tslib_1.__decorate([
71
+ (0, typeorm_1.DeleteDateColumn)(),
72
+ (0, type_graphql_1.Field)({ nullable: true, description: 'When the row was deleted' }),
73
+ tslib_1.__metadata("design:type", Date)
74
+ ], QuotationEvent.prototype, "deletedAt", void 0);
75
+ tslib_1.__decorate([
76
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
77
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
78
+ tslib_1.__metadata("design:type", auth_base_1.User)
79
+ ], QuotationEvent.prototype, "creator", void 0);
80
+ tslib_1.__decorate([
81
+ (0, typeorm_1.RelationId)((event) => event.creator),
82
+ tslib_1.__metadata("design:type", String)
83
+ ], QuotationEvent.prototype, "creatorId", void 0);
84
+ tslib_1.__decorate([
85
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
86
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
87
+ tslib_1.__metadata("design:type", auth_base_1.User)
88
+ ], QuotationEvent.prototype, "updater", void 0);
89
+ tslib_1.__decorate([
90
+ (0, typeorm_1.RelationId)((event) => event.updater),
91
+ tslib_1.__metadata("design:type", String)
92
+ ], QuotationEvent.prototype, "updaterId", void 0);
93
+ exports.QuotationEvent = QuotationEvent = tslib_1.__decorate([
94
+ (0, typeorm_1.Entity)(),
95
+ (0, typeorm_1.Index)('ix_quotation_event_0', (event) => [event.quotation, event.createdAt]),
96
+ (0, type_graphql_1.ObjectType)({ description: 'Entity for QuotationEvent — what happened to a quotation, with the document as it then stood' })
97
+ ], QuotationEvent);
98
+ //# sourceMappingURL=quotation-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quotation-event.js","sourceRoot":"","sources":["../../../server/service/quotation/quotation-event.ts"],"names":[],"mappings":";;;;AAAA,yDAAgD;AAChD,iDAA4D;AAC5D,+CAAoD;AACpD,qCAAoJ;AAEpJ,2CAAuC;AAKhC,IAAM,cAAc,GAApB,MAAM,cAAc;CA+D1B,CAAA;AA/DY,wCAAc;AAGhB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;0CACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACjC,cAAM;8CAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,KAAqB,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;;gDACnC;AAGjB;IADC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,qBAAS,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;sCACvC,qBAAS;iDAAA;AAIpB;IAFC,IAAA,oBAAU,EAAC,CAAC,KAAqB,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC;IACtD,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,qCAAqC,EAAE,CAAC;;mDAC3C;AAInB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,EAAC,EAAE,WAAW,EA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,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC9B,gBAAI;+CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,KAAqB,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;;iDACnC;AAIlB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC9B,gBAAI;+CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,KAAqB,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;;iDACnC;yBA9DP,cAAc;IAH1B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,sBAAsB,EAAE,CAAC,KAAqB,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC5F,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,8FAA8F,EAAE,CAAC;GAC/G,cAAc,CA+D1B","sourcesContent":["import { User } from '@things-factory/auth-base'\nimport { Domain, ScalarObject } from '@things-factory/shell'\nimport { Field, ID, ObjectType } from 'type-graphql'\nimport { Column, CreateDateColumn, DeleteDateColumn, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId, UpdateDateColumn } from 'typeorm'\n\nimport { Quotation } from './quotation'\n\n@Entity()\n@Index('ix_quotation_event_0', (event: QuotationEvent) => [event.quotation, event.createdAt])\n@ObjectType({ description: 'Entity for QuotationEvent — what happened to a quotation, with the document as it then stood' })\nexport class QuotationEvent {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true })\n domain?: Domain\n\n @RelationId((event: QuotationEvent) => event.domain)\n domainId?: string\n\n @ManyToOne(type => Quotation, { nullable: false })\n quotation: Quotation\n\n @RelationId((event: QuotationEvent) => event.quotation)\n @Field({ description: 'The quotation the event happened to' })\n quotationId: string\n\n @Column()\n @Field({ description: 'What happened: CREATED, UPDATED, SENT, ACCEPTED, REJECTED, EXPIRED, REVISED or SUPERSEDED' })\n action: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Why, when the buyer declined' })\n reason?: string\n\n @Column({ type: 'simple-json' })\n @Field(type => ScalarObject, { description: 'The quotation as it stood after the action' })\n snapshot: any\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n actor?: User\n\n @RelationId((event: QuotationEvent) => event.actor)\n actorId?: string\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'When it happened' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'When the row last changed' })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true, description: 'When the row was deleted' })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((event: QuotationEvent) => event.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((event: QuotationEvent) => event.updater)\n updaterId?: string\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import { User } from '@things-factory/auth-base';
2
+ import { Domain } from '@things-factory/shell';
3
+ import { QuotationItem } from './quotation-item';
4
+ export declare class QuotationItemQuery {
5
+ domain(row: QuotationItem): Domain | Promise<Domain>;
6
+ creator(row: QuotationItem): User | Promise<User>;
7
+ updater(row: QuotationItem): User | Promise<User>;
8
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuotationItemQuery = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const auth_base_1 = require("@things-factory/auth-base");
6
+ const shell_1 = require("@things-factory/shell");
7
+ const type_graphql_1 = require("type-graphql");
8
+ const quotation_item_1 = require("./quotation-item");
9
+ let QuotationItemQuery = class QuotationItemQuery {
10
+ domain(row) {
11
+ return row.domain ?? (row.domainId ? (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: row.domainId }) : undefined);
12
+ }
13
+ creator(row) {
14
+ return row.creator ?? (row.creatorId ? (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: row.creatorId }) : undefined);
15
+ }
16
+ updater(row) {
17
+ return row.updater ?? (row.updaterId ? (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: row.updaterId }) : undefined);
18
+ }
19
+ };
20
+ exports.QuotationItemQuery = QuotationItemQuery;
21
+ tslib_1.__decorate([
22
+ (0, type_graphql_1.FieldResolver)(type => shell_1.Domain, { nullable: true }),
23
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
24
+ tslib_1.__metadata("design:type", Function),
25
+ tslib_1.__metadata("design:paramtypes", [quotation_item_1.QuotationItem]),
26
+ tslib_1.__metadata("design:returntype", void 0)
27
+ ], QuotationItemQuery.prototype, "domain", null);
28
+ tslib_1.__decorate([
29
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User, { nullable: true }),
30
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
31
+ tslib_1.__metadata("design:type", Function),
32
+ tslib_1.__metadata("design:paramtypes", [quotation_item_1.QuotationItem]),
33
+ tslib_1.__metadata("design:returntype", void 0)
34
+ ], QuotationItemQuery.prototype, "creator", null);
35
+ tslib_1.__decorate([
36
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User, { nullable: true }),
37
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
38
+ tslib_1.__metadata("design:type", Function),
39
+ tslib_1.__metadata("design:paramtypes", [quotation_item_1.QuotationItem]),
40
+ tslib_1.__metadata("design:returntype", void 0)
41
+ ], QuotationItemQuery.prototype, "updater", null);
42
+ exports.QuotationItemQuery = QuotationItemQuery = tslib_1.__decorate([
43
+ (0, type_graphql_1.Resolver)(quotation_item_1.QuotationItem)
44
+ ], QuotationItemQuery);
45
+ //# sourceMappingURL=quotation-item-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quotation-item-query.js","sourceRoot":"","sources":["../../../server/service/quotation/quotation-item-query.ts"],"names":[],"mappings":";;;;AAAA,yDAAgD;AAChD,iDAA6D;AAC7D,+CAA4D;AAE5D,qDAAgD;AAGzC,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAG7B,MAAM,CAAS,GAAkB;QAC/B,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAA,qBAAa,EAAC,cAAM,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;IACzG,CAAC;IAGD,OAAO,CAAS,GAAkB;QAChC,OAAO,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,qBAAa,EAAC,gBAAI,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;IAC1G,CAAC;IAGD,OAAO,CAAS,GAAkB;QAChC,OAAO,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,qBAAa,EAAC,gBAAI,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;IAC1G,CAAC;CACF,CAAA;AAhBY,gDAAkB;AAG7B;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1C,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAM,8BAAa;;gDAEhC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvC,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAM,8BAAa;;iDAEjC;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvC,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAM,8BAAa;;iDAEjC;6BAfU,kBAAkB;IAD9B,IAAA,uBAAQ,EAAC,8BAAa,CAAC;GACX,kBAAkB,CAgB9B","sourcesContent":["import { User } from '@things-factory/auth-base'\nimport { Domain, getRepository } from '@things-factory/shell'\nimport { FieldResolver, Resolver, Root } from 'type-graphql'\n\nimport { QuotationItem } from './quotation-item'\n\n@Resolver(QuotationItem)\nexport class QuotationItemQuery {\n\n @FieldResolver(type => Domain, { nullable: true })\n domain(@Root() row: QuotationItem) {\n return row.domain ?? (row.domainId ? getRepository(Domain).findOneBy({ id: row.domainId }) : undefined)\n }\n\n @FieldResolver(type => User, { nullable: true })\n creator(@Root() row: QuotationItem) {\n return row.creator ?? (row.creatorId ? getRepository(User).findOneBy({ id: row.creatorId }) : undefined)\n }\n\n @FieldResolver(type => User, { nullable: true })\n updater(@Root() row: QuotationItem) {\n return row.updater ?? (row.updaterId ? getRepository(User).findOneBy({ id: row.updaterId }) : undefined)\n }\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import { User } from '@things-factory/auth-base';
2
+ import { CommercialLine } from '@things-factory/invoice';
3
+ import { Domain } from '@things-factory/shell';
4
+ import { Quotation } from './quotation';
5
+ export declare class QuotationItem extends CommercialLine {
6
+ readonly id: string;
7
+ domain?: Domain;
8
+ domainId?: string;
9
+ quotation: Quotation;
10
+ quotationId: string;
11
+ createdAt?: Date;
12
+ updatedAt?: Date;
13
+ deletedAt?: Date;
14
+ creator?: User;
15
+ creatorId?: string;
16
+ updater?: User;
17
+ updaterId?: string;
18
+ }
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuotationItem = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const auth_base_1 = require("@things-factory/auth-base");
6
+ const invoice_1 = require("@things-factory/invoice");
7
+ const shell_1 = require("@things-factory/shell");
8
+ const type_graphql_1 = require("type-graphql");
9
+ const typeorm_1 = require("typeorm");
10
+ const quotation_1 = require("./quotation");
11
+ let QuotationItem = class QuotationItem extends invoice_1.CommercialLine {
12
+ };
13
+ exports.QuotationItem = QuotationItem;
14
+ tslib_1.__decorate([
15
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
16
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID),
17
+ tslib_1.__metadata("design:type", String)
18
+ ], QuotationItem.prototype, "id", void 0);
19
+ tslib_1.__decorate([
20
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
21
+ (0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true }),
22
+ tslib_1.__metadata("design:type", shell_1.Domain)
23
+ ], QuotationItem.prototype, "domain", void 0);
24
+ tslib_1.__decorate([
25
+ (0, typeorm_1.RelationId)((item) => item.domain),
26
+ tslib_1.__metadata("design:type", String)
27
+ ], QuotationItem.prototype, "domainId", void 0);
28
+ tslib_1.__decorate([
29
+ (0, typeorm_1.ManyToOne)(type => quotation_1.Quotation, quotation => quotation.items, { nullable: false, onDelete: 'CASCADE' }),
30
+ tslib_1.__metadata("design:type", quotation_1.Quotation)
31
+ ], QuotationItem.prototype, "quotation", void 0);
32
+ tslib_1.__decorate([
33
+ (0, typeorm_1.RelationId)((item) => item.quotation),
34
+ (0, type_graphql_1.Field)({ description: 'The quotation the line belongs to' }),
35
+ tslib_1.__metadata("design:type", String)
36
+ ], QuotationItem.prototype, "quotationId", void 0);
37
+ tslib_1.__decorate([
38
+ (0, typeorm_1.CreateDateColumn)(),
39
+ (0, type_graphql_1.Field)({ nullable: true, description: 'When the line was written' }),
40
+ tslib_1.__metadata("design:type", Date)
41
+ ], QuotationItem.prototype, "createdAt", void 0);
42
+ tslib_1.__decorate([
43
+ (0, typeorm_1.UpdateDateColumn)(),
44
+ (0, type_graphql_1.Field)({ nullable: true, description: 'When the line last changed' }),
45
+ tslib_1.__metadata("design:type", Date)
46
+ ], QuotationItem.prototype, "updatedAt", void 0);
47
+ tslib_1.__decorate([
48
+ (0, typeorm_1.DeleteDateColumn)(),
49
+ (0, type_graphql_1.Field)({ nullable: true, description: 'When the line was removed' }),
50
+ tslib_1.__metadata("design:type", Date)
51
+ ], QuotationItem.prototype, "deletedAt", void 0);
52
+ tslib_1.__decorate([
53
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
54
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
55
+ tslib_1.__metadata("design:type", auth_base_1.User)
56
+ ], QuotationItem.prototype, "creator", void 0);
57
+ tslib_1.__decorate([
58
+ (0, typeorm_1.RelationId)((item) => item.creator),
59
+ tslib_1.__metadata("design:type", String)
60
+ ], QuotationItem.prototype, "creatorId", void 0);
61
+ tslib_1.__decorate([
62
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
63
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
64
+ tslib_1.__metadata("design:type", auth_base_1.User)
65
+ ], QuotationItem.prototype, "updater", void 0);
66
+ tslib_1.__decorate([
67
+ (0, typeorm_1.RelationId)((item) => item.updater),
68
+ tslib_1.__metadata("design:type", String)
69
+ ], QuotationItem.prototype, "updaterId", void 0);
70
+ exports.QuotationItem = QuotationItem = tslib_1.__decorate([
71
+ (0, typeorm_1.Entity)(),
72
+ (0, typeorm_1.Index)('ix_quotation_item_0', (item) => [item.quotation, item.position]),
73
+ (0, type_graphql_1.ObjectType)({ description: 'Entity for QuotationItem — one line of a quotation' })
74
+ ], QuotationItem);
75
+ //# sourceMappingURL=quotation-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quotation-item.js","sourceRoot":"","sources":["../../../server/service/quotation/quotation-item.ts"],"names":[],"mappings":";;;;AAAA,yDAAgD;AAChD,qDAAwD;AACxD,iDAA8C;AAC9C,+CAAoD;AACpD,qCAA4I;AAE5I,2CAAuC;AAKhC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,wBAAc;CA4ChD,CAAA;AA5CY,sCAAa;AAGf;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;yCACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACjC,cAAM;6CAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,IAAmB,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC;;+CAChC;AAGjB;IADC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,qBAAS,EAAE,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;sCAC1F,qBAAS;gDAAA;AAIpB;IAFC,IAAA,oBAAU,EAAC,CAAC,IAAmB,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC;IACnD,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;;kDACzC;AAInB;IAFC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,2BAA2B,EAA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User } from '@things-factory/auth-base'\nimport { CommercialLine } from '@things-factory/invoice'\nimport { Domain } from '@things-factory/shell'\nimport { Field, ID, ObjectType } from 'type-graphql'\nimport { CreateDateColumn, DeleteDateColumn, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId, UpdateDateColumn } from 'typeorm'\n\nimport { Quotation } from './quotation'\n\n@Entity()\n@Index('ix_quotation_item_0', (item: QuotationItem) => [item.quotation, item.position])\n@ObjectType({ description: 'Entity for QuotationItem — one line of a quotation' })\nexport class QuotationItem extends CommercialLine {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true })\n domain?: Domain\n\n @RelationId((item: QuotationItem) => item.domain)\n domainId?: string\n\n @ManyToOne(type => Quotation, quotation => quotation.items, { nullable: false, onDelete: 'CASCADE' })\n quotation: Quotation\n\n @RelationId((item: QuotationItem) => item.quotation)\n @Field({ description: 'The quotation the line belongs to' })\n quotationId: string\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'When the line was written' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'When the line last changed' })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true, description: 'When the line was removed' })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((item: QuotationItem) => item.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((item: QuotationItem) => item.updater)\n updaterId?: string\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { Quotation } from './quotation';
2
+ import { NewQuotation } from './quotation-type';
3
+ export declare class QuotationMutation {
4
+ createQuotation(quotation: NewQuotation, context: ResolverContext): Promise<Quotation>;
5
+ updateQuotation(id: string, quotation: NewQuotation, context: ResolverContext): Promise<Quotation>;
6
+ sendQuotation(id: string, context: ResolverContext): Promise<Quotation>;
7
+ acceptQuotation(id: string, context: ResolverContext): Promise<Quotation>;
8
+ rejectQuotation(id: string, reason: string, context: ResolverContext): Promise<Quotation>;
9
+ expireQuotation(id: string, context: ResolverContext): Promise<Quotation>;
10
+ reviseQuotation(id: string, context: ResolverContext): Promise<Quotation>;
11
+ }
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuotationMutation = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const shell_1 = require("@things-factory/shell");
6
+ const type_graphql_1 = require("type-graphql");
7
+ const quotation_1 = require("./quotation");
8
+ const quotation_service_1 = require("./quotation-service");
9
+ const quotation_type_1 = require("./quotation-type");
10
+ let QuotationMutation = class QuotationMutation {
11
+ createQuotation(quotation, context) {
12
+ const { tx, domain, user } = context.state;
13
+ return (0, quotation_service_1.saveQuotation)(tx, domain, user, quotation);
14
+ }
15
+ updateQuotation(id, quotation, context) {
16
+ const { tx, domain, user } = context.state;
17
+ return (0, quotation_service_1.saveQuotation)(tx, domain, user, quotation, id);
18
+ }
19
+ sendQuotation(id, context) {
20
+ const { tx, domain, user } = context.state;
21
+ return (0, quotation_service_1.transitionQuotation)(tx, domain, user, id, 'SENT');
22
+ }
23
+ acceptQuotation(id, context) {
24
+ const { tx, domain, user } = context.state;
25
+ return (0, quotation_service_1.transitionQuotation)(tx, domain, user, id, 'ACCEPTED');
26
+ }
27
+ rejectQuotation(id, reason, context) {
28
+ const { tx, domain, user } = context.state;
29
+ return (0, quotation_service_1.transitionQuotation)(tx, domain, user, id, 'REJECTED', reason);
30
+ }
31
+ expireQuotation(id, context) {
32
+ const { tx, domain, user } = context.state;
33
+ return (0, quotation_service_1.transitionQuotation)(tx, domain, user, id, 'EXPIRED');
34
+ }
35
+ reviseQuotation(id, context) {
36
+ const { tx, domain, user } = context.state;
37
+ return (0, quotation_service_1.reviseQuotation)(tx, domain, user, id);
38
+ }
39
+ };
40
+ exports.QuotationMutation = QuotationMutation;
41
+ tslib_1.__decorate([
42
+ (0, type_graphql_1.Directive)('@transaction'),
43
+ (0, type_graphql_1.Directive)('@privilege(category: "sales", privilege: "mutation", domainOwnerGranted: true)'),
44
+ (0, type_graphql_1.Mutation)(type => quotation_1.Quotation, { description: 'To create a quotation draft' }),
45
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('quotation')),
46
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
47
+ tslib_1.__metadata("design:type", Function),
48
+ tslib_1.__metadata("design:paramtypes", [quotation_type_1.NewQuotation, Object]),
49
+ tslib_1.__metadata("design:returntype", void 0)
50
+ ], QuotationMutation.prototype, "createQuotation", null);
51
+ tslib_1.__decorate([
52
+ (0, type_graphql_1.Directive)('@transaction'),
53
+ (0, type_graphql_1.Directive)('@privilege(category: "sales", privilege: "mutation", domainOwnerGranted: true)'),
54
+ (0, type_graphql_1.Mutation)(type => quotation_1.Quotation, { description: 'To replace the head and lines of a quotation draft' }),
55
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
56
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('quotation')),
57
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
58
+ tslib_1.__metadata("design:type", Function),
59
+ tslib_1.__metadata("design:paramtypes", [String, quotation_type_1.NewQuotation, Object]),
60
+ tslib_1.__metadata("design:returntype", void 0)
61
+ ], QuotationMutation.prototype, "updateQuotation", null);
62
+ tslib_1.__decorate([
63
+ (0, type_graphql_1.Directive)('@transaction'),
64
+ (0, type_graphql_1.Directive)('@privilege(category: "sales", privilege: "mutation", domainOwnerGranted: true)'),
65
+ (0, type_graphql_1.Mutation)(type => quotation_1.Quotation, { description: 'To send a quotation draft; its amounts are fixed from then on' }),
66
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
67
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
68
+ tslib_1.__metadata("design:type", Function),
69
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
70
+ tslib_1.__metadata("design:returntype", void 0)
71
+ ], QuotationMutation.prototype, "sendQuotation", null);
72
+ tslib_1.__decorate([
73
+ (0, type_graphql_1.Directive)('@transaction'),
74
+ (0, type_graphql_1.Directive)('@privilege(category: "sales", privilege: "mutation", domainOwnerGranted: true)'),
75
+ (0, type_graphql_1.Mutation)(type => quotation_1.Quotation, { description: 'To record that the buyer accepted a sent quotation' }),
76
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
77
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
78
+ tslib_1.__metadata("design:type", Function),
79
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
80
+ tslib_1.__metadata("design:returntype", void 0)
81
+ ], QuotationMutation.prototype, "acceptQuotation", null);
82
+ tslib_1.__decorate([
83
+ (0, type_graphql_1.Directive)('@transaction'),
84
+ (0, type_graphql_1.Directive)('@privilege(category: "sales", privilege: "mutation", domainOwnerGranted: true)'),
85
+ (0, type_graphql_1.Mutation)(type => quotation_1.Quotation, { description: 'To record that the buyer declined a sent quotation, with the reason' }),
86
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
87
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('reason')),
88
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
89
+ tslib_1.__metadata("design:type", Function),
90
+ tslib_1.__metadata("design:paramtypes", [String, String, Object]),
91
+ tslib_1.__metadata("design:returntype", void 0)
92
+ ], QuotationMutation.prototype, "rejectQuotation", null);
93
+ tslib_1.__decorate([
94
+ (0, type_graphql_1.Directive)('@transaction'),
95
+ (0, type_graphql_1.Directive)('@privilege(category: "sales", privilege: "mutation", domainOwnerGranted: true)'),
96
+ (0, type_graphql_1.Mutation)(type => quotation_1.Quotation, { description: 'To close a sent quotation whose last day has passed' }),
97
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
98
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
99
+ tslib_1.__metadata("design:type", Function),
100
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
101
+ tslib_1.__metadata("design:returntype", void 0)
102
+ ], QuotationMutation.prototype, "expireQuotation", null);
103
+ tslib_1.__decorate([
104
+ (0, type_graphql_1.Directive)('@transaction'),
105
+ (0, type_graphql_1.Directive)('@privilege(category: "sales", privilege: "mutation", domainOwnerGranted: true)'),
106
+ (0, type_graphql_1.Mutation)(type => quotation_1.Quotation, { description: 'To start the next version of a sent quotation, keeping its number' }),
107
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
108
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
109
+ tslib_1.__metadata("design:type", Function),
110
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
111
+ tslib_1.__metadata("design:returntype", void 0)
112
+ ], QuotationMutation.prototype, "reviseQuotation", null);
113
+ exports.QuotationMutation = QuotationMutation = tslib_1.__decorate([
114
+ (0, type_graphql_1.UseMiddleware)(shell_1.SpeakRefusals),
115
+ (0, type_graphql_1.Resolver)(quotation_1.Quotation)
116
+ ], QuotationMutation);
117
+ //# sourceMappingURL=quotation-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quotation-mutation.js","sourceRoot":"","sources":["../../../server/service/quotation/quotation-mutation.ts"],"names":[],"mappings":";;;;AAAA,iDAAqD;AACrD,+CAAqF;AAErF,2CAAuC;AACvC,2DAAyF;AACzF,qDAA+C;AAIxC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAI5B,eAAe,CAAmB,SAAuB,EAAS,OAAwB;QACxF,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAC1C,OAAO,IAAA,iCAAa,EAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;IACnD,CAAC;IAKD,eAAe,CAAY,EAAU,EAAoB,SAAuB,EAAS,OAAwB;QAC/G,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,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'\n\nimport { Quotation } from './quotation'\nimport { reviseQuotation, saveQuotation, transitionQuotation } from './quotation-service'\nimport { NewQuotation } from './quotation-type'\n\n@UseMiddleware(SpeakRefusals)\n@Resolver(Quotation)\nexport class QuotationMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"sales\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(type => Quotation, { description: 'To create a quotation draft' })\n createQuotation(@Arg('quotation') quotation: NewQuotation, @Ctx() context: ResolverContext) {\n const { tx, domain, user } = context.state\n return saveQuotation(tx, domain, user, quotation)\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"sales\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(type => Quotation, { description: 'To replace the head and lines of a quotation draft' })\n updateQuotation(@Arg('id') id: string, @Arg('quotation') quotation: NewQuotation, @Ctx() context: ResolverContext) {\n const { tx, domain, user } = context.state\n return saveQuotation(tx, domain, user, quotation, id)\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"sales\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(type => Quotation, { description: 'To send a quotation draft; its amounts are fixed from then on' })\n sendQuotation(@Arg('id') id: string, @Ctx() context: ResolverContext) {\n const { tx, domain, user } = context.state\n return transitionQuotation(tx, domain, user, id, 'SENT')\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"sales\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(type => Quotation, { description: 'To record that the buyer accepted a sent quotation' })\n acceptQuotation(@Arg('id') id: string, @Ctx() context: ResolverContext) {\n const { tx, domain, user } = context.state\n return transitionQuotation(tx, domain, user, id, 'ACCEPTED')\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"sales\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(type => Quotation, { description: 'To record that the buyer declined a sent quotation, with the reason' })\n rejectQuotation(@Arg('id') id: string, @Arg('reason') reason: string, @Ctx() context: ResolverContext) {\n const { tx, domain, user } = context.state\n return transitionQuotation(tx, domain, user, id, 'REJECTED', reason)\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"sales\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(type => Quotation, { description: 'To close a sent quotation whose last day has passed' })\n expireQuotation(@Arg('id') id: string, @Ctx() context: ResolverContext) {\n const { tx, domain, user } = context.state\n return transitionQuotation(tx, domain, user, id, 'EXPIRED')\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"sales\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(type => Quotation, { description: 'To start the next version of a sent quotation, keeping its number' })\n reviseQuotation(@Arg('id') id: string, @Ctx() context: ResolverContext) {\n const { tx, domain, user } = context.state\n return reviseQuotation(tx, domain, user, id)\n }\n}\n"]}
@@ -0,0 +1,19 @@
1
+ import { User } from '@things-factory/auth-base';
2
+ import { Domain, ListParam } from '@things-factory/shell';
3
+ import { Opportunity } from '../opportunity/opportunity';
4
+ import { Quotation } from './quotation';
5
+ import { QuotationEvent } from './quotation-event';
6
+ import { QuotationItem } from './quotation-item';
7
+ import { QuotationList } from './quotation-type';
8
+ export declare class QuotationQuery {
9
+ quotation(id: string, context: ResolverContext): Promise<Quotation>;
10
+ quotations(params: ListParam, context: ResolverContext): Promise<QuotationList>;
11
+ quotationVersions(number: string, context: ResolverContext): Promise<Quotation[]>;
12
+ quotationEvents(quotationId: string, context: ResolverContext): Promise<QuotationEvent[]>;
13
+ items(quotation: Quotation): Promise<QuotationItem[]>;
14
+ taxGroups(quotation: Quotation): Promise<import("@things-factory/invoice").TaxGroup[]>;
15
+ opportunity(row: Quotation): Opportunity | Promise<Opportunity>;
16
+ domain(row: Quotation): Domain | Promise<Domain>;
17
+ creator(row: Quotation): User | Promise<User>;
18
+ updater(row: Quotation): User | Promise<User>;
19
+ }