@things-factory/quotation 6.0.46
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/client/actions/main.ts +1 -0
- package/client/activities/activity-quotation-edit.ts +90 -0
- package/client/activities/activity-quotation-view.ts +90 -0
- package/client/bootstrap.ts +8 -0
- package/client/index.ts +1 -0
- package/client/pages/main.ts +25 -0
- package/client/pages/quotation/quotation-importer.ts +97 -0
- package/client/pages/quotation/quotation-list-page.ts +348 -0
- package/client/reducers/main.ts +17 -0
- package/client/route.ts +11 -0
- package/client/tsconfig.json +11 -0
- package/dist-client/actions/main.d.ts +1 -0
- package/dist-client/actions/main.js +2 -0
- package/dist-client/actions/main.js.map +1 -0
- package/dist-client/activities/activity-quotation-edit.d.ts +14 -0
- package/dist-client/activities/activity-quotation-edit.js +87 -0
- package/dist-client/activities/activity-quotation-edit.js.map +1 -0
- package/dist-client/activities/activity-quotation-view.d.ts +14 -0
- package/dist-client/activities/activity-quotation-view.js +87 -0
- package/dist-client/activities/activity-quotation-view.js.map +1 -0
- package/dist-client/bootstrap.d.ts +1 -0
- package/dist-client/bootstrap.js +8 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/index.d.ts +1 -0
- package/dist-client/index.js +2 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/main.d.ts +1 -0
- package/dist-client/pages/main.js +27 -0
- package/dist-client/pages/main.js.map +1 -0
- package/dist-client/pages/quotation/quotation-importer.d.ts +22 -0
- package/dist-client/pages/quotation/quotation-importer.js +100 -0
- package/dist-client/pages/quotation/quotation-importer.js.map +1 -0
- package/dist-client/pages/quotation/quotation-list-page.d.ts +62 -0
- package/dist-client/pages/quotation/quotation-list-page.js +326 -0
- package/dist-client/pages/quotation/quotation-list-page.js.map +1 -0
- package/dist-client/reducers/main.d.ts +6 -0
- package/dist-client/reducers/main.js +14 -0
- package/dist-client/reducers/main.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +11 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/activities/activity-quotation.js +113 -0
- package/dist-server/activities/activity-quotation.js.map +1 -0
- package/dist-server/activities/index.js +17 -0
- package/dist-server/activities/index.js.map +1 -0
- package/dist-server/controllers/index.js +1 -0
- package/dist-server/controllers/index.js.map +1 -0
- package/dist-server/index.js +7 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/middlewares/index.js +8 -0
- package/dist-server/middlewares/index.js.map +1 -0
- package/dist-server/migrations/index.js +12 -0
- package/dist-server/migrations/index.js.map +1 -0
- package/dist-server/routes.js +25 -0
- package/dist-server/routes.js.map +1 -0
- package/dist-server/service/index.js +23 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/quotation/event-subscriber.js +21 -0
- package/dist-server/service/quotation/event-subscriber.js.map +1 -0
- package/dist-server/service/quotation/index.js +12 -0
- package/dist-server/service/quotation/index.js.map +1 -0
- package/dist-server/service/quotation/quotation-history.js +123 -0
- package/dist-server/service/quotation/quotation-history.js.map +1 -0
- package/dist-server/service/quotation/quotation-mutation.js +168 -0
- package/dist-server/service/quotation/quotation-mutation.js.map +1 -0
- package/dist-server/service/quotation/quotation-query.js +97 -0
- package/dist-server/service/quotation/quotation-query.js.map +1 -0
- package/dist-server/service/quotation/quotation-type.js +86 -0
- package/dist-server/service/quotation/quotation-type.js.map +1 -0
- package/dist-server/service/quotation/quotation.js +110 -0
- package/dist-server/service/quotation/quotation.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/helps/quotation/quotation.md +160 -0
- package/package.json +36 -0
- package/server/activities/activity-quotation.ts +112 -0
- package/server/activities/index.ts +17 -0
- package/server/controllers/index.ts +0 -0
- package/server/index.ts +4 -0
- package/server/middlewares/index.ts +3 -0
- package/server/migrations/index.ts +9 -0
- package/server/routes.ts +28 -0
- package/server/service/index.ts +22 -0
- package/server/service/quotation/event-subscriber.ts +17 -0
- package/server/service/quotation/index.ts +9 -0
- package/server/service/quotation/quotation-history.ts +110 -0
- package/server/service/quotation/quotation-mutation.ts +198 -0
- package/server/service/quotation/quotation-query.ts +62 -0
- package/server/service/quotation/quotation-type.ts +61 -0
- package/server/service/quotation/quotation.ts +95 -0
- package/server/tsconfig.json +10 -0
- package/things-factory.config.js +11 -0
- package/translations/en.json +1 -0
- package/translations/ko.json +1 -0
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuotationHistory = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const typeorm_1 = require("typeorm");
|
|
7
|
+
const typeorm_history_1 = require("@operato/typeorm-history");
|
|
8
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
9
|
+
const env_1 = require("@things-factory/env");
|
|
10
|
+
const shell_1 = require("@things-factory/shell");
|
|
11
|
+
const quotation_1 = require("./quotation");
|
|
12
|
+
const ORMCONFIG = env_1.config.get('ormconfig', {});
|
|
13
|
+
const DATABASE_TYPE = ORMCONFIG.type;
|
|
14
|
+
let QuotationHistory = class QuotationHistory {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.version = 1;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
tslib_1.__decorate([
|
|
20
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
21
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
22
|
+
tslib_1.__metadata("design:type", String)
|
|
23
|
+
], QuotationHistory.prototype, "id", void 0);
|
|
24
|
+
tslib_1.__decorate([
|
|
25
|
+
(0, typeorm_1.Column)({ nullable: true, default: 1 }),
|
|
26
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
27
|
+
tslib_1.__metadata("design:type", Number)
|
|
28
|
+
], QuotationHistory.prototype, "version", void 0);
|
|
29
|
+
tslib_1.__decorate([
|
|
30
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
31
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
32
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
33
|
+
], QuotationHistory.prototype, "domain", void 0);
|
|
34
|
+
tslib_1.__decorate([
|
|
35
|
+
(0, typeorm_1.RelationId)((quotation) => quotation.domain),
|
|
36
|
+
tslib_1.__metadata("design:type", String)
|
|
37
|
+
], QuotationHistory.prototype, "domainId", void 0);
|
|
38
|
+
tslib_1.__decorate([
|
|
39
|
+
(0, typeorm_1.Column)(),
|
|
40
|
+
(0, type_graphql_1.Field)(),
|
|
41
|
+
tslib_1.__metadata("design:type", String)
|
|
42
|
+
], QuotationHistory.prototype, "name", void 0);
|
|
43
|
+
tslib_1.__decorate([
|
|
44
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
45
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
46
|
+
tslib_1.__metadata("design:type", String)
|
|
47
|
+
], QuotationHistory.prototype, "description", void 0);
|
|
48
|
+
tslib_1.__decorate([
|
|
49
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
50
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
51
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
52
|
+
], QuotationHistory.prototype, "active", void 0);
|
|
53
|
+
tslib_1.__decorate([
|
|
54
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
55
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
56
|
+
tslib_1.__metadata("design:type", String)
|
|
57
|
+
], QuotationHistory.prototype, "state", void 0);
|
|
58
|
+
tslib_1.__decorate([
|
|
59
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
60
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
61
|
+
tslib_1.__metadata("design:type", String)
|
|
62
|
+
], QuotationHistory.prototype, "params", void 0);
|
|
63
|
+
tslib_1.__decorate([
|
|
64
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
65
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
66
|
+
tslib_1.__metadata("design:type", Date)
|
|
67
|
+
], QuotationHistory.prototype, "createdAt", void 0);
|
|
68
|
+
tslib_1.__decorate([
|
|
69
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
70
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
71
|
+
tslib_1.__metadata("design:type", Date)
|
|
72
|
+
], QuotationHistory.prototype, "updatedAt", void 0);
|
|
73
|
+
tslib_1.__decorate([
|
|
74
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
75
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
76
|
+
tslib_1.__metadata("design:type", Date)
|
|
77
|
+
], QuotationHistory.prototype, "deletedAt", void 0);
|
|
78
|
+
tslib_1.__decorate([
|
|
79
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
80
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
81
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
82
|
+
], QuotationHistory.prototype, "creator", void 0);
|
|
83
|
+
tslib_1.__decorate([
|
|
84
|
+
(0, typeorm_1.RelationId)((quotation) => quotation.creator),
|
|
85
|
+
tslib_1.__metadata("design:type", String)
|
|
86
|
+
], QuotationHistory.prototype, "creatorId", void 0);
|
|
87
|
+
tslib_1.__decorate([
|
|
88
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
89
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
90
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
91
|
+
], QuotationHistory.prototype, "updater", void 0);
|
|
92
|
+
tslib_1.__decorate([
|
|
93
|
+
(0, typeorm_1.RelationId)((quotation) => quotation.updater),
|
|
94
|
+
tslib_1.__metadata("design:type", String)
|
|
95
|
+
], QuotationHistory.prototype, "updaterId", void 0);
|
|
96
|
+
tslib_1.__decorate([
|
|
97
|
+
(0, type_graphql_1.Field)(type => String, { nullable: true }),
|
|
98
|
+
tslib_1.__metadata("design:type", String)
|
|
99
|
+
], QuotationHistory.prototype, "thumbnail", void 0);
|
|
100
|
+
tslib_1.__decorate([
|
|
101
|
+
(0, typeorm_history_1.HistoryOriginalIdColumn)(),
|
|
102
|
+
tslib_1.__metadata("design:type", String)
|
|
103
|
+
], QuotationHistory.prototype, "originalId", void 0);
|
|
104
|
+
tslib_1.__decorate([
|
|
105
|
+
(0, typeorm_history_1.HistoryActionColumn)({
|
|
106
|
+
nullable: false,
|
|
107
|
+
type: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
|
108
|
+
? 'enum'
|
|
109
|
+
: DATABASE_TYPE == 'oracle'
|
|
110
|
+
? 'varchar2'
|
|
111
|
+
: 'smallint',
|
|
112
|
+
enum: typeorm_history_1.HistoryActionType
|
|
113
|
+
}),
|
|
114
|
+
tslib_1.__metadata("design:type", String)
|
|
115
|
+
], QuotationHistory.prototype, "action", void 0);
|
|
116
|
+
QuotationHistory = tslib_1.__decorate([
|
|
117
|
+
(0, typeorm_1.Entity)(),
|
|
118
|
+
(0, typeorm_1.Index)('ix_quotation_history_0', (quotationHistory) => [quotationHistory.originalId, quotationHistory.version], { unique: true }),
|
|
119
|
+
(0, typeorm_1.Index)('ix_quotation_history_1', (quotationHistory) => [quotationHistory.domain, quotationHistory.originalId, quotationHistory.version], { unique: true }),
|
|
120
|
+
(0, type_graphql_1.ObjectType)({ description: 'History Entity of Quotation' })
|
|
121
|
+
], QuotationHistory);
|
|
122
|
+
exports.QuotationHistory = QuotationHistory;
|
|
123
|
+
//# sourceMappingURL=quotation-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quotation-history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AAC;sCAChB,gBAAI;iDAAA;AAEd;IAAC,IAAA,oBAAU,EAAC,CAAC,SAAoB,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC;;mDACtC;AAElB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACxB;AAElB;IAAC,IAAA,yCAAuB,GAAE;;oDACA;AAE1B;IAAC,IAAA,qCAAmB,EAAC;QACnB,QAAQ,EAAE,KAAK;QACf,IAAI,EACF,aAAa,IAAI,UAAU,IAAI,aAAa,IAAI,OAAO,IAAI,aAAa,IAAI,SAAS;YACnF,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,aAAa,IAAI,QAAQ;gBAC3B,CAAC,CAAC,UAAU;gBACZ,CAAC,CAAC,UAAU;QAChB,IAAI,EAAE,mCAAiB;KACxB,CAAC;;gDAC+B;AA9EtB,gBAAgB;IAZ5B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,wBAAwB,EACxB,CAAC,gBAAkC,EAAE,EAAE,CAAC,CAAC,gBAAgB,CAAC,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAC/F,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,eAAK,EACJ,wBAAwB,EACxB,CAAC,gBAAkC,EAAE,EAAE,CAAC,CAAC,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,CAAC,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,EACxH,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;GAC9C,gBAAgB,CA+E5B;AA/EY,4CAAgB","sourcesContent":["import { Field, ID, ObjectType } from 'type-graphql'\nimport { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'\n\nimport {\n HistoryActionColumn,\n HistoryActionType,\n HistoryEntityInterface,\n HistoryOriginalIdColumn\n} from '@operato/typeorm-history'\nimport { Role, User } from '@things-factory/auth-base'\nimport { config } from '@things-factory/env'\nimport { Domain } from '@things-factory/shell'\n\nimport { Quotation, QuotationStatus } from './quotation'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\n@Entity()\n@Index(\n 'ix_quotation_history_0',\n (quotationHistory: QuotationHistory) => [quotationHistory.originalId, quotationHistory.version],\n { unique: true }\n)\n@Index(\n 'ix_quotation_history_1',\n (quotationHistory: QuotationHistory) => [quotationHistory.domain, quotationHistory.originalId, quotationHistory.version],\n { unique: true }\n)\n@ObjectType({ description: 'History Entity of Quotation' })\nexport class QuotationHistory implements HistoryEntityInterface<Quotation> {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Column({ nullable: true, default: 1 })\n @Field({ nullable: true })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((quotation: Quotation) => quotation.domain)\n domainId?: string\n\n @Column()\n @Field()\n name: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n active?: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n state?: QuotationStatus\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n params?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n createdAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n updatedAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n creator?: User\n\n @RelationId((quotation: Quotation) => quotation.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n updater?: User\n\n @RelationId((quotation: Quotation) => quotation.updater)\n updaterId?: string\n\n @Field(type => String, { nullable: true })\n thumbnail?: string\n\n @HistoryOriginalIdColumn()\n public originalId!: string\n\n @HistoryActionColumn({\n nullable: false,\n type:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'enum'\n : DATABASE_TYPE == 'oracle'\n ? 'varchar2'\n : 'smallint',\n enum: HistoryActionType\n })\n public action!: HistoryActionType\n}\n"]}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuotationMutation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const typeorm_1 = require("typeorm");
|
|
7
|
+
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
8
|
+
const quotation_1 = require("./quotation");
|
|
9
|
+
const quotation_type_1 = require("./quotation-type");
|
|
10
|
+
let QuotationMutation = class QuotationMutation {
|
|
11
|
+
async createQuotation(quotation, context) {
|
|
12
|
+
const { domain, user, tx } = context.state;
|
|
13
|
+
const result = await tx.getRepository(quotation_1.Quotation).save(Object.assign(Object.assign({}, quotation), { domain, creator: user, updater: user }));
|
|
14
|
+
if (quotation.thumbnail) {
|
|
15
|
+
await (0, attachment_base_1.createAttachment)(null, {
|
|
16
|
+
attachment: {
|
|
17
|
+
file: quotation.thumbnail,
|
|
18
|
+
refType: quotation_1.Quotation.name,
|
|
19
|
+
refBy: result.id
|
|
20
|
+
}
|
|
21
|
+
}, context);
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
async updateQuotation(id, patch, context) {
|
|
26
|
+
const { domain, user, tx } = context.state;
|
|
27
|
+
const repository = tx.getRepository(quotation_1.Quotation);
|
|
28
|
+
const quotation = await repository.findOne({
|
|
29
|
+
where: { domain: { id: domain.id }, id }
|
|
30
|
+
});
|
|
31
|
+
const result = await repository.save(Object.assign(Object.assign(Object.assign({}, quotation), patch), { updater: user }));
|
|
32
|
+
if (patch.thumbnail) {
|
|
33
|
+
await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [result.id] }, context);
|
|
34
|
+
await (0, attachment_base_1.createAttachment)(null, {
|
|
35
|
+
attachment: {
|
|
36
|
+
file: patch.thumbnail,
|
|
37
|
+
refType: quotation_1.Quotation.name,
|
|
38
|
+
refBy: result.id
|
|
39
|
+
}
|
|
40
|
+
}, context);
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
async updateMultipleQuotation(patches, context) {
|
|
45
|
+
const { domain, user, tx } = context.state;
|
|
46
|
+
let results = [];
|
|
47
|
+
const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
|
|
48
|
+
const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
|
|
49
|
+
const quotationRepo = tx.getRepository(quotation_1.Quotation);
|
|
50
|
+
if (_createRecords.length > 0) {
|
|
51
|
+
for (let i = 0; i < _createRecords.length; i++) {
|
|
52
|
+
const newRecord = _createRecords[i];
|
|
53
|
+
const result = await quotationRepo.save(Object.assign(Object.assign({}, newRecord), { domain, creator: user, updater: user }));
|
|
54
|
+
if (newRecord.thumbnail) {
|
|
55
|
+
await (0, attachment_base_1.createAttachment)(null, {
|
|
56
|
+
attachment: {
|
|
57
|
+
file: newRecord.thumbnail,
|
|
58
|
+
refType: quotation_1.Quotation.name,
|
|
59
|
+
refBy: result.id
|
|
60
|
+
}
|
|
61
|
+
}, context);
|
|
62
|
+
}
|
|
63
|
+
results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (_updateRecords.length > 0) {
|
|
67
|
+
for (let i = 0; i < _updateRecords.length; i++) {
|
|
68
|
+
const updateRecord = _updateRecords[i];
|
|
69
|
+
const quotation = await quotationRepo.findOneBy({ id: updateRecord.id });
|
|
70
|
+
const result = await quotationRepo.save(Object.assign(Object.assign(Object.assign({}, quotation), updateRecord), { updater: user }));
|
|
71
|
+
if (updateRecord.thumbnail) {
|
|
72
|
+
await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [result.id] }, context);
|
|
73
|
+
await (0, attachment_base_1.createAttachment)(null, {
|
|
74
|
+
attachment: {
|
|
75
|
+
file: updateRecord.thumbnail,
|
|
76
|
+
refType: quotation_1.Quotation.name,
|
|
77
|
+
refBy: result.id
|
|
78
|
+
}
|
|
79
|
+
}, context);
|
|
80
|
+
}
|
|
81
|
+
results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return results;
|
|
85
|
+
}
|
|
86
|
+
async deleteQuotation(id, context) {
|
|
87
|
+
const { domain, tx } = context.state;
|
|
88
|
+
await tx.getRepository(quotation_1.Quotation).delete({ domain: { id: domain.id }, id });
|
|
89
|
+
await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: [id] }, context);
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
async deleteQuotations(ids, context) {
|
|
93
|
+
const { domain, tx } = context.state;
|
|
94
|
+
await tx.getRepository(quotation_1.Quotation).delete({
|
|
95
|
+
domain: { id: domain.id },
|
|
96
|
+
id: (0, typeorm_1.In)(ids)
|
|
97
|
+
});
|
|
98
|
+
await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: ids }, context);
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
async importQuotations(quotations, context) {
|
|
102
|
+
const { domain, tx } = context.state;
|
|
103
|
+
await Promise.all(quotations.map(async (quotation) => {
|
|
104
|
+
const createdQuotation = await tx.getRepository(quotation_1.Quotation).save(Object.assign({ domain }, quotation));
|
|
105
|
+
}));
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
tslib_1.__decorate([
|
|
110
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
111
|
+
(0, type_graphql_1.Mutation)(returns => quotation_1.Quotation, { description: 'To create new Quotation' }),
|
|
112
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('quotation')),
|
|
113
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
114
|
+
tslib_1.__metadata("design:type", Function),
|
|
115
|
+
tslib_1.__metadata("design:paramtypes", [quotation_type_1.NewQuotation, Object]),
|
|
116
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
117
|
+
], QuotationMutation.prototype, "createQuotation", null);
|
|
118
|
+
tslib_1.__decorate([
|
|
119
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
120
|
+
(0, type_graphql_1.Mutation)(returns => quotation_1.Quotation, { description: 'To modify Quotation information' }),
|
|
121
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
122
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
123
|
+
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
|
124
|
+
tslib_1.__metadata("design:type", Function),
|
|
125
|
+
tslib_1.__metadata("design:paramtypes", [String, quotation_type_1.QuotationPatch, Object]),
|
|
126
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
127
|
+
], QuotationMutation.prototype, "updateQuotation", null);
|
|
128
|
+
tslib_1.__decorate([
|
|
129
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
130
|
+
(0, type_graphql_1.Mutation)(returns => [quotation_1.Quotation], { description: "To modify multiple Quotations' information" }),
|
|
131
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [quotation_type_1.QuotationPatch])),
|
|
132
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
133
|
+
tslib_1.__metadata("design:type", Function),
|
|
134
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
135
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
136
|
+
], QuotationMutation.prototype, "updateMultipleQuotation", null);
|
|
137
|
+
tslib_1.__decorate([
|
|
138
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
139
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete Quotation' }),
|
|
140
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
141
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
142
|
+
tslib_1.__metadata("design:type", Function),
|
|
143
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
144
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
145
|
+
], QuotationMutation.prototype, "deleteQuotation", null);
|
|
146
|
+
tslib_1.__decorate([
|
|
147
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
148
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple Quotations' }),
|
|
149
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
|
150
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
151
|
+
tslib_1.__metadata("design:type", Function),
|
|
152
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
153
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
154
|
+
], QuotationMutation.prototype, "deleteQuotations", null);
|
|
155
|
+
tslib_1.__decorate([
|
|
156
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
157
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple Quotations' }),
|
|
158
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('quotations', type => [quotation_type_1.QuotationPatch])),
|
|
159
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
160
|
+
tslib_1.__metadata("design:type", Function),
|
|
161
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
162
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
163
|
+
], QuotationMutation.prototype, "importQuotations", null);
|
|
164
|
+
QuotationMutation = tslib_1.__decorate([
|
|
165
|
+
(0, type_graphql_1.Resolver)(quotation_1.Quotation)
|
|
166
|
+
], QuotationMutation);
|
|
167
|
+
exports.QuotationMutation = QuotationMutation;
|
|
168
|
+
//# 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,+CAAsE;AACtE,qCAA4B;AAE5B,qEAA0F;AAE1F,2CAAuC;AACvC,qDAA+D;AAGxD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAGtB,AAAN,KAAK,CAAC,eAAe,CAAmB,SAAuB,EAAS,OAAwB;QAC9F,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,qBAAS,CAAC,CAAC,IAAI,iCAChD,SAAS,KACZ,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;QAEF,IAAI,SAAS,CAAC,SAAS,EAAE;YACvB,MAAM,IAAA,kCAAgB,EACpB,IAAI,EACJ;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,SAAS,CAAC,SAAS;oBACzB,OAAO,EAAE,qBAAS,CAAC,IAAI;oBACvB,KAAK,EAAE,MAAM,CAAC,EAAE;iBACjB;aACF,EACD,OAAO,CACR,CAAA;SACF;QAED,OAAO,MAAM,CAAA;IACf,CAAC;IAIK,AAAN,KAAK,CAAC,eAAe,CACR,EAAU,EACP,KAAqB,EAC5B,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,qBAAS,CAAC,CAAA;QAC9C,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC;YACzC,KAAK,EAAE,EAAE,MAAM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BAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;wDAOlD;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IAE5E,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;yDAYP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IAE5E,mBAAA,IAAA,kBAAG,EAAC,YAAY,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,+BAAc,CAAC,CAAC,CAAA;IAC3C,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;yDAWP;AA3LU,iBAAiB;IAD7B,IAAA,uBAAQ,EAAC,qBAAS,CAAC;GACP,iBAAiB,CA4L7B;AA5LY,8CAAiB","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'\n\nimport { Quotation } from './quotation'\nimport { NewQuotation, QuotationPatch } from './quotation-type'\n\n@Resolver(Quotation)\nexport class QuotationMutation {\n @Directive('@transaction')\n @Mutation(returns => Quotation, { description: 'To create new Quotation' })\n async createQuotation(@Arg('quotation') quotation: NewQuotation, @Ctx() context: ResolverContext): Promise<Quotation> {\n const { domain, user, tx } = context.state\n\n const result = await tx.getRepository(Quotation).save({\n ...quotation,\n domain,\n creator: user,\n updater: user\n })\n\n if (quotation.thumbnail) {\n await createAttachment(\n null,\n {\n attachment: {\n file: quotation.thumbnail,\n refType: Quotation.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => Quotation, { description: 'To modify Quotation information' })\n async updateQuotation(\n @Arg('id') id: string,\n @Arg('patch') patch: QuotationPatch,\n @Ctx() context: ResolverContext\n ): Promise<Quotation> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(Quotation)\n const quotation = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...quotation,\n ...patch,\n updater: user\n })\n\n if (patch.thumbnail) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: patch.thumbnail,\n refType: Quotation.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [Quotation], { description: \"To modify multiple Quotations' information\" })\n async updateMultipleQuotation(\n @Arg('patches', type => [QuotationPatch]) patches: QuotationPatch[],\n @Ctx() context: ResolverContext\n ): Promise<Quotation[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const quotationRepo = tx.getRepository(Quotation)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await quotationRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n if (newRecord.thumbnail) {\n await createAttachment(\n null,\n {\n attachment: {\n file: newRecord.thumbnail,\n refType: Quotation.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n const quotation = await quotationRepo.findOneBy({ id: updateRecord.id })\n\n const result = await quotationRepo.save({\n ...quotation,\n ...updateRecord,\n updater: user\n })\n\n if (updateRecord.thumbnail) {\n await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)\n await createAttachment(\n null,\n {\n attachment: {\n file: updateRecord.thumbnail,\n refType: Quotation.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete Quotation' })\n async deleteQuotation(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Quotation).delete({ domain: { id: domain.id }, id })\n await deleteAttachmentsByRef(null, { refBys: [id] }, context)\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple Quotations' })\n async deleteQuotations(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Quotation).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n await deleteAttachmentsByRef(null, { refBys: ids }, context)\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple Quotations' })\n async importQuotations(\n @Arg('quotations', type => [QuotationPatch]) quotations: QuotationPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n quotations.map(async (quotation: QuotationPatch) => {\n const createdQuotation: Quotation = await tx.getRepository(Quotation).save({ domain, ...quotation })\n })\n )\n\n return true\n }\n}\n"]}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuotationQuery = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
7
|
+
const shell_1 = require("@things-factory/shell");
|
|
8
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
9
|
+
const quotation_1 = require("./quotation");
|
|
10
|
+
const quotation_type_1 = require("./quotation-type");
|
|
11
|
+
let QuotationQuery = class QuotationQuery {
|
|
12
|
+
async quotation(id, context) {
|
|
13
|
+
const { domain } = context.state;
|
|
14
|
+
return await (0, shell_1.getRepository)(quotation_1.Quotation).findOne({
|
|
15
|
+
where: { domain: { id: domain.id }, id }
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
async quotations(params, context) {
|
|
19
|
+
const { domain } = context.state;
|
|
20
|
+
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
21
|
+
domain,
|
|
22
|
+
params,
|
|
23
|
+
repository: await (0, shell_1.getRepository)(quotation_1.Quotation),
|
|
24
|
+
searchables: ['name', 'description']
|
|
25
|
+
});
|
|
26
|
+
const [items, total] = await queryBuilder.getManyAndCount();
|
|
27
|
+
return { items, total };
|
|
28
|
+
}
|
|
29
|
+
async thumbnail(quotation) {
|
|
30
|
+
const attachment = await (0, shell_1.getRepository)(attachment_base_1.Attachment).findOne({
|
|
31
|
+
where: {
|
|
32
|
+
domain: { id: quotation.domainId },
|
|
33
|
+
refType: quotation_1.Quotation.name,
|
|
34
|
+
refBy: quotation.id
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return attachment === null || attachment === void 0 ? void 0 : attachment.fullpath;
|
|
38
|
+
}
|
|
39
|
+
async domain(quotation) {
|
|
40
|
+
return await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: quotation.domainId });
|
|
41
|
+
}
|
|
42
|
+
async updater(quotation) {
|
|
43
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: quotation.updaterId });
|
|
44
|
+
}
|
|
45
|
+
async creator(quotation) {
|
|
46
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: quotation.creatorId });
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
tslib_1.__decorate([
|
|
50
|
+
(0, type_graphql_1.Query)(returns => quotation_1.Quotation, { nullable: true, description: 'To fetch a Quotation' }),
|
|
51
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
52
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
53
|
+
tslib_1.__metadata("design:type", Function),
|
|
54
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
55
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
56
|
+
], QuotationQuery.prototype, "quotation", null);
|
|
57
|
+
tslib_1.__decorate([
|
|
58
|
+
(0, type_graphql_1.Query)(returns => quotation_type_1.QuotationList, { description: 'To fetch multiple Quotations' }),
|
|
59
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
60
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
61
|
+
tslib_1.__metadata("design:type", Function),
|
|
62
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
63
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
64
|
+
], QuotationQuery.prototype, "quotations", null);
|
|
65
|
+
tslib_1.__decorate([
|
|
66
|
+
(0, type_graphql_1.FieldResolver)(type => String),
|
|
67
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
68
|
+
tslib_1.__metadata("design:type", Function),
|
|
69
|
+
tslib_1.__metadata("design:paramtypes", [quotation_1.Quotation]),
|
|
70
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
71
|
+
], QuotationQuery.prototype, "thumbnail", null);
|
|
72
|
+
tslib_1.__decorate([
|
|
73
|
+
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
|
|
74
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
75
|
+
tslib_1.__metadata("design:type", Function),
|
|
76
|
+
tslib_1.__metadata("design:paramtypes", [quotation_1.Quotation]),
|
|
77
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
78
|
+
], QuotationQuery.prototype, "domain", null);
|
|
79
|
+
tslib_1.__decorate([
|
|
80
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
81
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
82
|
+
tslib_1.__metadata("design:type", Function),
|
|
83
|
+
tslib_1.__metadata("design:paramtypes", [quotation_1.Quotation]),
|
|
84
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
85
|
+
], QuotationQuery.prototype, "updater", null);
|
|
86
|
+
tslib_1.__decorate([
|
|
87
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
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, "creator", null);
|
|
93
|
+
QuotationQuery = tslib_1.__decorate([
|
|
94
|
+
(0, type_graphql_1.Resolver)(quotation_1.Quotation)
|
|
95
|
+
], QuotationQuery);
|
|
96
|
+
exports.QuotationQuery = QuotationQuery;
|
|
97
|
+
//# 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,+CAA8F;AAC9F,qEAA4D;AAC5D,iDAAuG;AACvG,yDAAgD;AAChD,2CAAuC;AACvC,qDAAgD;AAGzC,IAAM,cAAc,GAApB,MAAM,cAAc;IAEnB,AAAN,KAAK,CAAC,SAAS,CAAY,EAAU,EAAS,OAAwB;QACpE,MAAM,EAAE,MAAM,EAAE,GAAG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AAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAY,qBAAS;;6CAEzC;AApDU,cAAc;IAD1B,IAAA,uBAAQ,EAAC,qBAAS,CAAC;GACP,cAAc,CAqD1B;AArDY,wCAAc","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Attachment } from '@things-factory/attachment-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Quotation } from './quotation'\nimport { QuotationList } from './quotation-type'\n\n@Resolver(Quotation)\nexport class QuotationQuery {\n @Query(returns => Quotation!, { nullable: true, description: 'To fetch a Quotation' })\n async quotation(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Quotation> {\n const { domain } = context.state\n\n return await getRepository(Quotation).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => QuotationList, { description: 'To fetch multiple Quotations' })\n async quotations(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<QuotationList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(Quotation),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => String)\n async thumbnail(@Root() quotation: Quotation): Promise<string | undefined> {\n const attachment: Attachment = await getRepository(Attachment).findOne({\n where: {\n domain: { id: quotation.domainId },\n refType: Quotation.name,\n refBy: quotation.id\n }\n })\n\n return attachment?.fullpath\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() quotation: Quotation): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: quotation.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() quotation: Quotation): Promise<User> {\n return await getRepository(User).findOneBy({ id: quotation.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() quotation: Quotation): Promise<User> {\n return await getRepository(User).findOneBy({ id: quotation.creatorId })\n }\n}\n"]}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuotationList = exports.QuotationPatch = exports.NewQuotation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const GraphQLUpload_js_1 = tslib_1.__importDefault(require("graphql-upload/GraphQLUpload.js"));
|
|
6
|
+
const type_graphql_1 = require("type-graphql");
|
|
7
|
+
const quotation_1 = require("./quotation");
|
|
8
|
+
let NewQuotation = class NewQuotation {
|
|
9
|
+
};
|
|
10
|
+
tslib_1.__decorate([
|
|
11
|
+
(0, type_graphql_1.Field)(),
|
|
12
|
+
tslib_1.__metadata("design:type", String)
|
|
13
|
+
], NewQuotation.prototype, "name", void 0);
|
|
14
|
+
tslib_1.__decorate([
|
|
15
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
16
|
+
tslib_1.__metadata("design:type", String)
|
|
17
|
+
], NewQuotation.prototype, "description", void 0);
|
|
18
|
+
tslib_1.__decorate([
|
|
19
|
+
(0, type_graphql_1.Field)(type => quotation_1.QuotationStatus, { nullable: true }),
|
|
20
|
+
tslib_1.__metadata("design:type", String)
|
|
21
|
+
], NewQuotation.prototype, "state", void 0);
|
|
22
|
+
tslib_1.__decorate([
|
|
23
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
24
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
25
|
+
], NewQuotation.prototype, "active", void 0);
|
|
26
|
+
tslib_1.__decorate([
|
|
27
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
28
|
+
tslib_1.__metadata("design:type", String)
|
|
29
|
+
], NewQuotation.prototype, "params", void 0);
|
|
30
|
+
tslib_1.__decorate([
|
|
31
|
+
(0, type_graphql_1.Field)(type => GraphQLUpload_js_1.default, { nullable: true }),
|
|
32
|
+
tslib_1.__metadata("design:type", Object)
|
|
33
|
+
], NewQuotation.prototype, "thumbnail", void 0);
|
|
34
|
+
NewQuotation = tslib_1.__decorate([
|
|
35
|
+
(0, type_graphql_1.InputType)()
|
|
36
|
+
], NewQuotation);
|
|
37
|
+
exports.NewQuotation = NewQuotation;
|
|
38
|
+
let QuotationPatch = class QuotationPatch {
|
|
39
|
+
};
|
|
40
|
+
tslib_1.__decorate([
|
|
41
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
|
|
42
|
+
tslib_1.__metadata("design:type", String)
|
|
43
|
+
], QuotationPatch.prototype, "id", void 0);
|
|
44
|
+
tslib_1.__decorate([
|
|
45
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
46
|
+
tslib_1.__metadata("design:type", String)
|
|
47
|
+
], QuotationPatch.prototype, "name", void 0);
|
|
48
|
+
tslib_1.__decorate([
|
|
49
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
50
|
+
tslib_1.__metadata("design:type", String)
|
|
51
|
+
], QuotationPatch.prototype, "description", void 0);
|
|
52
|
+
tslib_1.__decorate([
|
|
53
|
+
(0, type_graphql_1.Field)(type => quotation_1.QuotationStatus, { nullable: true }),
|
|
54
|
+
tslib_1.__metadata("design:type", String)
|
|
55
|
+
], QuotationPatch.prototype, "state", void 0);
|
|
56
|
+
tslib_1.__decorate([
|
|
57
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
58
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
59
|
+
], QuotationPatch.prototype, "active", void 0);
|
|
60
|
+
tslib_1.__decorate([
|
|
61
|
+
(0, type_graphql_1.Field)(type => GraphQLUpload_js_1.default, { nullable: true }),
|
|
62
|
+
tslib_1.__metadata("design:type", Object)
|
|
63
|
+
], QuotationPatch.prototype, "thumbnail", void 0);
|
|
64
|
+
tslib_1.__decorate([
|
|
65
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
66
|
+
tslib_1.__metadata("design:type", String)
|
|
67
|
+
], QuotationPatch.prototype, "cuFlag", void 0);
|
|
68
|
+
QuotationPatch = tslib_1.__decorate([
|
|
69
|
+
(0, type_graphql_1.InputType)()
|
|
70
|
+
], QuotationPatch);
|
|
71
|
+
exports.QuotationPatch = QuotationPatch;
|
|
72
|
+
let QuotationList = class QuotationList {
|
|
73
|
+
};
|
|
74
|
+
tslib_1.__decorate([
|
|
75
|
+
(0, type_graphql_1.Field)(type => [quotation_1.Quotation]),
|
|
76
|
+
tslib_1.__metadata("design:type", Array)
|
|
77
|
+
], QuotationList.prototype, "items", void 0);
|
|
78
|
+
tslib_1.__decorate([
|
|
79
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
80
|
+
tslib_1.__metadata("design:type", Number)
|
|
81
|
+
], QuotationList.prototype, "total", void 0);
|
|
82
|
+
QuotationList = tslib_1.__decorate([
|
|
83
|
+
(0, type_graphql_1.ObjectType)()
|
|
84
|
+
], QuotationList);
|
|
85
|
+
exports.QuotationList = QuotationList;
|
|
86
|
+
//# sourceMappingURL=quotation-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quotation-type.js","sourceRoot":"","sources":["../../../server/service/quotation/quotation-type.ts"],"names":[],"mappings":";;;;AACA,+FAA2D;AAC3D,+CAAsF;AAItF,2CAAwD;AAGjD,IAAM,YAAY,GAAlB,MAAM,YAAY;CAkBxB,CAAA;AAjBC;IAAC,IAAA,oBAAK,GAAE;;0CACI;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,2BAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CAC5B;AAEvB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAA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,aAAa,CAMzB;AANY,sCAAa","sourcesContent":["import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'\nimport GraphQLUpload from 'graphql-upload/GraphQLUpload.js'\nimport { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'\n\nimport { ObjectRef, ScalarObject } from '@things-factory/shell'\n\nimport { Quotation, QuotationStatus } from './quotation'\n\n@InputType()\nexport class NewQuotation {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => QuotationStatus, { nullable: true })\n state?: QuotationStatus\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field({ nullable: true })\n params?: string\n\n @Field(type => GraphQLUpload, { nullable: true })\n thumbnail?: FileUpload\n}\n\n@InputType()\nexport class QuotationPatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => QuotationStatus, { nullable: true })\n state?: QuotationStatus\n\n @Field({ nullable: true })\n active?: boolean\n\n @Field(type => GraphQLUpload, { nullable: true })\n thumbnail?: FileUpload\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class QuotationList {\n @Field(type => [Quotation])\n items: Quotation[]\n\n @Field(type => Int)\n total: number\n}\n"]}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Quotation = exports.QuotationStatus = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const typeorm_1 = require("typeorm");
|
|
6
|
+
const type_graphql_1 = require("type-graphql");
|
|
7
|
+
const shell_1 = require("@things-factory/shell");
|
|
8
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
9
|
+
var QuotationStatus;
|
|
10
|
+
(function (QuotationStatus) {
|
|
11
|
+
QuotationStatus["STATUS_A"] = "STATUS_A";
|
|
12
|
+
QuotationStatus["STATUS_B"] = "STATUS_B";
|
|
13
|
+
})(QuotationStatus = exports.QuotationStatus || (exports.QuotationStatus = {}));
|
|
14
|
+
(0, type_graphql_1.registerEnumType)(QuotationStatus, {
|
|
15
|
+
name: 'QuotationStatus',
|
|
16
|
+
description: 'state enumeration of a quotation'
|
|
17
|
+
});
|
|
18
|
+
let Quotation = class Quotation {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.version = 1;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
tslib_1.__decorate([
|
|
24
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
25
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
26
|
+
tslib_1.__metadata("design:type", String)
|
|
27
|
+
], Quotation.prototype, "id", void 0);
|
|
28
|
+
tslib_1.__decorate([
|
|
29
|
+
(0, typeorm_1.VersionColumn)(),
|
|
30
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
31
|
+
tslib_1.__metadata("design:type", Number)
|
|
32
|
+
], Quotation.prototype, "version", void 0);
|
|
33
|
+
tslib_1.__decorate([
|
|
34
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
35
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
36
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
37
|
+
], Quotation.prototype, "domain", void 0);
|
|
38
|
+
tslib_1.__decorate([
|
|
39
|
+
(0, typeorm_1.RelationId)((quotation) => quotation.domain),
|
|
40
|
+
tslib_1.__metadata("design:type", String)
|
|
41
|
+
], Quotation.prototype, "domainId", void 0);
|
|
42
|
+
tslib_1.__decorate([
|
|
43
|
+
(0, typeorm_1.Column)(),
|
|
44
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
45
|
+
tslib_1.__metadata("design:type", String)
|
|
46
|
+
], Quotation.prototype, "name", void 0);
|
|
47
|
+
tslib_1.__decorate([
|
|
48
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
49
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
50
|
+
tslib_1.__metadata("design:type", String)
|
|
51
|
+
], Quotation.prototype, "description", void 0);
|
|
52
|
+
tslib_1.__decorate([
|
|
53
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
54
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
55
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
56
|
+
], Quotation.prototype, "active", void 0);
|
|
57
|
+
tslib_1.__decorate([
|
|
58
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
59
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
60
|
+
tslib_1.__metadata("design:type", String)
|
|
61
|
+
], Quotation.prototype, "state", void 0);
|
|
62
|
+
tslib_1.__decorate([
|
|
63
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
64
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
65
|
+
tslib_1.__metadata("design:type", String)
|
|
66
|
+
], Quotation.prototype, "params", void 0);
|
|
67
|
+
tslib_1.__decorate([
|
|
68
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
69
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
70
|
+
tslib_1.__metadata("design:type", Date)
|
|
71
|
+
], Quotation.prototype, "createdAt", void 0);
|
|
72
|
+
tslib_1.__decorate([
|
|
73
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
74
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
75
|
+
tslib_1.__metadata("design:type", Date)
|
|
76
|
+
], Quotation.prototype, "updatedAt", void 0);
|
|
77
|
+
tslib_1.__decorate([
|
|
78
|
+
(0, typeorm_1.DeleteDateColumn)(),
|
|
79
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
80
|
+
tslib_1.__metadata("design:type", Date)
|
|
81
|
+
], Quotation.prototype, "deletedAt", void 0);
|
|
82
|
+
tslib_1.__decorate([
|
|
83
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
84
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
85
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
86
|
+
], Quotation.prototype, "creator", void 0);
|
|
87
|
+
tslib_1.__decorate([
|
|
88
|
+
(0, typeorm_1.RelationId)((quotation) => quotation.creator),
|
|
89
|
+
tslib_1.__metadata("design:type", String)
|
|
90
|
+
], Quotation.prototype, "creatorId", void 0);
|
|
91
|
+
tslib_1.__decorate([
|
|
92
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
93
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
94
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
95
|
+
], Quotation.prototype, "updater", void 0);
|
|
96
|
+
tslib_1.__decorate([
|
|
97
|
+
(0, typeorm_1.RelationId)((quotation) => quotation.updater),
|
|
98
|
+
tslib_1.__metadata("design:type", String)
|
|
99
|
+
], Quotation.prototype, "updaterId", void 0);
|
|
100
|
+
tslib_1.__decorate([
|
|
101
|
+
(0, type_graphql_1.Field)(type => String, { nullable: true }),
|
|
102
|
+
tslib_1.__metadata("design:type", String)
|
|
103
|
+
], Quotation.prototype, "thumbnail", void 0);
|
|
104
|
+
Quotation = tslib_1.__decorate([
|
|
105
|
+
(0, typeorm_1.Entity)(),
|
|
106
|
+
(0, typeorm_1.Index)('ix_quotation_0', (quotation) => [quotation.domain, quotation.name, quotation.deletedAt], { unique: true }),
|
|
107
|
+
(0, type_graphql_1.ObjectType)({ description: 'Entity for Quotation' })
|
|
108
|
+
], Quotation);
|
|
109
|
+
exports.Quotation = Quotation;
|
|
110
|
+
//# sourceMappingURL=quotation.js.map
|