@things-factory/sales 0.0.0-stage → 10.1.176
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.
- package/CHANGELOG.md +8 -0
- package/assets/images/hatiolab-logo.png +0 -0
- package/dist-client/bootstrap.d.ts +1 -0
- package/dist-client/bootstrap.js +5 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/entity360/opportunity-360.d.ts +12 -0
- package/dist-client/entity360/opportunity-360.js +114 -0
- package/dist-client/entity360/opportunity-360.js.map +1 -0
- package/dist-client/index.d.ts +4 -0
- package/dist-client/index.js +5 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/opportunity-attach.d.ts +17 -0
- package/dist-client/opportunity-attach.js +8 -0
- package/dist-client/opportunity-attach.js.map +1 -0
- package/dist-client/opportunity-words.d.ts +1 -0
- package/dist-client/opportunity-words.js +13 -0
- package/dist-client/opportunity-words.js.map +1 -0
- package/dist-client/pages/opportunity-editor.d.ts +81 -0
- package/dist-client/pages/opportunity-editor.js +482 -0
- package/dist-client/pages/opportunity-editor.js.map +1 -0
- package/dist-client/pages/opportunity-list.d.ts +40 -0
- package/dist-client/pages/opportunity-list.js +134 -0
- package/dist-client/pages/opportunity-list.js.map +1 -0
- package/dist-client/pages/quotation-editor.d.ts +44 -0
- package/dist-client/pages/quotation-editor.js +315 -0
- package/dist-client/pages/quotation-editor.js.map +1 -0
- package/dist-client/pages/quotation-list.d.ts +36 -0
- package/dist-client/pages/quotation-list.js +113 -0
- package/dist-client/pages/quotation-list.js.map +1 -0
- package/dist-client/quotation-attach.d.ts +16 -0
- package/dist-client/quotation-attach.js +8 -0
- package/dist-client/quotation-attach.js.map +1 -0
- package/dist-client/quotation-words.d.ts +1 -0
- package/dist-client/quotation-words.js +13 -0
- package/dist-client/quotation-words.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +17 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/controllers/index.d.ts +0 -0
- package/dist-server/controllers/index.js +1 -0
- package/dist-server/controllers/index.js.map +1 -0
- package/dist-server/index.d.ts +4 -0
- package/dist-server/index.js +8 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/middlewares/index.d.ts +2 -0
- package/dist-server/middlewares/index.js +7 -0
- package/dist-server/middlewares/index.js.map +1 -0
- package/dist-server/migrations/index.d.ts +1 -0
- package/dist-server/migrations/index.js +12 -0
- package/dist-server/migrations/index.js.map +1 -0
- package/dist-server/routes.d.ts +0 -0
- package/dist-server/routes.js +24 -0
- package/dist-server/routes.js.map +1 -0
- package/dist-server/service/index.d.ts +16 -0
- package/dist-server/service/index.js +21 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/opportunity/index.d.ts +8 -0
- package/dist-server/service/opportunity/index.js +12 -0
- package/dist-server/service/opportunity/index.js.map +1 -0
- package/dist-server/service/opportunity/opportunity-event-query.d.ts +9 -0
- package/dist-server/service/opportunity/opportunity-event-query.js +55 -0
- package/dist-server/service/opportunity/opportunity-event-query.js.map +1 -0
- package/dist-server/service/opportunity/opportunity-event.d.ts +27 -0
- package/dist-server/service/opportunity/opportunity-event.js +115 -0
- package/dist-server/service/opportunity/opportunity-event.js.map +1 -0
- package/dist-server/service/opportunity/opportunity-mutation.d.ts +7 -0
- package/dist-server/service/opportunity/opportunity-mutation.js +64 -0
- package/dist-server/service/opportunity/opportunity-mutation.js.map +1 -0
- package/dist-server/service/opportunity/opportunity-query.d.ts +19 -0
- package/dist-server/service/opportunity/opportunity-query.js +144 -0
- package/dist-server/service/opportunity/opportunity-query.js.map +1 -0
- package/dist-server/service/opportunity/opportunity-rules.d.ts +22 -0
- package/dist-server/service/opportunity/opportunity-rules.js +59 -0
- package/dist-server/service/opportunity/opportunity-rules.js.map +1 -0
- package/dist-server/service/opportunity/opportunity-service.d.ts +19 -0
- package/dist-server/service/opportunity/opportunity-service.js +107 -0
- package/dist-server/service/opportunity/opportunity-service.js.map +1 -0
- package/dist-server/service/opportunity/opportunity-type.d.ts +23 -0
- package/dist-server/service/opportunity/opportunity-type.js +86 -0
- package/dist-server/service/opportunity/opportunity-type.js.map +1 -0
- package/dist-server/service/opportunity/opportunity.d.ts +35 -0
- package/dist-server/service/opportunity/opportunity.js +147 -0
- package/dist-server/service/opportunity/opportunity.js.map +1 -0
- package/dist-server/service/quotation/index.d.ts +10 -0
- package/dist-server/service/quotation/index.js +14 -0
- package/dist-server/service/quotation/index.js.map +1 -0
- package/dist-server/service/quotation/quotation-event-query.d.ts +9 -0
- package/dist-server/service/quotation/quotation-event-query.js +55 -0
- package/dist-server/service/quotation/quotation-event-query.js.map +1 -0
- package/dist-server/service/quotation/quotation-event.d.ts +22 -0
- package/dist-server/service/quotation/quotation-event.js +98 -0
- package/dist-server/service/quotation/quotation-event.js.map +1 -0
- package/dist-server/service/quotation/quotation-item-query.d.ts +8 -0
- package/dist-server/service/quotation/quotation-item-query.js +45 -0
- package/dist-server/service/quotation/quotation-item-query.js.map +1 -0
- package/dist-server/service/quotation/quotation-item.d.ts +18 -0
- package/dist-server/service/quotation/quotation-item.js +75 -0
- package/dist-server/service/quotation/quotation-item.js.map +1 -0
- package/dist-server/service/quotation/quotation-mutation.d.ts +11 -0
- package/dist-server/service/quotation/quotation-mutation.js +117 -0
- package/dist-server/service/quotation/quotation-mutation.js.map +1 -0
- package/dist-server/service/quotation/quotation-query.d.ts +17 -0
- package/dist-server/service/quotation/quotation-query.js +125 -0
- package/dist-server/service/quotation/quotation-query.js.map +1 -0
- package/dist-server/service/quotation/quotation-rules.d.ts +6 -0
- package/dist-server/service/quotation/quotation-rules.js +22 -0
- package/dist-server/service/quotation/quotation-rules.js.map +1 -0
- package/dist-server/service/quotation/quotation-service.d.ts +23 -0
- package/dist-server/service/quotation/quotation-service.js +115 -0
- package/dist-server/service/quotation/quotation-service.js.map +1 -0
- package/dist-server/service/quotation/quotation-type.d.ts +9 -0
- package/dist-server/service/quotation/quotation-type.js +32 -0
- package/dist-server/service/quotation/quotation-type.js.map +1 -0
- package/dist-server/service/quotation/quotation.d.ts +33 -0
- package/dist-server/service/quotation/quotation.js +109 -0
- package/dist-server/service/quotation/quotation.js.map +1 -0
- package/dist-server/service/sales-event.d.ts +15 -0
- package/dist-server/service/sales-event.js +12 -0
- package/dist-server/service/sales-event.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/helps/quotation/quotation.md +160 -0
- package/package.json +46 -4
- package/things-factory.config.js +13 -0
- package/translations/en.json +98 -0
- package/translations/es.json +98 -0
- package/translations/ja.json +98 -0
- package/translations/ko.json +98 -0
- package/translations/ms.json +98 -0
- package/translations/zh.json +98 -0
- package/README.md +0 -3
|
@@ -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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;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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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;8CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,IAAmB,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;;gDAChC;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;8CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,IAAmB,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;;gDAChC;wBA3CP,aAAa;IAHzB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,qBAAqB,EAAE,CAAC,IAAmB,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtF,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,oDAAoD,EAAE,CAAC;GACrE,aAAa,CA4CzB","sourcesContent":["import { 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
|
|
@@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,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;wDAG5C;AAKD;IAHC,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,gFAAgF,CAAC;IAC3F,IAAA,uBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC,qBAAS,EAAE,EAAE,WAAW,EAAE,mEAAmE,EAAE,CAAC;IACjG,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;wDAG5C;4BAvDU,iBAAiB;IAF7B,IAAA,4BAAa,EAAC,qBAAa,CAAC;IAC5B,IAAA,uBAAQ,EAAC,qBAAS,CAAC;GACP,iBAAiB,CAwD7B","sourcesContent":["import { SpeakRefusals } from '@things-factory/shell'\nimport { Arg, Ctx, Directive, Mutation, Resolver, UseMiddleware } from 'type-graphql'\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,17 @@
|
|
|
1
|
+
import { User } from '@things-factory/auth-base';
|
|
2
|
+
import { Domain, ListParam } from '@things-factory/shell';
|
|
3
|
+
import { Quotation } from './quotation';
|
|
4
|
+
import { QuotationEvent } from './quotation-event';
|
|
5
|
+
import { QuotationItem } from './quotation-item';
|
|
6
|
+
import { QuotationList } from './quotation-type';
|
|
7
|
+
export declare class QuotationQuery {
|
|
8
|
+
quotation(id: string, context: ResolverContext): Promise<Quotation>;
|
|
9
|
+
quotations(params: ListParam, context: ResolverContext): Promise<QuotationList>;
|
|
10
|
+
quotationVersions(number: string, context: ResolverContext): Promise<Quotation[]>;
|
|
11
|
+
quotationEvents(quotationId: string, context: ResolverContext): Promise<QuotationEvent[]>;
|
|
12
|
+
items(quotation: Quotation): Promise<QuotationItem[]>;
|
|
13
|
+
taxGroups(quotation: Quotation): Promise<import("@things-factory/invoice").TaxGroup[]>;
|
|
14
|
+
domain(row: Quotation): Domain | Promise<Domain>;
|
|
15
|
+
creator(row: Quotation): User | Promise<User>;
|
|
16
|
+
updater(row: Quotation): User | Promise<User>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuotationQuery = 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 quotation_1 = require("./quotation");
|
|
10
|
+
const quotation_event_1 = require("./quotation-event");
|
|
11
|
+
const quotation_item_1 = require("./quotation-item");
|
|
12
|
+
const quotation_type_1 = require("./quotation-type");
|
|
13
|
+
let QuotationQuery = class QuotationQuery {
|
|
14
|
+
quotation(id, context) {
|
|
15
|
+
return (0, shell_1.getRepository)(quotation_1.Quotation).findOne({ where: { id, domain: { id: context.state.domain.id } } });
|
|
16
|
+
}
|
|
17
|
+
async quotations(params, context) {
|
|
18
|
+
const query = (0, shell_1.getQueryBuilderFromListParams)({
|
|
19
|
+
domain: context.state.domain,
|
|
20
|
+
params,
|
|
21
|
+
repository: (0, shell_1.getRepository)(quotation_1.Quotation),
|
|
22
|
+
searchables: ['number', 'supplierName', 'buyerName', 'notes']
|
|
23
|
+
});
|
|
24
|
+
const [items, total] = await query.getManyAndCount();
|
|
25
|
+
return { items, total };
|
|
26
|
+
}
|
|
27
|
+
quotationVersions(number, context) {
|
|
28
|
+
return (0, shell_1.getRepository)(quotation_1.Quotation).find({ where: { domain: { id: context.state.domain.id }, number }, order: { version: 'ASC' } });
|
|
29
|
+
}
|
|
30
|
+
quotationEvents(quotationId, context) {
|
|
31
|
+
return (0, shell_1.getRepository)(quotation_event_1.QuotationEvent).find({ where: { domain: { id: context.state.domain.id }, quotation: { id: quotationId } }, order: { createdAt: 'ASC' } });
|
|
32
|
+
}
|
|
33
|
+
async items(quotation) {
|
|
34
|
+
return quotation.items ?? (0, shell_1.getRepository)(quotation_item_1.QuotationItem).find({ where: { quotation: { id: quotation.id } }, order: { position: 'ASC' } });
|
|
35
|
+
}
|
|
36
|
+
async taxGroups(quotation) {
|
|
37
|
+
return (0, invoice_1.taxGroupsOf)({ ...quotation, items: await this.items(quotation) });
|
|
38
|
+
}
|
|
39
|
+
domain(row) {
|
|
40
|
+
return row.domain ?? (row.domainId ? (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: row.domainId }) : undefined);
|
|
41
|
+
}
|
|
42
|
+
creator(row) {
|
|
43
|
+
return row.creator ?? (row.creatorId ? (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: row.creatorId }) : undefined);
|
|
44
|
+
}
|
|
45
|
+
updater(row) {
|
|
46
|
+
return row.updater ?? (row.updaterId ? (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: row.updaterId }) : undefined);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
exports.QuotationQuery = QuotationQuery;
|
|
50
|
+
tslib_1.__decorate([
|
|
51
|
+
(0, type_graphql_1.Directive)('@privilege(category: "sales", privilege: "query", domainOwnerGranted: true)'),
|
|
52
|
+
(0, type_graphql_1.Query)(type => quotation_1.Quotation, { nullable: true, description: 'To fetch a quotation' }),
|
|
53
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
54
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
55
|
+
tslib_1.__metadata("design:type", Function),
|
|
56
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
57
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
58
|
+
], QuotationQuery.prototype, "quotation", null);
|
|
59
|
+
tslib_1.__decorate([
|
|
60
|
+
(0, type_graphql_1.Directive)('@privilege(category: "sales", privilege: "query", domainOwnerGranted: true)'),
|
|
61
|
+
(0, type_graphql_1.Query)(type => quotation_type_1.QuotationList, { description: 'To fetch a page of quotations' }),
|
|
62
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
|
63
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
64
|
+
tslib_1.__metadata("design:type", Function),
|
|
65
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
66
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
67
|
+
], QuotationQuery.prototype, "quotations", null);
|
|
68
|
+
tslib_1.__decorate([
|
|
69
|
+
(0, type_graphql_1.Directive)('@privilege(category: "sales", privilege: "query", domainOwnerGranted: true)'),
|
|
70
|
+
(0, type_graphql_1.Query)(type => [quotation_1.Quotation], { description: 'To fetch every version of a quotation number, oldest first' }),
|
|
71
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('number')),
|
|
72
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
73
|
+
tslib_1.__metadata("design:type", Function),
|
|
74
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
75
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
76
|
+
], QuotationQuery.prototype, "quotationVersions", null);
|
|
77
|
+
tslib_1.__decorate([
|
|
78
|
+
(0, type_graphql_1.Directive)('@privilege(category: "sales", privilege: "query", domainOwnerGranted: true)'),
|
|
79
|
+
(0, type_graphql_1.Query)(type => [quotation_event_1.QuotationEvent], { description: 'To fetch what happened to a quotation, oldest first' }),
|
|
80
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('quotationId')),
|
|
81
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
82
|
+
tslib_1.__metadata("design:type", Function),
|
|
83
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
84
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
85
|
+
], QuotationQuery.prototype, "quotationEvents", null);
|
|
86
|
+
tslib_1.__decorate([
|
|
87
|
+
(0, type_graphql_1.FieldResolver)(type => [quotation_item_1.QuotationItem]),
|
|
88
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
89
|
+
tslib_1.__metadata("design:type", Function),
|
|
90
|
+
tslib_1.__metadata("design:paramtypes", [quotation_1.Quotation]),
|
|
91
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
92
|
+
], QuotationQuery.prototype, "items", null);
|
|
93
|
+
tslib_1.__decorate([
|
|
94
|
+
(0, type_graphql_1.FieldResolver)(type => [invoice_1.DocumentTaxGroup]),
|
|
95
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
96
|
+
tslib_1.__metadata("design:type", Function),
|
|
97
|
+
tslib_1.__metadata("design:paramtypes", [quotation_1.Quotation]),
|
|
98
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
99
|
+
], QuotationQuery.prototype, "taxGroups", null);
|
|
100
|
+
tslib_1.__decorate([
|
|
101
|
+
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain, { nullable: true }),
|
|
102
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
103
|
+
tslib_1.__metadata("design:type", Function),
|
|
104
|
+
tslib_1.__metadata("design:paramtypes", [quotation_1.Quotation]),
|
|
105
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
106
|
+
], QuotationQuery.prototype, "domain", null);
|
|
107
|
+
tslib_1.__decorate([
|
|
108
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User, { nullable: true }),
|
|
109
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
110
|
+
tslib_1.__metadata("design:type", Function),
|
|
111
|
+
tslib_1.__metadata("design:paramtypes", [quotation_1.Quotation]),
|
|
112
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
113
|
+
], QuotationQuery.prototype, "creator", null);
|
|
114
|
+
tslib_1.__decorate([
|
|
115
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User, { nullable: true }),
|
|
116
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
117
|
+
tslib_1.__metadata("design:type", Function),
|
|
118
|
+
tslib_1.__metadata("design:paramtypes", [quotation_1.Quotation]),
|
|
119
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
120
|
+
], QuotationQuery.prototype, "updater", null);
|
|
121
|
+
exports.QuotationQuery = QuotationQuery = tslib_1.__decorate([
|
|
122
|
+
(0, type_graphql_1.UseMiddleware)(shell_1.SpeakRefusals),
|
|
123
|
+
(0, type_graphql_1.Resolver)(quotation_1.Quotation)
|
|
124
|
+
], QuotationQuery);
|
|
125
|
+
//# sourceMappingURL=quotation-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quotation-query.js","sourceRoot":"","sources":["../../../server/service/quotation/quotation-query.ts"],"names":[],"mappings":";;;;AAAA,yDAAgD;AAChD,qDAAuE;AACvE,iDAAsH;AACtH,+CAA6G;AAE7G,2CAAuC;AACvC,uDAAkD;AAClD,qDAAgD;AAChD,qDAAgD;AAIzC,IAAM,cAAc,GAApB,MAAM,cAAc;IAGzB,SAAS,CAAY,EAAU,EAAS,OAAwB;QAC9D,OAAO,IAAA,qBAAa,EAAC,qBAAS,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,MAA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L,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,0BAAgB,CAAC,CAAC;IACzB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAY,qBAAS;;+CAE3C;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1C,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAM,qBAAS;;4CAE5B;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvC,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAM,qBAAS;;6CAE7B;AAGD;IADC,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvC,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAM,qBAAS;;6CAE7B;yBAvDU,cAAc;IAF1B,IAAA,4BAAa,EAAC,qBAAa,CAAC;IAC5B,IAAA,uBAAQ,EAAC,qBAAS,CAAC;GACP,cAAc,CAwD1B","sourcesContent":["import { User } from '@things-factory/auth-base'\nimport { DocumentTaxGroup, taxGroupsOf } from '@things-factory/invoice'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam, SpeakRefusals } from '@things-factory/shell'\nimport { Arg, Args, Ctx, Directive, FieldResolver, Query, Resolver, Root, UseMiddleware } from 'type-graphql'\n\nimport { Quotation } from './quotation'\nimport { QuotationEvent } from './quotation-event'\nimport { QuotationItem } from './quotation-item'\nimport { QuotationList } from './quotation-type'\n\n@UseMiddleware(SpeakRefusals)\n@Resolver(Quotation)\nexport class QuotationQuery {\n @Directive('@privilege(category: \"sales\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(type => Quotation, { nullable: true, description: 'To fetch a quotation' })\n quotation(@Arg('id') id: string, @Ctx() context: ResolverContext) {\n return getRepository(Quotation).findOne({ where: { id, domain: { id: context.state.domain.id } } })\n }\n\n @Directive('@privilege(category: \"sales\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(type => QuotationList, { description: 'To fetch a page of quotations' })\n async quotations(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<QuotationList> {\n const query = getQueryBuilderFromListParams({\n domain: context.state.domain,\n params,\n repository: getRepository(Quotation),\n searchables: ['number', 'supplierName', 'buyerName', 'notes']\n })\n const [items, total] = await query.getManyAndCount()\n return { items, total }\n }\n\n @Directive('@privilege(category: \"sales\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(type => [Quotation], { description: 'To fetch every version of a quotation number, oldest first' })\n quotationVersions(@Arg('number') number: string, @Ctx() context: ResolverContext) {\n return getRepository(Quotation).find({ where: { domain: { id: context.state.domain.id }, number }, order: { version: 'ASC' } })\n }\n\n @Directive('@privilege(category: \"sales\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(type => [QuotationEvent], { description: 'To fetch what happened to a quotation, oldest first' })\n quotationEvents(@Arg('quotationId') quotationId: string, @Ctx() context: ResolverContext) {\n return getRepository(QuotationEvent).find({ where: { domain: { id: context.state.domain.id }, quotation: { id: quotationId } }, order: { createdAt: 'ASC' } })\n }\n\n @FieldResolver(type => [QuotationItem])\n async items(@Root() quotation: Quotation) {\n return quotation.items ?? getRepository(QuotationItem).find({ where: { quotation: { id: quotation.id } }, order: { position: 'ASC' } })\n }\n\n @FieldResolver(type => [DocumentTaxGroup])\n async taxGroups(@Root() quotation: Quotation) {\n return taxGroupsOf({ ...quotation, items: await this.items(quotation) })\n }\n\n @FieldResolver(type => Domain, { nullable: true })\n domain(@Root() row: Quotation) {\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: Quotation) {\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: Quotation) {\n return row.updater ?? (row.updaterId ? getRepository(User).findOneBy({ id: row.updaterId }) : undefined)\n }\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { QuotationStatus } from './quotation';
|
|
2
|
+
export type QuotationAction = 'SENT' | 'ACCEPTED' | 'REJECTED' | 'EXPIRED';
|
|
3
|
+
/** The status an action leads to from where the quotation stands on `today`, or undefined when it may not. */
|
|
4
|
+
export declare function quotationTransition(status: string, action: QuotationAction, validUntil: string, today: string): QuotationStatus | undefined;
|
|
5
|
+
/** Only the latest sent version that nobody accepted may be revised. */
|
|
6
|
+
export declare function revisable(status: string): boolean;
|