@dssp/supervision 1.0.0-alpha.74 → 1.0.0-alpha.77
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/dist-client/pages/building-inspection/building-inspection-list.js +2 -2
- package/dist-client/pages/building-inspection/building-inspection-list.js.map +1 -1
- package/dist-client/pages/building-inspection/building-inspection-management.d.ts +8 -0
- package/dist-client/pages/building-inspection/building-inspection-management.js +297 -45
- package/dist-client/pages/building-inspection/building-inspection-management.js.map +1 -1
- package/dist-client/pages/building-inspection/component/field-document/field-document-constants.d.ts +18 -0
- package/dist-client/pages/building-inspection/component/field-document/field-document-constants.js +630 -0
- package/dist-client/pages/building-inspection/component/field-document/field-document-constants.js.map +1 -0
- package/dist-client/pages/building-inspection/component/field-document/field-document-detail-popup.d.ts +10 -0
- package/dist-client/pages/building-inspection/component/field-document/field-document-detail-popup.js +219 -0
- package/dist-client/pages/building-inspection/component/field-document/field-document-detail-popup.js.map +1 -0
- package/dist-client/pages/building-inspection/component/field-document/field-document-list-panel.d.ts +22 -0
- package/dist-client/pages/building-inspection/component/field-document/field-document-list-panel.js +472 -0
- package/dist-client/pages/building-inspection/component/field-document/field-document-list-panel.js.map +1 -0
- package/dist-client/pages/building-inspection/component/field-document/field-document-popup.d.ts +38 -0
- package/dist-client/pages/building-inspection/component/field-document/field-document-popup.js +651 -0
- package/dist-client/pages/building-inspection/component/field-document/field-document-popup.js.map +1 -0
- package/dist-client/pages/building-inspection/component/inspection-event-provider.d.ts +3 -2
- package/dist-client/pages/building-inspection/component/inspection-event-provider.js +129 -34
- package/dist-client/pages/building-inspection/component/inspection-event-provider.js.map +1 -1
- package/dist-client/pages/checklist-template/construction-checklist-template-list.js +9 -14
- package/dist-client/pages/checklist-template/construction-checklist-template-list.js.map +1 -1
- package/dist-client/pages/project-checklist/project-checklist-management.d.ts +2 -0
- package/dist-client/pages/project-checklist/project-checklist-management.js +24 -2
- package/dist-client/pages/project-checklist/project-checklist-management.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/building-inspection/building-inspection-query.d.ts +5 -1
- package/dist-server/service/building-inspection/building-inspection-query.js +114 -0
- package/dist-server/service/building-inspection/building-inspection-query.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection-type.d.ts +4 -0
- package/dist-server/service/building-inspection/building-inspection-type.js +15 -1
- package/dist-server/service/building-inspection/building-inspection-type.js.map +1 -1
- package/dist-server/service/building-inspection/index.d.ts +1 -1
- package/dist-server/service/field-document/field-document-auto-file.d.ts +21 -0
- package/dist-server/service/field-document/field-document-auto-file.js +47 -0
- package/dist-server/service/field-document/field-document-auto-file.js.map +1 -0
- package/dist-server/service/field-document/field-document-mutation.d.ts +9 -0
- package/dist-server/service/field-document/field-document-mutation.js +136 -0
- package/dist-server/service/field-document/field-document-mutation.js.map +1 -0
- package/dist-server/service/field-document/field-document-query.d.ts +13 -0
- package/dist-server/service/field-document/field-document-query.js +107 -0
- package/dist-server/service/field-document/field-document-query.js.map +1 -0
- package/dist-server/service/field-document/field-document-summary-service.d.ts +2 -0
- package/dist-server/service/field-document/field-document-summary-service.js +55 -0
- package/dist-server/service/field-document/field-document-summary-service.js.map +1 -0
- package/dist-server/service/field-document/field-document-type.d.ts +22 -0
- package/dist-server/service/field-document/field-document-type.js +83 -0
- package/dist-server/service/field-document/field-document-type.js.map +1 -0
- package/dist-server/service/field-document/field-document.d.ts +28 -0
- package/dist-server/service/field-document/field-document.js +123 -0
- package/dist-server/service/field-document/field-document.js.map +1 -0
- package/dist-server/service/field-document/index.d.ts +5 -0
- package/dist-server/service/field-document/index.js +9 -0
- package/dist-server/service/field-document/index.js.map +1 -0
- package/dist-server/service/index.d.ts +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FieldDocumentMutation = 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 field_document_1 = require("./field-document");
|
|
9
|
+
const field_document_type_1 = require("./field-document-type");
|
|
10
|
+
const field_document_summary_service_1 = require("./field-document-summary-service");
|
|
11
|
+
let FieldDocumentMutation = class FieldDocumentMutation {
|
|
12
|
+
async createFieldDocument(patch, context) {
|
|
13
|
+
const { domain, user, tx } = context.state;
|
|
14
|
+
const result = await tx.getRepository(field_document_1.FieldDocument).save({
|
|
15
|
+
projectId: patch.projectId,
|
|
16
|
+
code: patch.code,
|
|
17
|
+
name: patch.name,
|
|
18
|
+
sourceType: patch.sourceType,
|
|
19
|
+
sourceRefId: patch.sourceRefId,
|
|
20
|
+
aiSummaryStatus: field_document_1.FieldDocumentSummaryStatus.REQUEST,
|
|
21
|
+
domain,
|
|
22
|
+
creator: user,
|
|
23
|
+
updater: user
|
|
24
|
+
});
|
|
25
|
+
if (patch.file) {
|
|
26
|
+
await (0, attachment_base_1.createAttachment)(null, {
|
|
27
|
+
attachment: {
|
|
28
|
+
file: patch.file,
|
|
29
|
+
refType: field_document_1.FieldDocument.name,
|
|
30
|
+
refBy: result.id
|
|
31
|
+
}
|
|
32
|
+
}, context);
|
|
33
|
+
}
|
|
34
|
+
(0, field_document_summary_service_1.queueDocumentSummary)(result.id);
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
async createFieldDocuments(patches, context) {
|
|
38
|
+
const { domain, user, tx } = context.state;
|
|
39
|
+
const repo = tx.getRepository(field_document_1.FieldDocument);
|
|
40
|
+
const results = [];
|
|
41
|
+
for (const patch of patches) {
|
|
42
|
+
const result = await repo.save({
|
|
43
|
+
projectId: patch.projectId,
|
|
44
|
+
code: patch.code,
|
|
45
|
+
name: patch.name,
|
|
46
|
+
sourceType: patch.sourceType,
|
|
47
|
+
sourceRefId: patch.sourceRefId,
|
|
48
|
+
aiSummaryStatus: field_document_1.FieldDocumentSummaryStatus.REQUEST,
|
|
49
|
+
domain,
|
|
50
|
+
creator: user,
|
|
51
|
+
updater: user
|
|
52
|
+
});
|
|
53
|
+
if (patch.file) {
|
|
54
|
+
await (0, attachment_base_1.createAttachment)(null, {
|
|
55
|
+
attachment: {
|
|
56
|
+
file: patch.file,
|
|
57
|
+
refType: field_document_1.FieldDocument.name,
|
|
58
|
+
refBy: result.id
|
|
59
|
+
}
|
|
60
|
+
}, context);
|
|
61
|
+
}
|
|
62
|
+
(0, field_document_summary_service_1.queueDocumentSummary)(result.id);
|
|
63
|
+
results.push(result);
|
|
64
|
+
}
|
|
65
|
+
return results;
|
|
66
|
+
}
|
|
67
|
+
async moveFieldDocuments(ids, targetCode, context) {
|
|
68
|
+
const { user, tx } = context.state;
|
|
69
|
+
const repo = tx.getRepository(field_document_1.FieldDocument);
|
|
70
|
+
await repo.update({ id: (0, typeorm_1.In)(ids) }, { code: targetCode, updater: user });
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
async toggleFieldDocumentFavorite(id, context) {
|
|
74
|
+
const { user, tx } = context.state;
|
|
75
|
+
const repo = tx.getRepository(field_document_1.FieldDocument);
|
|
76
|
+
const doc = await repo.findOneBy({ id });
|
|
77
|
+
return await repo.save(Object.assign(Object.assign({}, doc), { isFavorite: !doc.isFavorite, updater: user }));
|
|
78
|
+
}
|
|
79
|
+
async deleteFieldDocuments(ids, context) {
|
|
80
|
+
const { tx } = context.state;
|
|
81
|
+
await tx.getRepository(field_document_1.FieldDocument).softDelete({ id: (0, typeorm_1.In)(ids) });
|
|
82
|
+
await (0, attachment_base_1.deleteAttachmentsByRef)(null, { refBys: ids }, context);
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
exports.FieldDocumentMutation = FieldDocumentMutation;
|
|
87
|
+
tslib_1.__decorate([
|
|
88
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
89
|
+
(0, type_graphql_1.Mutation)(returns => field_document_1.FieldDocument, { description: '현장 문서 생성' }),
|
|
90
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('patch')),
|
|
91
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
92
|
+
tslib_1.__metadata("design:type", Function),
|
|
93
|
+
tslib_1.__metadata("design:paramtypes", [field_document_type_1.NewFieldDocument, Object]),
|
|
94
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
95
|
+
], FieldDocumentMutation.prototype, "createFieldDocument", null);
|
|
96
|
+
tslib_1.__decorate([
|
|
97
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
98
|
+
(0, type_graphql_1.Mutation)(returns => [field_document_1.FieldDocument], { description: '현장 문서 다건 생성' }),
|
|
99
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [field_document_type_1.NewFieldDocument])),
|
|
100
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
101
|
+
tslib_1.__metadata("design:type", Function),
|
|
102
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
103
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
104
|
+
], FieldDocumentMutation.prototype, "createFieldDocuments", null);
|
|
105
|
+
tslib_1.__decorate([
|
|
106
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
107
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: '문서 폴더 이동' }),
|
|
108
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
|
109
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('targetCode')),
|
|
110
|
+
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
|
111
|
+
tslib_1.__metadata("design:type", Function),
|
|
112
|
+
tslib_1.__metadata("design:paramtypes", [Array, String, Object]),
|
|
113
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
114
|
+
], FieldDocumentMutation.prototype, "moveFieldDocuments", null);
|
|
115
|
+
tslib_1.__decorate([
|
|
116
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
117
|
+
(0, type_graphql_1.Mutation)(returns => field_document_1.FieldDocument, { description: '즐겨찾기 토글' }),
|
|
118
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
119
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
120
|
+
tslib_1.__metadata("design:type", Function),
|
|
121
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
122
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
123
|
+
], FieldDocumentMutation.prototype, "toggleFieldDocumentFavorite", null);
|
|
124
|
+
tslib_1.__decorate([
|
|
125
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
126
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: '현장 문서 삭제' }),
|
|
127
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
|
128
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
129
|
+
tslib_1.__metadata("design:type", Function),
|
|
130
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
131
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
132
|
+
], FieldDocumentMutation.prototype, "deleteFieldDocuments", null);
|
|
133
|
+
exports.FieldDocumentMutation = FieldDocumentMutation = tslib_1.__decorate([
|
|
134
|
+
(0, type_graphql_1.Resolver)(field_document_1.FieldDocument)
|
|
135
|
+
], FieldDocumentMutation);
|
|
136
|
+
//# sourceMappingURL=field-document-mutation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-document-mutation.js","sourceRoot":"","sources":["../../../server/service/field-document/field-document-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,qEAA0F;AAE1F,qDAA4E;AAC5E,+DAAwD;A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IAAA,kBAAG,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,sCAAgB,CAAC,CAAC,CAAA;IAC1C,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;iEAsCP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;IAEvD,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,EAAC,YAAY,CAAC,CAAA;IACjB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+DAQP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,8BAAa,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;IAE5D,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IACT,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;wEAWP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;IAEvD,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;iEAQP;gCAhIU,qBAAqB;IADjC,IAAA,uBAAQ,EAAC,8BAAa,CAAC;GACX,qBAAqB,CAiIjC","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 { FieldDocument, FieldDocumentSummaryStatus } from './field-document'\nimport { NewFieldDocument } from './field-document-type'\nimport { queueDocumentSummary } from './field-document-summary-service'\n\n@Resolver(FieldDocument)\nexport class FieldDocumentMutation {\n @Directive('@transaction')\n @Mutation(returns => FieldDocument, { description: '현장 문서 생성' })\n async createFieldDocument(\n @Arg('patch') patch: NewFieldDocument,\n @Ctx() context: ResolverContext\n ): Promise<FieldDocument> {\n const { domain, user, tx } = context.state\n\n const result = await tx.getRepository(FieldDocument).save({\n projectId: patch.projectId,\n code: patch.code,\n name: patch.name,\n sourceType: patch.sourceType,\n sourceRefId: patch.sourceRefId,\n aiSummaryStatus: FieldDocumentSummaryStatus.REQUEST,\n domain,\n creator: user,\n updater: user\n })\n\n if (patch.file) {\n await createAttachment(\n null,\n {\n attachment: {\n file: patch.file,\n refType: FieldDocument.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n queueDocumentSummary(result.id)\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [FieldDocument], { description: '현장 문서 다건 생성' })\n async createFieldDocuments(\n @Arg('patches', type => [NewFieldDocument]) patches: NewFieldDocument[],\n @Ctx() context: ResolverContext\n ): Promise<FieldDocument[]> {\n const { domain, user, tx } = context.state\n const repo = tx.getRepository(FieldDocument)\n const results: FieldDocument[] = []\n\n for (const patch of patches) {\n const result = await repo.save({\n projectId: patch.projectId,\n code: patch.code,\n name: patch.name,\n sourceType: patch.sourceType,\n sourceRefId: patch.sourceRefId,\n aiSummaryStatus: FieldDocumentSummaryStatus.REQUEST,\n domain,\n creator: user,\n updater: user\n })\n\n if (patch.file) {\n await createAttachment(\n null,\n {\n attachment: {\n file: patch.file,\n refType: FieldDocument.name,\n refBy: result.id\n }\n },\n context\n )\n }\n\n queueDocumentSummary(result.id)\n results.push(result)\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: '문서 폴더 이동' })\n async moveFieldDocuments(\n @Arg('ids', type => [String]) ids: string[],\n @Arg('targetCode') targetCode: string,\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { user, tx } = context.state\n const repo = tx.getRepository(FieldDocument)\n\n await repo.update({ id: In(ids) }, { code: targetCode, updater: user })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => FieldDocument, { description: '즐겨찾기 토글' })\n async toggleFieldDocumentFavorite(\n @Arg('id') id: string,\n @Ctx() context: ResolverContext\n ): Promise<FieldDocument> {\n const { user, tx } = context.state\n const repo = tx.getRepository(FieldDocument)\n const doc = await repo.findOneBy({ id })\n\n return await repo.save({\n ...doc,\n isFavorite: !doc.isFavorite,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: '현장 문서 삭제' })\n async deleteFieldDocuments(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { tx } = context.state\n\n await tx.getRepository(FieldDocument).softDelete({ id: In(ids) })\n await deleteAttachmentsByRef(null, { refBys: ids }, context)\n\n return true\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Domain } from '@things-factory/shell';
|
|
2
|
+
import { User } from '@things-factory/auth-base';
|
|
3
|
+
import { FieldDocument } from './field-document';
|
|
4
|
+
import { FieldDocumentList, FieldDocumentCodeCount } from './field-document-type';
|
|
5
|
+
export declare class FieldDocumentQuery {
|
|
6
|
+
fieldDocumentsByCode(projectId: string, code: string, context: ResolverContext): Promise<FieldDocumentList>;
|
|
7
|
+
fieldDocumentCountsByProject(projectId: string, context: ResolverContext): Promise<FieldDocumentCodeCount[]>;
|
|
8
|
+
fieldDocument(id: string, context: ResolverContext): Promise<FieldDocument>;
|
|
9
|
+
domain(fd: FieldDocument): Promise<Domain>;
|
|
10
|
+
creator(fd: FieldDocument): Promise<User>;
|
|
11
|
+
updater(fd: FieldDocument): Promise<User>;
|
|
12
|
+
fullpath(fd: FieldDocument): Promise<string | null>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FieldDocumentQuery = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const shell_1 = require("@things-factory/shell");
|
|
7
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
8
|
+
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
9
|
+
const field_document_1 = require("./field-document");
|
|
10
|
+
const field_document_type_1 = require("./field-document-type");
|
|
11
|
+
let FieldDocumentQuery = class FieldDocumentQuery {
|
|
12
|
+
async fieldDocumentsByCode(projectId, code, context) {
|
|
13
|
+
const repository = (0, shell_1.getRepository)(field_document_1.FieldDocument);
|
|
14
|
+
const [items, total] = await repository.findAndCount({
|
|
15
|
+
where: { projectId, code },
|
|
16
|
+
order: { isFavorite: 'DESC', createdAt: 'DESC' }
|
|
17
|
+
});
|
|
18
|
+
return { items, total };
|
|
19
|
+
}
|
|
20
|
+
async fieldDocumentCountsByProject(projectId, context) {
|
|
21
|
+
const result = await (0, shell_1.getRepository)(field_document_1.FieldDocument)
|
|
22
|
+
.createQueryBuilder('fd')
|
|
23
|
+
.select('fd.code', 'code')
|
|
24
|
+
.addSelect('COUNT(*)', 'count')
|
|
25
|
+
.where('fd.project_id = :projectId', { projectId })
|
|
26
|
+
.andWhere('fd.deleted_at IS NULL')
|
|
27
|
+
.groupBy('fd.code')
|
|
28
|
+
.getRawMany();
|
|
29
|
+
return result.map(r => ({ code: r.code, count: Number(r.count) }));
|
|
30
|
+
}
|
|
31
|
+
async fieldDocument(id, context) {
|
|
32
|
+
return await (0, shell_1.getRepository)(field_document_1.FieldDocument).findOneBy({ id });
|
|
33
|
+
}
|
|
34
|
+
async domain(fd) {
|
|
35
|
+
return await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: fd.domainId });
|
|
36
|
+
}
|
|
37
|
+
async creator(fd) {
|
|
38
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: fd.creatorId });
|
|
39
|
+
}
|
|
40
|
+
async updater(fd) {
|
|
41
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: fd.updaterId });
|
|
42
|
+
}
|
|
43
|
+
async fullpath(fd) {
|
|
44
|
+
const attachment = await (0, shell_1.getRepository)(attachment_base_1.Attachment).findOne({
|
|
45
|
+
where: { refBy: fd.id, refType: field_document_1.FieldDocument.name }
|
|
46
|
+
});
|
|
47
|
+
return (attachment === null || attachment === void 0 ? void 0 : attachment.path) || null;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
exports.FieldDocumentQuery = FieldDocumentQuery;
|
|
51
|
+
tslib_1.__decorate([
|
|
52
|
+
(0, type_graphql_1.Query)(returns => field_document_type_1.FieldDocumentList, { description: '소분류 코드별 문서 목록 조회' }),
|
|
53
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('projectId')),
|
|
54
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('code')),
|
|
55
|
+
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
|
56
|
+
tslib_1.__metadata("design:type", Function),
|
|
57
|
+
tslib_1.__metadata("design:paramtypes", [String, String, Object]),
|
|
58
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
59
|
+
], FieldDocumentQuery.prototype, "fieldDocumentsByCode", null);
|
|
60
|
+
tslib_1.__decorate([
|
|
61
|
+
(0, type_graphql_1.Query)(returns => [field_document_type_1.FieldDocumentCodeCount], { description: '프로젝트별 분류 코드당 문서 수' }),
|
|
62
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('projectId')),
|
|
63
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
64
|
+
tslib_1.__metadata("design:type", Function),
|
|
65
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
66
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
67
|
+
], FieldDocumentQuery.prototype, "fieldDocumentCountsByProject", null);
|
|
68
|
+
tslib_1.__decorate([
|
|
69
|
+
(0, type_graphql_1.Query)(returns => field_document_1.FieldDocument, { nullable: true, description: '단건 문서 상세 조회' }),
|
|
70
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
71
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
72
|
+
tslib_1.__metadata("design:type", Function),
|
|
73
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
74
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
75
|
+
], FieldDocumentQuery.prototype, "fieldDocument", null);
|
|
76
|
+
tslib_1.__decorate([
|
|
77
|
+
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
|
|
78
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
79
|
+
tslib_1.__metadata("design:type", Function),
|
|
80
|
+
tslib_1.__metadata("design:paramtypes", [field_document_1.FieldDocument]),
|
|
81
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
82
|
+
], FieldDocumentQuery.prototype, "domain", null);
|
|
83
|
+
tslib_1.__decorate([
|
|
84
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
85
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
86
|
+
tslib_1.__metadata("design:type", Function),
|
|
87
|
+
tslib_1.__metadata("design:paramtypes", [field_document_1.FieldDocument]),
|
|
88
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
89
|
+
], FieldDocumentQuery.prototype, "creator", null);
|
|
90
|
+
tslib_1.__decorate([
|
|
91
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
92
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
93
|
+
tslib_1.__metadata("design:type", Function),
|
|
94
|
+
tslib_1.__metadata("design:paramtypes", [field_document_1.FieldDocument]),
|
|
95
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
96
|
+
], FieldDocumentQuery.prototype, "updater", null);
|
|
97
|
+
tslib_1.__decorate([
|
|
98
|
+
(0, type_graphql_1.FieldResolver)(type => String, { nullable: true }),
|
|
99
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
100
|
+
tslib_1.__metadata("design:type", Function),
|
|
101
|
+
tslib_1.__metadata("design:paramtypes", [field_document_1.FieldDocument]),
|
|
102
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
103
|
+
], FieldDocumentQuery.prototype, "fullpath", null);
|
|
104
|
+
exports.FieldDocumentQuery = FieldDocumentQuery = tslib_1.__decorate([
|
|
105
|
+
(0, type_graphql_1.Resolver)(field_document_1.FieldDocument)
|
|
106
|
+
], FieldDocumentQuery);
|
|
107
|
+
//# sourceMappingURL=field-document-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-document-query.js","sourceRoot":"","sources":["../../../server/service/field-document/field-document-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA6E;AAC7E,iDAA6D;AAC7D,yDAAgD;AAChD,qEAA4D;AAC5D,qDAAgD;AAChD,+DAAiF;AAG1E,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAEvB,AAAN,KAAK,CAAC,oBAAoB,CACN,SAAiB,EACtB,IAAY,EAClB,OAAwB;QAE/B,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,8BAAa,CAAC,CAAA;QAE/C,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC;YACnD,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;YAC1B,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE;SACjD,CAAC,CAAA;QAEF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACzB,CAAC;IAGK,AAAN,KAAK,CAAC,4BAA4B,CACd,SAAiB,EAC5B,OAAwB;QAE/B,MAAM,MAAM,GAAG,MAAM,IA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,mBAAI,GAAE,CAAA;;6CAAK,8BAAa;;iDAEtC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAK,8BAAa;;iDAEtC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAClC,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAK,8BAAa;;kDAKvC;6BA/DU,kBAAkB;IAD9B,IAAA,uBAAQ,EAAC,8BAAa,CAAC;GACX,kBAAkB,CAgE9B","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Arg, Ctx } from 'type-graphql'\nimport { Domain, getRepository } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Attachment } from '@things-factory/attachment-base'\nimport { FieldDocument } from './field-document'\nimport { FieldDocumentList, FieldDocumentCodeCount } from './field-document-type'\n\n@Resolver(FieldDocument)\nexport class FieldDocumentQuery {\n @Query(returns => FieldDocumentList, { description: '소분류 코드별 문서 목록 조회' })\n async fieldDocumentsByCode(\n @Arg('projectId') projectId: string,\n @Arg('code') code: string,\n @Ctx() context: ResolverContext\n ): Promise<FieldDocumentList> {\n const repository = getRepository(FieldDocument)\n\n const [items, total] = await repository.findAndCount({\n where: { projectId, code },\n order: { isFavorite: 'DESC', createdAt: 'DESC' }\n })\n\n return { items, total }\n }\n\n @Query(returns => [FieldDocumentCodeCount], { description: '프로젝트별 분류 코드당 문서 수' })\n async fieldDocumentCountsByProject(\n @Arg('projectId') projectId: string,\n @Ctx() context: ResolverContext\n ): Promise<FieldDocumentCodeCount[]> {\n const result = await getRepository(FieldDocument)\n .createQueryBuilder('fd')\n .select('fd.code', 'code')\n .addSelect('COUNT(*)', 'count')\n .where('fd.project_id = :projectId', { projectId })\n .andWhere('fd.deleted_at IS NULL')\n .groupBy('fd.code')\n .getRawMany()\n\n return result.map(r => ({ code: r.code, count: Number(r.count) }))\n }\n\n @Query(returns => FieldDocument, { nullable: true, description: '단건 문서 상세 조회' })\n async fieldDocument(\n @Arg('id') id: string,\n @Ctx() context: ResolverContext\n ): Promise<FieldDocument> {\n return await getRepository(FieldDocument).findOneBy({ id })\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() fd: FieldDocument): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: fd.domainId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() fd: FieldDocument): Promise<User> {\n return await getRepository(User).findOneBy({ id: fd.creatorId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() fd: FieldDocument): Promise<User> {\n return await getRepository(User).findOneBy({ id: fd.updaterId })\n }\n\n @FieldResolver(type => String, { nullable: true })\n async fullpath(@Root() fd: FieldDocument): Promise<string | null> {\n const attachment = await getRepository(Attachment).findOne({\n where: { refBy: fd.id, refType: FieldDocument.name }\n })\n return attachment?.path || null\n }\n}\n"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateDocumentSummary = generateDocumentSummary;
|
|
4
|
+
exports.queueDocumentSummary = queueDocumentSummary;
|
|
5
|
+
const shell_1 = require("@things-factory/shell");
|
|
6
|
+
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
7
|
+
const field_document_1 = require("./field-document");
|
|
8
|
+
const SUMMARY_API_BASE_URL = 'https://hatiolab-korea-uni.ettisoft.com';
|
|
9
|
+
const API_USERNAME = 'admin';
|
|
10
|
+
const API_PASSWORD = 'admin1234';
|
|
11
|
+
async function generateDocumentSummary(fieldDocumentId) {
|
|
12
|
+
var _a, _b, _c;
|
|
13
|
+
const repository = (0, shell_1.getRepository)(field_document_1.FieldDocument);
|
|
14
|
+
try {
|
|
15
|
+
const doc = await repository.findOneBy({ id: fieldDocumentId });
|
|
16
|
+
if (!doc)
|
|
17
|
+
return;
|
|
18
|
+
const attachment = await (0, shell_1.getRepository)(attachment_base_1.Attachment).findOne({
|
|
19
|
+
where: { refBy: doc.id, refType: field_document_1.FieldDocument.name }
|
|
20
|
+
});
|
|
21
|
+
const url = `${SUMMARY_API_BASE_URL}/api/run/document-summary`;
|
|
22
|
+
const headers = {
|
|
23
|
+
Authorization: `Basic ${Buffer.from(`${API_USERNAME}:${API_PASSWORD}`).toString('base64')}`
|
|
24
|
+
};
|
|
25
|
+
const form = new FormData();
|
|
26
|
+
form.append('input', JSON.stringify({ documentName: doc.name, documentPath: (attachment === null || attachment === void 0 ? void 0 : attachment.path) || '' }));
|
|
27
|
+
const response = await fetch(url, {
|
|
28
|
+
method: 'POST',
|
|
29
|
+
headers,
|
|
30
|
+
body: form
|
|
31
|
+
});
|
|
32
|
+
const data = ((_a = (await (response === null || response === void 0 ? void 0 : response.json()))) === null || _a === void 0 ? void 0 : _a.result) || {};
|
|
33
|
+
if ((data === null || data === void 0 ? void 0 : data.status) === 'success') {
|
|
34
|
+
const summary = ((_b = data.result) === null || _b === void 0 ? void 0 : _b['요약']) || ((_c = data.result) === null || _c === void 0 ? void 0 : _c['summary']) || '';
|
|
35
|
+
await repository.update({ id: fieldDocumentId }, { aiSummary: summary, aiSummaryStatus: field_document_1.FieldDocumentSummaryStatus.SUCCESS });
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
await repository.update({ id: fieldDocumentId }, { aiSummaryStatus: field_document_1.FieldDocumentSummaryStatus.FAIL });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
console.error('Document summary generation failed:', error);
|
|
43
|
+
await repository.update({ id: fieldDocumentId }, { aiSummaryStatus: field_document_1.FieldDocumentSummaryStatus.FAIL });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function queueDocumentSummary(fieldDocumentId) {
|
|
47
|
+
if (!fieldDocumentId)
|
|
48
|
+
return;
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
generateDocumentSummary(fieldDocumentId).catch(err => {
|
|
51
|
+
console.error('Background document summary update failed:', err);
|
|
52
|
+
});
|
|
53
|
+
}, 0);
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=field-document-summary-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-document-summary-service.js","sourceRoot":"","sources":["../../../server/service/field-document/field-document-summary-service.ts"],"names":[],"mappings":";;AAQA,0DAwCC;AAED,oDAQC;AA1DD,iDAAqD;AACrD,qEAA4D;AAC5D,qDAA4E;AAE5E,MAAM,oBAAoB,GAAW,yCAAyC,CAAA;AAC9E,MAAM,YAAY,GAAW,OAAO,CAAA;AACpC,MAAM,YAAY,GAAW,WAAW,CAAA;AAEjC,KAAK,UAAU,uBAAuB,CAAC,eAAuB;;IACnE,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,8BAAa,CAAC,CAAA;IAE/C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC,CAAA;QAC/D,IAAI,CAAC,GAAG;YAAE,OAAM;QAEhB,MAAM,UAAU,GAAG,MAAM,IAAA,qBAAa,EAAC,4BAAU,CAAC,CAAC,OAAO,CAAC;YACzD,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,8BAAa,CAAC,IAAI,EAAE;SACtD,CAAC,CAAA;QAEF,MAAM,GAAG,GAAG,GAAG,oBAAoB,2BAA2B,CAAA;QAC9D,MAAM,OAAO,GAAQ;YACnB,aAAa,EAAE,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,YAAY,IAAI,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;SAC5F,CAAA;QAED,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAA;QAC3B,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAA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;AACH,CAAC;AAED,SAAgB,oBAAoB,CAAC,eAAuB;IAC1D,IAAI,CAAC,eAAe;QAAE,OAAM;IAE5B,UAAU,CAAC,GAAG,EAAE;QACd,uBAAuB,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;YACnD,OAAO,CAAC,KAAK,CAAC,4CAA4C,EAAE,GAAG,CAAC,CAAA;QAClE,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,CAAC,CAAA;AACP,CAAC","sourcesContent":["import { getRepository } from '@things-factory/shell'\nimport { Attachment } from '@things-factory/attachment-base'\nimport { FieldDocument, FieldDocumentSummaryStatus } from './field-document'\n\nconst SUMMARY_API_BASE_URL: string = 'https://hatiolab-korea-uni.ettisoft.com'\nconst API_USERNAME: string = 'admin'\nconst API_PASSWORD: string = 'admin1234'\n\nexport async function generateDocumentSummary(fieldDocumentId: string): Promise<void> {\n const repository = getRepository(FieldDocument)\n\n try {\n const doc = await repository.findOneBy({ id: fieldDocumentId })\n if (!doc) return\n\n const attachment = await getRepository(Attachment).findOne({\n where: { refBy: doc.id, refType: FieldDocument.name }\n })\n\n const url = `${SUMMARY_API_BASE_URL}/api/run/document-summary`\n const headers: any = {\n Authorization: `Basic ${Buffer.from(`${API_USERNAME}:${API_PASSWORD}`).toString('base64')}`\n }\n\n const form = new FormData()\n form.append('input', JSON.stringify({ documentName: doc.name, documentPath: attachment?.path || '' }))\n\n const response = await fetch(url, {\n method: 'POST',\n headers,\n body: form\n })\n\n const data = (await response?.json())?.result || {}\n\n if (data?.status === 'success') {\n const summary = data.result?.['요약'] || data.result?.['summary'] || ''\n await repository.update(\n { id: fieldDocumentId },\n { aiSummary: summary, aiSummaryStatus: FieldDocumentSummaryStatus.SUCCESS }\n )\n } else {\n await repository.update({ id: fieldDocumentId }, { aiSummaryStatus: FieldDocumentSummaryStatus.FAIL })\n }\n } catch (error) {\n console.error('Document summary generation failed:', error)\n await repository.update({ id: fieldDocumentId }, { aiSummaryStatus: FieldDocumentSummaryStatus.FAIL })\n }\n}\n\nexport function queueDocumentSummary(fieldDocumentId: string): void {\n if (!fieldDocumentId) return\n\n setTimeout(() => {\n generateDocumentSummary(fieldDocumentId).catch(err => {\n console.error('Background document summary update failed:', err)\n })\n }, 0)\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FieldDocument } from './field-document';
|
|
2
|
+
export declare class NewFieldDocument {
|
|
3
|
+
projectId: string;
|
|
4
|
+
code: string;
|
|
5
|
+
name: string;
|
|
6
|
+
sourceType?: string;
|
|
7
|
+
sourceRefId?: string;
|
|
8
|
+
file?: any;
|
|
9
|
+
}
|
|
10
|
+
export declare class FieldDocumentPatch {
|
|
11
|
+
id: string;
|
|
12
|
+
code?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare class FieldDocumentList {
|
|
16
|
+
items: FieldDocument[];
|
|
17
|
+
total: number;
|
|
18
|
+
}
|
|
19
|
+
export declare class FieldDocumentCodeCount {
|
|
20
|
+
code: string;
|
|
21
|
+
count: number;
|
|
22
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FieldDocumentCodeCount = exports.FieldDocumentList = exports.FieldDocumentPatch = exports.NewFieldDocument = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const field_document_1 = require("./field-document");
|
|
7
|
+
let NewFieldDocument = class NewFieldDocument {
|
|
8
|
+
};
|
|
9
|
+
exports.NewFieldDocument = NewFieldDocument;
|
|
10
|
+
tslib_1.__decorate([
|
|
11
|
+
(0, type_graphql_1.Field)({ nullable: false }),
|
|
12
|
+
tslib_1.__metadata("design:type", String)
|
|
13
|
+
], NewFieldDocument.prototype, "projectId", void 0);
|
|
14
|
+
tslib_1.__decorate([
|
|
15
|
+
(0, type_graphql_1.Field)({ nullable: false }),
|
|
16
|
+
tslib_1.__metadata("design:type", String)
|
|
17
|
+
], NewFieldDocument.prototype, "code", void 0);
|
|
18
|
+
tslib_1.__decorate([
|
|
19
|
+
(0, type_graphql_1.Field)({ nullable: false }),
|
|
20
|
+
tslib_1.__metadata("design:type", String)
|
|
21
|
+
], NewFieldDocument.prototype, "name", void 0);
|
|
22
|
+
tslib_1.__decorate([
|
|
23
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
24
|
+
tslib_1.__metadata("design:type", String)
|
|
25
|
+
], NewFieldDocument.prototype, "sourceType", void 0);
|
|
26
|
+
tslib_1.__decorate([
|
|
27
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
28
|
+
tslib_1.__metadata("design:type", String)
|
|
29
|
+
], NewFieldDocument.prototype, "sourceRefId", void 0);
|
|
30
|
+
tslib_1.__decorate([
|
|
31
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
32
|
+
tslib_1.__metadata("design:type", Object)
|
|
33
|
+
], NewFieldDocument.prototype, "file", void 0);
|
|
34
|
+
exports.NewFieldDocument = NewFieldDocument = tslib_1.__decorate([
|
|
35
|
+
(0, type_graphql_1.InputType)()
|
|
36
|
+
], NewFieldDocument);
|
|
37
|
+
let FieldDocumentPatch = class FieldDocumentPatch {
|
|
38
|
+
};
|
|
39
|
+
exports.FieldDocumentPatch = FieldDocumentPatch;
|
|
40
|
+
tslib_1.__decorate([
|
|
41
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: false }),
|
|
42
|
+
tslib_1.__metadata("design:type", String)
|
|
43
|
+
], FieldDocumentPatch.prototype, "id", void 0);
|
|
44
|
+
tslib_1.__decorate([
|
|
45
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
46
|
+
tslib_1.__metadata("design:type", String)
|
|
47
|
+
], FieldDocumentPatch.prototype, "code", void 0);
|
|
48
|
+
tslib_1.__decorate([
|
|
49
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
50
|
+
tslib_1.__metadata("design:type", String)
|
|
51
|
+
], FieldDocumentPatch.prototype, "name", void 0);
|
|
52
|
+
exports.FieldDocumentPatch = FieldDocumentPatch = tslib_1.__decorate([
|
|
53
|
+
(0, type_graphql_1.InputType)()
|
|
54
|
+
], FieldDocumentPatch);
|
|
55
|
+
let FieldDocumentList = class FieldDocumentList {
|
|
56
|
+
};
|
|
57
|
+
exports.FieldDocumentList = FieldDocumentList;
|
|
58
|
+
tslib_1.__decorate([
|
|
59
|
+
(0, type_graphql_1.Field)(type => [field_document_1.FieldDocument]),
|
|
60
|
+
tslib_1.__metadata("design:type", Array)
|
|
61
|
+
], FieldDocumentList.prototype, "items", void 0);
|
|
62
|
+
tslib_1.__decorate([
|
|
63
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
64
|
+
tslib_1.__metadata("design:type", Number)
|
|
65
|
+
], FieldDocumentList.prototype, "total", void 0);
|
|
66
|
+
exports.FieldDocumentList = FieldDocumentList = tslib_1.__decorate([
|
|
67
|
+
(0, type_graphql_1.ObjectType)()
|
|
68
|
+
], FieldDocumentList);
|
|
69
|
+
let FieldDocumentCodeCount = class FieldDocumentCodeCount {
|
|
70
|
+
};
|
|
71
|
+
exports.FieldDocumentCodeCount = FieldDocumentCodeCount;
|
|
72
|
+
tslib_1.__decorate([
|
|
73
|
+
(0, type_graphql_1.Field)(),
|
|
74
|
+
tslib_1.__metadata("design:type", String)
|
|
75
|
+
], FieldDocumentCodeCount.prototype, "code", void 0);
|
|
76
|
+
tslib_1.__decorate([
|
|
77
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
78
|
+
tslib_1.__metadata("design:type", Number)
|
|
79
|
+
], FieldDocumentCodeCount.prototype, "count", void 0);
|
|
80
|
+
exports.FieldDocumentCodeCount = FieldDocumentCodeCount = tslib_1.__decorate([
|
|
81
|
+
(0, type_graphql_1.ObjectType)()
|
|
82
|
+
], FieldDocumentCodeCount);
|
|
83
|
+
//# sourceMappingURL=field-document-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-document-type.js","sourceRoot":"","sources":["../../../server/service/field-document/field-document-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AACpE,qDAAgD;AAGzC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAkB5B,CAAA;AAlBY,4CAAgB;AAE3B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;mDACT;AAGlB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;8CACd;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;8CACd;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACP;AAGnB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CAChB;2BAjBC,gBAAgB;IAD5B,IAAA,wBAAS,GAAE;GACC,gBAAgB,CAkB5B;AAGM,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAS9B,CAAA;AATY,gDAAkB;AAE7B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;8CAC5B;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACb;6BARF,kBAAkB;IAD9B,IAAA,wBAAS,GAAE;GACC,kBAAkB,CAS9B;AAGM,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAM7B,CAAA;AANY,8CAAiB;AAE5B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,8BAAa,CAAC,CAAC;;gDACT;AAGtB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;gDACN;4BALF,iBAAiB;IAD7B,IAAA,yBAAU,GAAE;GACA,iBAAiB,CAM7B;AAGM,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;CAMlC,CAAA;AANY,wDAAsB;AAEjC;IADC,IAAA,oBAAK,GAAE;;oDACI;AAGZ;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;qDACN;iCALF,sBAAsB;IADlC,IAAA,yBAAU,GAAE;GACA,sBAAsB,CAMlC","sourcesContent":["import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'\nimport { FieldDocument } from './field-document'\n\n@InputType()\nexport class NewFieldDocument {\n @Field({ nullable: false })\n projectId!: string\n\n @Field({ nullable: false })\n code!: string\n\n @Field({ nullable: false })\n name!: string\n\n @Field({ nullable: true })\n sourceType?: string\n\n @Field({ nullable: true })\n sourceRefId?: string\n\n @Field({ nullable: true })\n file?: any\n}\n\n@InputType()\nexport class FieldDocumentPatch {\n @Field(type => ID, { nullable: false })\n id!: string\n\n @Field({ nullable: true })\n code?: string\n\n @Field({ nullable: true })\n name?: string\n}\n\n@ObjectType()\nexport class FieldDocumentList {\n @Field(type => [FieldDocument])\n items: FieldDocument[]\n\n @Field(type => Int)\n total: number\n}\n\n@ObjectType()\nexport class FieldDocumentCodeCount {\n @Field()\n code: string\n\n @Field(type => Int)\n count: number\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Domain } from '@things-factory/shell';
|
|
2
|
+
import { User } from '@things-factory/auth-base';
|
|
3
|
+
export declare enum FieldDocumentSummaryStatus {
|
|
4
|
+
REQUEST = "10",
|
|
5
|
+
SUCCESS = "20",
|
|
6
|
+
FAIL = "30"
|
|
7
|
+
}
|
|
8
|
+
export declare class FieldDocument {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
domain?: Domain;
|
|
11
|
+
domainId?: string;
|
|
12
|
+
projectId: string;
|
|
13
|
+
code: string;
|
|
14
|
+
name: string;
|
|
15
|
+
aiSummary?: string;
|
|
16
|
+
aiSummaryStatus?: FieldDocumentSummaryStatus;
|
|
17
|
+
isFavorite?: boolean;
|
|
18
|
+
sourceType?: string;
|
|
19
|
+
sourceRefId?: string;
|
|
20
|
+
createdAt?: Date;
|
|
21
|
+
updatedAt?: Date;
|
|
22
|
+
deletedAt?: Date;
|
|
23
|
+
creator?: User;
|
|
24
|
+
creatorId?: string;
|
|
25
|
+
updater?: User;
|
|
26
|
+
updaterId?: string;
|
|
27
|
+
fullpath?: string;
|
|
28
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FieldDocument = exports.FieldDocumentSummaryStatus = 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 FieldDocumentSummaryStatus;
|
|
10
|
+
(function (FieldDocumentSummaryStatus) {
|
|
11
|
+
FieldDocumentSummaryStatus["REQUEST"] = "10";
|
|
12
|
+
FieldDocumentSummaryStatus["SUCCESS"] = "20";
|
|
13
|
+
FieldDocumentSummaryStatus["FAIL"] = "30";
|
|
14
|
+
})(FieldDocumentSummaryStatus || (exports.FieldDocumentSummaryStatus = FieldDocumentSummaryStatus = {}));
|
|
15
|
+
(0, type_graphql_1.registerEnumType)(FieldDocumentSummaryStatus, {
|
|
16
|
+
name: 'FieldDocumentSummaryStatus',
|
|
17
|
+
description: 'AI 문서 요약 요청 상태'
|
|
18
|
+
});
|
|
19
|
+
let FieldDocument = class FieldDocument {
|
|
20
|
+
};
|
|
21
|
+
exports.FieldDocument = FieldDocument;
|
|
22
|
+
tslib_1.__decorate([
|
|
23
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
24
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
|
|
25
|
+
tslib_1.__metadata("design:type", String)
|
|
26
|
+
], FieldDocument.prototype, "id", void 0);
|
|
27
|
+
tslib_1.__decorate([
|
|
28
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
29
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
30
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
31
|
+
], FieldDocument.prototype, "domain", void 0);
|
|
32
|
+
tslib_1.__decorate([
|
|
33
|
+
(0, typeorm_1.RelationId)((fd) => fd.domain),
|
|
34
|
+
tslib_1.__metadata("design:type", String)
|
|
35
|
+
], FieldDocument.prototype, "domainId", void 0);
|
|
36
|
+
tslib_1.__decorate([
|
|
37
|
+
(0, typeorm_1.Column)({ nullable: false, comment: '프로젝트 ID' }),
|
|
38
|
+
(0, type_graphql_1.Field)({ nullable: false }),
|
|
39
|
+
tslib_1.__metadata("design:type", String)
|
|
40
|
+
], FieldDocument.prototype, "projectId", void 0);
|
|
41
|
+
tslib_1.__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ nullable: false, comment: '소분류 코드 (예: 020108)' }),
|
|
43
|
+
(0, type_graphql_1.Field)({ nullable: false }),
|
|
44
|
+
tslib_1.__metadata("design:type", String)
|
|
45
|
+
], FieldDocument.prototype, "code", void 0);
|
|
46
|
+
tslib_1.__decorate([
|
|
47
|
+
(0, typeorm_1.Column)({ nullable: false, comment: '파일명' }),
|
|
48
|
+
(0, type_graphql_1.Field)({ nullable: false }),
|
|
49
|
+
tslib_1.__metadata("design:type", String)
|
|
50
|
+
], FieldDocument.prototype, "name", void 0);
|
|
51
|
+
tslib_1.__decorate([
|
|
52
|
+
(0, typeorm_1.Column)({ nullable: true, comment: 'AI 생성 요약' }),
|
|
53
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
54
|
+
tslib_1.__metadata("design:type", String)
|
|
55
|
+
], FieldDocument.prototype, "aiSummary", void 0);
|
|
56
|
+
tslib_1.__decorate([
|
|
57
|
+
(0, typeorm_1.Column)({ nullable: true, comment: 'AI 요약 요청 상태 (10: 요청, 20: 성공, 30: 실패)' }),
|
|
58
|
+
(0, type_graphql_1.Field)(type => FieldDocumentSummaryStatus, { nullable: true }),
|
|
59
|
+
tslib_1.__metadata("design:type", String)
|
|
60
|
+
], FieldDocument.prototype, "aiSummaryStatus", void 0);
|
|
61
|
+
tslib_1.__decorate([
|
|
62
|
+
(0, typeorm_1.Column)({ default: false, comment: '즐겨찾기' }),
|
|
63
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
64
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
65
|
+
], FieldDocument.prototype, "isFavorite", void 0);
|
|
66
|
+
tslib_1.__decorate([
|
|
67
|
+
(0, typeorm_1.Column)({ nullable: true, comment: '자동 등록 출처 (DAILY_WORKLOG, INSPECTION_REQUEST 등)' }),
|
|
68
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
69
|
+
tslib_1.__metadata("design:type", String)
|
|
70
|
+
], FieldDocument.prototype, "sourceType", void 0);
|
|
71
|
+
tslib_1.__decorate([
|
|
72
|
+
(0, typeorm_1.Column)({ nullable: true, comment: '출처 엔티티 ID' }),
|
|
73
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
74
|
+
tslib_1.__metadata("design:type", String)
|
|
75
|
+
], FieldDocument.prototype, "sourceRefId", void 0);
|
|
76
|
+
tslib_1.__decorate([
|
|
77
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
78
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
79
|
+
tslib_1.__metadata("design:type", Date)
|
|
80
|
+
], FieldDocument.prototype, "createdAt", void 0);
|
|
81
|
+
tslib_1.__decorate([
|
|
82
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
83
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
84
|
+
tslib_1.__metadata("design:type", Date)
|
|
85
|
+
], FieldDocument.prototype, "updatedAt", void 0);
|
|
86
|
+
tslib_1.__decorate([
|
|
87
|
+
(0, typeorm_1.DeleteDateColumn)(),
|
|
88
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
89
|
+
tslib_1.__metadata("design:type", Date)
|
|
90
|
+
], FieldDocument.prototype, "deletedAt", 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
|
+
], FieldDocument.prototype, "creator", void 0);
|
|
96
|
+
tslib_1.__decorate([
|
|
97
|
+
(0, typeorm_1.RelationId)((fd) => fd.creator),
|
|
98
|
+
tslib_1.__metadata("design:type", String)
|
|
99
|
+
], FieldDocument.prototype, "creatorId", void 0);
|
|
100
|
+
tslib_1.__decorate([
|
|
101
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
102
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
103
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
104
|
+
], FieldDocument.prototype, "updater", void 0);
|
|
105
|
+
tslib_1.__decorate([
|
|
106
|
+
(0, typeorm_1.RelationId)((fd) => fd.updater),
|
|
107
|
+
tslib_1.__metadata("design:type", String)
|
|
108
|
+
], FieldDocument.prototype, "updaterId", void 0);
|
|
109
|
+
tslib_1.__decorate([
|
|
110
|
+
(0, type_graphql_1.Field)({ nullable: true, description: '첨부파일 fullpath' }),
|
|
111
|
+
tslib_1.__metadata("design:type", String)
|
|
112
|
+
], FieldDocument.prototype, "fullpath", void 0);
|
|
113
|
+
exports.FieldDocument = FieldDocument = tslib_1.__decorate([
|
|
114
|
+
(0, typeorm_1.Entity)({ comment: '현장 문서' }),
|
|
115
|
+
(0, typeorm_1.Index)('ix_field_document_0', (fd) => [fd.projectId, fd.code], {
|
|
116
|
+
where: '"deleted_at" IS NULL'
|
|
117
|
+
}),
|
|
118
|
+
(0, typeorm_1.Index)('ix_field_document_1', (fd) => [fd.projectId, fd.isFavorite], {
|
|
119
|
+
where: '"deleted_at" IS NULL'
|
|
120
|
+
}),
|
|
121
|
+
(0, type_graphql_1.ObjectType)({ description: 'Entity for FieldDocument' })
|
|
122
|
+
], FieldDocument);
|
|
123
|
+
//# sourceMappingURL=field-document.js.map
|