diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 6364f37..140fb64 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -1,9 +1,11 @@ name: Android APK -# F3.2: genera la APK debug verificable antes de promover la integración multi-Acta. +# F5: genera una APK debug verificable contra la API productiva F5. on: push: branches: + - 'main' + - 'release/f5-android-test' - 'feature/f2-2*' - 'feature/f2-3*' - 'feature/f2-4*' @@ -16,6 +18,8 @@ on: paths: - 'android-app/**' - 'api-v3/src/auth/**' + - 'api-v3/src/inspection-visits/**' + - 'api-v3/src/inspection-acts/**' - '.github/workflows/android.yml' workflow_dispatch: @@ -58,7 +62,7 @@ jobs: - name: Upload APK uses: actions/upload-artifact@v4 with: - name: DH-Inspeccion-F3.2-0.12.0-debug + name: DH-Inspeccion-F5-0.13.0-debug path: android-app/app/build/outputs/apk/debug/app-debug.apk if-no-files-found: error - retention-days: 14 + retention-days: 30 diff --git a/android-app/app/build.gradle.kts b/android-app/app/build.gradle.kts index 44e2be3..d7ddaa0 100644 --- a/android-app/app/build.gradle.kts +++ b/android-app/app/build.gradle.kts @@ -12,8 +12,8 @@ android { applicationId = "com.korexlabs.dhinspeccion" minSdk = 26 targetSdk = 36 - versionCode = 19 - versionName = "0.12.0" + versionCode = 20 + versionName = "0.13.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/api-v3/src/inspection-visits/f3-field-inventory-structure.service.ts b/api-v3/src/inspection-visits/f3-field-inventory-structure.service.ts index bd77ca9..f1406bf 100644 --- a/api-v3/src/inspection-visits/f3-field-inventory-structure.service.ts +++ b/api-v3/src/inspection-visits/f3-field-inventory-structure.service.ts @@ -44,6 +44,8 @@ const STRUCTURAL_CHILD: Record = { instalacion: 'subinstalacion', }; +const OTHER_FAMILY_SQL = "source_reference LIKE 'SYSTEM:F3.1:OTHER%' OR source_reference LIKE 'F5:SYSTEM:OTHER:%'"; + @Injectable() export class F3FieldInventoryStructureService { constructor( @@ -202,10 +204,10 @@ export class F3FieldInventoryStructureService { return this.dataSource.query(` SELECT id,code,name,level,information_labels AS "informationLabels", source_reference AS "sourceReference", - (source_reference LIKE 'SYSTEM:F3.1:OTHER%') AS "isOther" + (${OTHER_FAMILY_SQL}) AS "isOther" FROM inventory_families WHERE level='INSTALLATION' AND is_active=true - ORDER BY (source_reference LIKE 'SYSTEM:F3.1:OTHER%') ASC,name,code + ORDER BY (${OTHER_FAMILY_SQL}) ASC,name,code `) as Promise; } if (expectedTypeCode === 'subinstalacion') { @@ -219,13 +221,13 @@ export class F3FieldInventoryStructureService { SELECT family.id,family.code,family.name,family.level, family.information_labels AS "informationLabels", family.source_reference AS "sourceReference", - (family.source_reference LIKE 'SYSTEM:F3.1:OTHER%') AS "isOther" + (family.source_reference LIKE 'SYSTEM:F3.1:OTHER%' OR family.source_reference LIKE 'F5:SYSTEM:OTHER:%') AS "isOther" FROM inventory_family_parent_rules rule JOIN inventory_families family ON family.id=rule.child_family_id WHERE rule.parent_family_id=$1::uuid AND family.level='SUBINSTALLATION' AND family.is_active=true - ORDER BY (family.source_reference LIKE 'SYSTEM:F3.1:OTHER%') ASC,family.name,family.code + ORDER BY (family.source_reference LIKE 'SYSTEM:F3.1:OTHER%' OR family.source_reference LIKE 'F5:SYSTEM:OTHER:%') ASC,family.name,family.code `, [parent.inventoryFamilyId]) as Promise; } return []; diff --git a/api-v3/test/unit/f5-android-test-cut.test.ts b/api-v3/test/unit/f5-android-test-cut.test.ts new file mode 100644 index 0000000..3eab7d9 --- /dev/null +++ b/api-v3/test/unit/f5-android-test-cut.test.ts @@ -0,0 +1,28 @@ +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; +import { resolve } from 'node:path'; +import test from 'node:test'; + +function mountedRepoFile(path: string): string { + return readFileSync(resolve(process.cwd(), '..', path), 'utf8'); +} + +test('F5 Android test cut targets production API and has a distinct installable debug version', () => { + const gradle = mountedRepoFile('android-app/app/build.gradle.kts'); + + assert.match(gradle, /versionCode = 20/); + assert.match(gradle, /versionName = "0\.13\.0"/); + assert.match(gradle, /https:\/\/dhv2\.korexlabs\.com\/api\/v3\//); + assert.match(gradle, /applicationIdSuffix = "\.debug"/); +}); + +test('F5 field inventory exposes Other families as reviewable choices to Android', () => { + const service = readFileSync( + resolve(process.cwd(), 'src/inspection-visits/f3-field-inventory-structure.service.ts'), + 'utf8', + ); + + assert.match(service, /F5:SYSTEM:OTHER:%/); + assert.match(service, /AS "isOther"/); + assert.match(service, /isOtherFamily: family\.isOther/); +});