@dssp/supervision 1.0.0-alpha.40 → 1.0.0-alpha.47
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-detail-camera.d.ts +33 -4
- package/dist-client/pages/building-inspection/building-inspection-detail-camera.js +456 -37
- package/dist-client/pages/building-inspection/building-inspection-detail-camera.js.map +1 -1
- package/dist-client/pages/building-inspection-grid/building-inspection-grid-detail.d.ts +1 -1
- package/dist-client/pages/checklist-template/checklist-template-item.js +14 -3
- package/dist-client/pages/checklist-template/checklist-template-item.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/building-inspection/index.d.ts +2 -2
- package/dist-server/service/checklist-template-item/checklist-template-item-mutation.js +4 -1
- package/dist-server/service/checklist-template-item/checklist-template-item-mutation.js.map +1 -1
- package/dist-server/service/checklist-template-item/checklist-template-item-type.d.ts +2 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-type.js +5 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-type.js.map +1 -1
- package/dist-server/service/checklist-template-item/checklist-template-item.d.ts +6 -0
- package/dist-server/service/checklist-template-item/checklist-template-item.js +16 -1
- package/dist-server/service/checklist-template-item/checklist-template-item.js.map +1 -1
- package/dist-server/service/checklist-template-item/index.d.ts +1 -1
- package/dist-server/service/checklist-template-item/spec-matching-service.d.ts +2 -0
- package/dist-server/service/checklist-template-item/spec-matching-service.js +50 -0
- package/dist-server/service/checklist-template-item/spec-matching-service.js.map +1 -0
- package/dist-server/service/index.d.ts +2 -2
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/dist-server/service/building-inspection/building-inspection-history.d.ts +0 -18
- package/dist-server/service/building-inspection/building-inspection-history.js +0 -91
- package/dist-server/service/building-inspection/building-inspection-history.js.map +0 -1
- package/dist-server/service/checklist/checklist-history.d.ts +0 -32
- package/dist-server/service/checklist/checklist-history.js +0 -156
- package/dist-server/service/checklist/checklist-history.js.map +0 -1
|
@@ -3,5 +3,5 @@ import { BuildingInspectionQuery } from './building-inspection-query';
|
|
|
3
3
|
import { BuildingInspectionMutation } from './building-inspection-mutation';
|
|
4
4
|
import { BuildingInspectionSummary, ChecklistInputType, ChecklistItemInputType, ChecklistSubmitInputType, ChecklistItemSubmitInputType } from './building-inspection-type';
|
|
5
5
|
export declare const entities: (typeof BuildingInspection)[];
|
|
6
|
-
export declare const resolvers: (typeof
|
|
7
|
-
export declare const types: (typeof
|
|
6
|
+
export declare const resolvers: (typeof BuildingInspectionQuery | typeof BuildingInspectionMutation)[];
|
|
7
|
+
export declare const types: (typeof ChecklistInputType | typeof ChecklistItemInputType | typeof ChecklistSubmitInputType | typeof ChecklistItemSubmitInputType | typeof BuildingInspectionSummary | typeof BuildingInspectionStatus | typeof ProjectType)[];
|
|
@@ -7,6 +7,7 @@ const typeorm_1 = require("typeorm");
|
|
|
7
7
|
const checklist_template_item_1 = require("./checklist-template-item");
|
|
8
8
|
const checklist_template_item_type_1 = require("./checklist-template-item-type");
|
|
9
9
|
const checklist_template_1 = require("../checklist-template/checklist-template");
|
|
10
|
+
const spec_matching_service_1 = require("./spec-matching-service");
|
|
10
11
|
let ChecklistTemplateItemMutation = class ChecklistTemplateItemMutation {
|
|
11
12
|
async updateMultipleChecklistTemplateItems(patches, checklistTemplateId, context) {
|
|
12
13
|
const { domain, user, tx } = context.state;
|
|
@@ -15,9 +16,11 @@ let ChecklistTemplateItemMutation = class ChecklistTemplateItemMutation {
|
|
|
15
16
|
const checklistTemplate = await tx.getRepository(checklist_template_1.ChecklistTemplate).findOneBy({ id: checklistTemplateId });
|
|
16
17
|
await checklistTemplateItemRepo.delete({ checklistTemplate: { id: checklistTemplateId } });
|
|
17
18
|
for (let i = 0; i < patches.length; i++) {
|
|
18
|
-
const result = await checklistTemplateItemRepo.save(Object.assign(Object.assign({}, patches[i]), { sequence: i, checklistTemplate, creator: user, updater: user }));
|
|
19
|
+
const result = await checklistTemplateItemRepo.save(Object.assign(Object.assign({}, patches[i]), { sequence: i, checklistTemplate, inspctionCriteria: '', criteriaRequestStatus: checklist_template_item_1.CriteriaRequestStatus.REQUEST, creator: user, updater: user }));
|
|
19
20
|
results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
|
|
20
21
|
}
|
|
22
|
+
// 저장 후 inspctionCriteria 비동기 업데이트 트리거 (ChecklistTemplateItem.name -> 외부 API 호출)
|
|
23
|
+
(0, spec_matching_service_1.queueUpdateInspctionCriteria)(results.map(v => v.id));
|
|
21
24
|
return results;
|
|
22
25
|
}
|
|
23
26
|
async deleteChecklistTemplateItem(id, context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checklist-template-item-mutation.js","sourceRoot":"","sources":["../../../server/service/checklist-template-item/checklist-template-item-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,
|
|
1
|
+
{"version":3,"file":"checklist-template-item-mutation.js","sourceRoot":"","sources":["../../../server/service/checklist-template-item/checklist-template-item-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,uEAAwF;AACxF,iFAA2E;AAC3E,iFAA4E;AAC5E,mEAAsE;AAG/D,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IAGlC,AAAN,KAAK,CAAC,oCAAoC,CACc,OAAqC,EAC/D,mBAA2B,EAChD,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,IAAI,OAAO,GAAG,EAAE,CAAA;QAEhB,MAAM,yBAAyB,GAAG,EAAE,CAAC,aAAa,CAAC,+CAAqB,CAAC,CAAA;QACzE,MAAM,iBAAiB,GAAG,MAAM,EAAE,CAAC,aAAa,CAAC,sCAAiB,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,mBAAmB,EAAE,CAAC,CAAA;QAE1G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;QAEF,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAA;AA7DY,sEAA6B;AAGlC;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC,+CAAqB,CAAC,EAAE,EAAE,WAAW,EAAE,wDAAwD,EAAE,CAAC;IAErH,mBAAA,IAAA,kBAAG,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,yDAA0B,CAAC,CAAC,CAAA;IACpD,mBAAA,IAAA,kBAAG,EAAC,qBAAqB,CAAC,CAAA;IAC1B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;yFA6BP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;gFAM9D;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,2CAA2C,EAAE,CAAC;IAExF,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;iFASP;wCA5DU,6BAA6B;IADzC,IAAA,uBAAQ,EAAC,+CAAqB,CAAC;GACnB,6BAA6B,CA6DzC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { ChecklistTemplateItem, CriteriaRequestStatus } from './checklist-template-item'\nimport { ChecklistTemplateItemPatch } from './checklist-template-item-type'\nimport { ChecklistTemplate } from '../checklist-template/checklist-template'\nimport { queueUpdateInspctionCriteria } from './spec-matching-service'\n\n@Resolver(ChecklistTemplateItem)\nexport class ChecklistTemplateItemMutation {\n @Directive('@transaction')\n @Mutation(returns => [ChecklistTemplateItem], { description: \"To modify multiple ChecklistTemplateItems' information\" })\n async updateMultipleChecklistTemplateItems(\n @Arg('patches', type => [ChecklistTemplateItemPatch]) patches: ChecklistTemplateItemPatch[],\n @Arg('checklistTemplateId') checklistTemplateId: string,\n @Ctx() context: ResolverContext\n ): Promise<ChecklistTemplateItem[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n\n const checklistTemplateItemRepo = tx.getRepository(ChecklistTemplateItem)\n const checklistTemplate = await tx.getRepository(ChecklistTemplate).findOneBy({ id: checklistTemplateId })\n\n await checklistTemplateItemRepo.delete({ checklistTemplate: { id: checklistTemplateId } })\n\n for (let i = 0; i < patches.length; i++) {\n const result = await checklistTemplateItemRepo.save({\n ...patches[i],\n sequence: i,\n checklistTemplate,\n inspctionCriteria: '',\n criteriaRequestStatus: CriteriaRequestStatus.REQUEST,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n\n // 저장 후 inspctionCriteria 비동기 업데이트 트리거 (ChecklistTemplateItem.name -> 외부 API 호출)\n queueUpdateInspctionCriteria(results.map(v => v.id))\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete ChecklistTemplateItem' })\n async deleteChecklistTemplateItem(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(ChecklistTemplateItem).delete({ id })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple ChecklistTemplateItems' })\n async deleteChecklistTemplateItems(\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(ChecklistTemplateItem).delete({\n id: In(ids)\n })\n\n return true\n }\n}\n"]}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ChecklistTemplateItem } from './checklist-template-item';
|
|
2
2
|
import { ChecklistTypeMainType } from '../checklist-type/checklist-type';
|
|
3
|
+
import { CriteriaRequestStatus } from './checklist-template-item';
|
|
3
4
|
export declare class ChecklistTemplateItemPatch {
|
|
4
5
|
id?: string;
|
|
5
6
|
name?: string;
|
|
6
7
|
inspctionCriteria?: string;
|
|
8
|
+
criteriaRequestStatus?: CriteriaRequestStatus;
|
|
7
9
|
sequence?: number;
|
|
8
10
|
mainType?: ChecklistTypeMainType;
|
|
9
11
|
detailType?: string;
|
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
|
6
6
|
const checklist_template_item_1 = require("./checklist-template-item");
|
|
7
7
|
const checklist_type_1 = require("../checklist-type/checklist-type");
|
|
8
|
+
const checklist_template_item_2 = require("./checklist-template-item");
|
|
8
9
|
let ChecklistTemplateItemPatch = class ChecklistTemplateItemPatch {
|
|
9
10
|
};
|
|
10
11
|
exports.ChecklistTemplateItemPatch = ChecklistTemplateItemPatch;
|
|
@@ -20,6 +21,10 @@ tslib_1.__decorate([
|
|
|
20
21
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
21
22
|
tslib_1.__metadata("design:type", String)
|
|
22
23
|
], ChecklistTemplateItemPatch.prototype, "inspctionCriteria", void 0);
|
|
24
|
+
tslib_1.__decorate([
|
|
25
|
+
(0, type_graphql_1.Field)(type => checklist_template_item_2.CriteriaRequestStatus, { nullable: true }),
|
|
26
|
+
tslib_1.__metadata("design:type", String)
|
|
27
|
+
], ChecklistTemplateItemPatch.prototype, "criteriaRequestStatus", void 0);
|
|
23
28
|
tslib_1.__decorate([
|
|
24
29
|
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
|
|
25
30
|
tslib_1.__metadata("design:type", Number)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checklist-template-item-type.js","sourceRoot":"","sources":["../../../server/service/checklist-template-item/checklist-template-item-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AACpE,uEAAiE;AACjE,qEAAwE;
|
|
1
|
+
{"version":3,"file":"checklist-template-item-type.js","sourceRoot":"","sources":["../../../server/service/checklist-template-item/checklist-template-item-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AACpE,uEAAiE;AACjE,qEAAwE;AACxE,uEAAiE;AAG1D,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;CA2BtC,CAAA;AA3BY,gEAA0B;AAErC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sDAC3B;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wDACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qEACA;AAG1B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,+CAAqB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yEACZ;AAG7C;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4DACtB;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4DACM;AAGhC;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8DACP;AAGnB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uEACE;AAG5B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0DACX;qCA1BJ,0BAA0B;IADtC,IAAA,wBAAS,GAAE;GACC,0BAA0B,CA2BtC;AAGM,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;CAMrC,CAAA;AANY,8DAAyB;AAEpC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,+CAAqB,CAAC,CAAC;;wDACT;AAG9B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;wDACN;oCALF,yBAAyB;IADrC,IAAA,yBAAU,GAAE;GACA,yBAAyB,CAMrC","sourcesContent":["import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'\nimport { ChecklistTemplateItem } from './checklist-template-item'\nimport { ChecklistTypeMainType } from '../checklist-type/checklist-type'\nimport { CriteriaRequestStatus } from './checklist-template-item'\n\n@InputType()\nexport class ChecklistTemplateItemPatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n inspctionCriteria?: string\n\n @Field(type => CriteriaRequestStatus, { nullable: true })\n criteriaRequestStatus?: CriteriaRequestStatus\n\n @Field(type => Int, { nullable: true })\n sequence?: number\n\n @Field({ nullable: true })\n mainType?: ChecklistTypeMainType\n\n @Field({ nullable: true })\n detailType?: string\n\n @Field({ nullable: true })\n checklistTemplateId?: string\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class ChecklistTemplateItemList {\n @Field(type => [ChecklistTemplateItem])\n items: ChecklistTemplateItem[]\n\n @Field(type => Int)\n total: number\n}\n"]}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { User } from '@things-factory/auth-base';
|
|
2
2
|
import { ChecklistTemplate } from '../checklist-template/checklist-template';
|
|
3
3
|
import { ChecklistTypeMainType } from '../checklist-type/checklist-type';
|
|
4
|
+
export declare enum CriteriaRequestStatus {
|
|
5
|
+
REQUEST = "10",
|
|
6
|
+
SUCCESS = "20",
|
|
7
|
+
FAIL = "30"
|
|
8
|
+
}
|
|
4
9
|
export declare class ChecklistTemplateItem {
|
|
5
10
|
readonly id: string;
|
|
6
11
|
name: string;
|
|
7
12
|
inspctionCriteria?: string;
|
|
13
|
+
criteriaRequestStatus?: CriteriaRequestStatus;
|
|
8
14
|
sequence?: number;
|
|
9
15
|
mainType: ChecklistTypeMainType;
|
|
10
16
|
detailType: string;
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ChecklistTemplateItem = void 0;
|
|
3
|
+
exports.ChecklistTemplateItem = exports.CriteriaRequestStatus = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const typeorm_1 = require("typeorm");
|
|
6
6
|
const type_graphql_1 = require("type-graphql");
|
|
7
7
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
8
8
|
const checklist_template_1 = require("../checklist-template/checklist-template");
|
|
9
9
|
const checklist_type_1 = require("../checklist-type/checklist-type");
|
|
10
|
+
var CriteriaRequestStatus;
|
|
11
|
+
(function (CriteriaRequestStatus) {
|
|
12
|
+
CriteriaRequestStatus["REQUEST"] = "10";
|
|
13
|
+
CriteriaRequestStatus["SUCCESS"] = "20";
|
|
14
|
+
CriteriaRequestStatus["FAIL"] = "30";
|
|
15
|
+
})(CriteriaRequestStatus || (exports.CriteriaRequestStatus = CriteriaRequestStatus = {}));
|
|
16
|
+
(0, type_graphql_1.registerEnumType)(CriteriaRequestStatus, {
|
|
17
|
+
name: 'CriteriaRequestStatus',
|
|
18
|
+
description: '검사 기준 API 요청 상태'
|
|
19
|
+
});
|
|
10
20
|
let ChecklistTemplateItem = class ChecklistTemplateItem {
|
|
11
21
|
};
|
|
12
22
|
exports.ChecklistTemplateItem = ChecklistTemplateItem;
|
|
@@ -25,6 +35,11 @@ tslib_1.__decorate([
|
|
|
25
35
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
26
36
|
tslib_1.__metadata("design:type", String)
|
|
27
37
|
], ChecklistTemplateItem.prototype, "inspctionCriteria", void 0);
|
|
38
|
+
tslib_1.__decorate([
|
|
39
|
+
(0, typeorm_1.Column)({ nullable: true, comment: '검사 기준 API 요청 상태 (10: API 요청, 20: 성공, 30: 실패)' }),
|
|
40
|
+
(0, type_graphql_1.Field)(type => CriteriaRequestStatus, { nullable: true }),
|
|
41
|
+
tslib_1.__metadata("design:type", String)
|
|
42
|
+
], ChecklistTemplateItem.prototype, "criteriaRequestStatus", void 0);
|
|
28
43
|
tslib_1.__decorate([
|
|
29
44
|
(0, typeorm_1.Column)({ nullable: true, comment: '시퀀스' }),
|
|
30
45
|
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checklist-template-item.js","sourceRoot":"","sources":["../../../server/service/checklist-template-item/checklist-template-item.ts"],"names":[],"mappings":";;;;AAAA,qCAAkI;AAClI,+
|
|
1
|
+
{"version":3,"file":"checklist-template-item.js","sourceRoot":"","sources":["../../../server/service/checklist-template-item/checklist-template-item.ts"],"names":[],"mappings":";;;;AAAA,qCAAkI;AAClI,+CAA2E;AAE3E,yDAAgD;AAChD,iFAA4E;AAC5E,qEAAwE;AAExE,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,uCAAc,CAAA;IACd,uCAAc,CAAA;IACd,oCAAW,CAAA;AACb,CAAC,EAJW,qBAAqB,qCAArB,qBAAqB,QAIhC;AAED,IAAA,+BAAgB,EAAC,qBAAqB,EAAE;IACtC,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,iBAAiB;CAC/B,CAAC,CAAA;AAUK,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;CA0DjC,CAAA;AA1DY,sDAAqB;AAGvB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;iDACC;AAInB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EA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E,CACjB;IACA,IAAA,eAAK,EAAC,8BAA8B,EAAE,CAAC,GAA0B,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACvF,IAAA,yBAAU,GAAE;GACA,qBAAqB,CA0DjC","sourcesContent":["import { CreateDateColumn, UpdateDateColumn, Entity, Index, Column, RelationId, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'\nimport { ObjectType, Field, ID, Int, registerEnumType } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { ChecklistTemplate } from '../checklist-template/checklist-template'\nimport { ChecklistTypeMainType } from '../checklist-type/checklist-type'\n\nexport enum CriteriaRequestStatus {\n REQUEST = '10',\n SUCCESS = '20',\n FAIL = '30'\n}\n\nregisterEnumType(CriteriaRequestStatus, {\n name: 'CriteriaRequestStatus',\n description: '검사 기준 API 요청 상태'\n})\n\n@Entity({ comment: '체크리스트 템플릿 아이템' })\n@Index(\n 'ix_checklist_template_item_0',\n (cti: ChecklistTemplateItem) => [cti.checklistTemplate, cti.mainType, cti.detailType, cti.name],\n { unique: true }\n)\n@Index('ix_checklist_template_item_1', (cti: ChecklistTemplateItem) => [cti.detailType])\n@ObjectType()\nexport class ChecklistTemplateItem {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Column({ nullable: false, comment: '검사 항목' })\n @Field({ nullable: false })\n name: string\n\n @Column({ nullable: true, comment: '검사 기준' })\n @Field({ nullable: true })\n inspctionCriteria?: string\n\n @Column({ nullable: true, comment: '검사 기준 API 요청 상태 (10: API 요청, 20: 성공, 30: 실패)' })\n @Field(type => CriteriaRequestStatus, { nullable: true })\n criteriaRequestStatus?: CriteriaRequestStatus\n\n @Column({ nullable: true, comment: '시퀀스' })\n @Field(type => Int, { nullable: true })\n sequence?: number\n\n @Column({ nullable: false, comment: '메인 구분 (10: 기본 업무, 20: 기본 외 업무)' })\n @Field({ nullable: false })\n mainType: ChecklistTypeMainType\n\n @Column({ nullable: false, comment: '상세 구분 ID (F.K)' })\n @Field({ nullable: false })\n detailType: string\n\n // 체크리스트 템플릿 정보 (상위 테이블 참조)\n @ManyToOne(type => ChecklistTemplate)\n @Field(type => ChecklistTemplate, { nullable: true })\n checklistTemplate?: ChecklistTemplate\n\n @RelationId((checklistTemplateItem: ChecklistTemplateItem) => checklistTemplateItem.checklistTemplate)\n checklistTemplateId?: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((checklistTemplateItem: ChecklistTemplateItem) => checklistTemplateItem.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((checklistTemplateItem: ChecklistTemplateItem) => checklistTemplateItem.updater)\n updaterId?: string\n}\n"]}
|
|
@@ -2,4 +2,4 @@ import { ChecklistTemplateItem } from './checklist-template-item';
|
|
|
2
2
|
import { ChecklistTemplateItemQuery } from './checklist-template-item-query';
|
|
3
3
|
import { ChecklistTemplateItemMutation } from './checklist-template-item-mutation';
|
|
4
4
|
export declare const entities: (typeof ChecklistTemplateItem)[];
|
|
5
|
-
export declare const resolvers: (typeof
|
|
5
|
+
export declare const resolvers: (typeof ChecklistTemplateItemMutation | typeof ChecklistTemplateItemQuery)[];
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateInspctionCriteriaForChecklistTemplateItems = updateInspctionCriteriaForChecklistTemplateItems;
|
|
4
|
+
exports.queueUpdateInspctionCriteria = queueUpdateInspctionCriteria;
|
|
5
|
+
const shell_1 = require("@things-factory/shell");
|
|
6
|
+
const checklist_template_item_1 = require("./checklist-template-item");
|
|
7
|
+
const SPEC_MATCHING_API_BASE_URL = 'https://hatiolab-korea-uni.ettisoft.com';
|
|
8
|
+
const API_USERNAME = 'admin';
|
|
9
|
+
const API_PASSWORD = 'admin1234';
|
|
10
|
+
async function updateInspctionCriteriaForChecklistTemplateItems(ids) {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
const repository = (0, shell_1.getRepository)(checklist_template_item_1.ChecklistTemplateItem);
|
|
13
|
+
const url = `${SPEC_MATCHING_API_BASE_URL}/api/run/spec-matching`;
|
|
14
|
+
const headers = {};
|
|
15
|
+
headers['Authorization'] = `Basic ${Buffer.from(`${API_USERNAME}:${API_PASSWORD}`).toString('base64')}`;
|
|
16
|
+
for (const id of ids) {
|
|
17
|
+
try {
|
|
18
|
+
const item = await repository.findOneBy({ id });
|
|
19
|
+
const form = new FormData();
|
|
20
|
+
form.append('input', JSON.stringify({ item: item.name }));
|
|
21
|
+
const response = await fetch(url, {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
headers,
|
|
24
|
+
body: form
|
|
25
|
+
});
|
|
26
|
+
const data = ((_a = (await (response === null || response === void 0 ? void 0 : response.json()))) === null || _a === void 0 ? void 0 : _a.result) || {};
|
|
27
|
+
console.log('data :', data);
|
|
28
|
+
if ((data === null || data === void 0 ? void 0 : data.status) === 'success') {
|
|
29
|
+
const criteria = ((_b = data.result) === null || _b === void 0 ? void 0 : _b['검사기준']) || '';
|
|
30
|
+
await repository.update({ id }, { inspctionCriteria: criteria, criteriaRequestStatus: checklist_template_item_1.CriteriaRequestStatus.SUCCESS });
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
await repository.update({ id }, { criteriaRequestStatus: checklist_template_item_1.CriteriaRequestStatus.FAIL });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
await repository.update({ id }, { criteriaRequestStatus: checklist_template_item_1.CriteriaRequestStatus.FAIL });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function queueUpdateInspctionCriteria(ids) {
|
|
42
|
+
if (!ids || ids.length === 0)
|
|
43
|
+
return;
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
updateInspctionCriteriaForChecklistTemplateItems(ids).catch(err => {
|
|
46
|
+
console.error('Background spec-matching update failed:', err);
|
|
47
|
+
});
|
|
48
|
+
}, 0);
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=spec-matching-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-matching-service.js","sourceRoot":"","sources":["../../../server/service/checklist-template-item/spec-matching-service.ts"],"names":[],"mappings":";;AAOA,4GAgCC;AAED,oEAQC;AAjDD,iDAAqD;AACrD,uEAAwF;AAExF,MAAM,0BAA0B,GAAW,yCAAyC,CAAA;AACpF,MAAM,YAAY,GAAW,OAAO,CAAA;AACpC,MAAM,YAAY,GAAW,WAAW,CAAA;AAEjC,KAAK,UAAU,gDAAgD,CAAC,GAAa;;IAClF,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,+CAAqB,CAAC,CAAA;IAEvD,MAAM,GAAG,GAAG,GAAG,0BAA0B,wBAAwB,CAAA;IACjE,MAAM,OAAO,GAAQ,EAAE,CAAA;IACvB,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,YAAY,IAAI,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAA;IAEvG,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;YAC/C,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAA;YAC3B,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;YACzD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAA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AG,CAAC,CAAA;QAC/D,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,CAAC,CAAA;AACP,CAAC","sourcesContent":["import { getRepository } from '@things-factory/shell'\nimport { ChecklistTemplateItem, CriteriaRequestStatus } from './checklist-template-item'\n\nconst SPEC_MATCHING_API_BASE_URL: string = 'https://hatiolab-korea-uni.ettisoft.com'\nconst API_USERNAME: string = 'admin'\nconst API_PASSWORD: string = 'admin1234'\n\nexport async function updateInspctionCriteriaForChecklistTemplateItems(ids: string[]): Promise<void> {\n const repository = getRepository(ChecklistTemplateItem)\n\n const url = `${SPEC_MATCHING_API_BASE_URL}/api/run/spec-matching`\n const headers: any = {}\n headers['Authorization'] = `Basic ${Buffer.from(`${API_USERNAME}:${API_PASSWORD}`).toString('base64')}`\n\n for (const id of ids) {\n try {\n const item = await repository.findOneBy({ id })\n const form = new FormData()\n form.append('input', JSON.stringify({ item: item.name }))\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 console.log('data :', data)\n\n if (data?.status === 'success') {\n const criteria = data.result?.['검사기준'] || ''\n await repository.update({ id }, { inspctionCriteria: criteria, criteriaRequestStatus: CriteriaRequestStatus.SUCCESS })\n } else {\n await repository.update({ id }, { criteriaRequestStatus: CriteriaRequestStatus.FAIL })\n }\n } catch (error) {\n await repository.update({ id }, { criteriaRequestStatus: CriteriaRequestStatus.FAIL })\n }\n }\n}\n\nexport function queueUpdateInspctionCriteria(ids: string[]): void {\n if (!ids || ids.length === 0) return\n\n setTimeout(() => {\n updateInspctionCriteriaForChecklistTemplateItems(ids).catch(err => {\n console.error('Background spec-matching update failed:', err)\n })\n }, 0)\n}\n"]}
|
|
@@ -11,8 +11,8 @@ export * from './checklist-template-item/checklist-template-item';
|
|
|
11
11
|
export * from './building-inspection/building-inspection';
|
|
12
12
|
export * from './building-inspection/building-inspection-type';
|
|
13
13
|
export * from './building-inspection-daily-worklog/building-inspection-daily-worklog';
|
|
14
|
-
export declare const entities: (typeof import("./
|
|
14
|
+
export declare const entities: (typeof import("./checklist-template-item/checklist-template-item").ChecklistTemplateItem | typeof import("./checklist-template/checklist-template").ChecklistTemplate | typeof import("./checklist-type/checklist-type").ChecklistType | typeof import("./action-plan/action-plan").ActionPlan | typeof import("./issue/issue").Issue | typeof import("./project-report/project-report").ProjectReport | typeof import("./supervisor/supervisor").Supervisor | typeof import("./checklist/checklist").Checklist | typeof import("./checklist-history/checklist-history").ChecklistHistory | typeof import("./checklist-item/checklist-item").ChecklistItem | typeof import("./checklist-item-history/checklist-item-history").ChecklistItemHistory | typeof import("./checklist-item-comment/checklist-item-comment").ChecklistItemComment | typeof import("./building-inspection/building-inspection").BuildingInspection | typeof import("./building-inspection-history/building-inspection-history").BuildingInspectionHistory | typeof import("./building-inspection-daily-worklog/building-inspection-daily-worklog").BuildingInspectionDailyWorklog)[];
|
|
15
15
|
export declare const schema: {
|
|
16
16
|
resolverClasses: typeof import("./checklist-item/checklist-item-mutation").ChecklistItemMutation[];
|
|
17
17
|
};
|
|
18
|
-
export declare const subscribers: (typeof import("./
|
|
18
|
+
export declare const subscribers: (typeof import("./checklist-history/event-subscriber").ChecklistHistoryEntitySubscriber | typeof import("./checklist-item-history/event-subscriber").ChecklistItemHistoryEntitySubscriber | typeof import("./building-inspection-history/event-subscriber").BuildingInspectionHistoryEntitySubscriber)[];
|