F3.1: corregir contrato de contexto móvil estructural
This commit is contained in:
@@ -28,6 +28,16 @@ type ParentRow = {
|
|||||||
inventoryFamilyId: string | null;
|
inventoryFamilyId: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type FieldTypesBase = {
|
||||||
|
context: {
|
||||||
|
area: { id: string; code: string; name: string };
|
||||||
|
operatorCompany: { id: string; code: string; name: string };
|
||||||
|
inspection: { id: string; code: string; status: string };
|
||||||
|
};
|
||||||
|
parent: { id: string; code: string; name: string };
|
||||||
|
data: Array<Record<string, unknown> & { id: string; code: string; name: string }>;
|
||||||
|
};
|
||||||
|
|
||||||
const STRUCTURAL_CHILD: Record<string, string | undefined> = {
|
const STRUCTURAL_CHILD: Record<string, string | undefined> = {
|
||||||
area: 'yacimiento',
|
area: 'yacimiento',
|
||||||
yacimiento: 'instalacion',
|
yacimiento: 'instalacion',
|
||||||
@@ -48,12 +58,8 @@ export class F3FieldInventoryStructureService {
|
|||||||
parentId: string | undefined,
|
parentId: string | undefined,
|
||||||
principal: AuthPrincipal,
|
principal: AuthPrincipal,
|
||||||
) {
|
) {
|
||||||
const base = await this.fieldInventory.types(visitId, parentId, principal) as {
|
const base = await this.fieldInventory.types(visitId, parentId, principal) as unknown as FieldTypesBase;
|
||||||
context: { areaId: string };
|
const effectiveParentId = parentId ?? base.context.area.id;
|
||||||
parent: { id: string; code: string; name: string };
|
|
||||||
data: Array<Record<string, unknown> & { id: string; code: string; name: string }>;
|
|
||||||
};
|
|
||||||
const effectiveParentId = parentId ?? base.context.areaId;
|
|
||||||
const parent = await this.parent(effectiveParentId);
|
const parent = await this.parent(effectiveParentId);
|
||||||
const expectedTypeCode = STRUCTURAL_CHILD[parent.typeCode.toLowerCase()];
|
const expectedTypeCode = STRUCTURAL_CHILD[parent.typeCode.toLowerCase()];
|
||||||
const data = expectedTypeCode
|
const data = expectedTypeCode
|
||||||
|
|||||||
Reference in New Issue
Block a user