fix(api): prevent NaN act version during mobile create
Android CI / RC / Android · lint, tests, debug APK, release compile (push) Successful in 3m19s
DH V2 CI / API · typecheck, tests, build (push) Successful in 32s
DH V2 CI / WEB · typecheck, build (push) Successful in 19s
Production dependency audit / API · production dependencies (push) Successful in 8s
Production dependency audit / WEB · production dependencies (push) Successful in 8s
DH V2 CI / Docker / scripts contract (push) Successful in 1m5s

This commit is contained in:
2026-09-14 14:06:26 -03:00
parent 23880521d9
commit 103ecf2fae
6 changed files with 21 additions and 9 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "dhv2-api",
"version": "0.29.0-2",
"version": "0.29.0-3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "dhv2-api",
"version": "0.29.0-2",
"version": "0.29.0-3",
"license": "UNLICENSED",
"dependencies": {
"@nestjs/common": "^11.0.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "dhv2-api",
"version": "0.29.0-2",
"version": "0.29.0-3",
"private": true,
"license": "UNLICENSED",
"scripts": {
@@ -728,10 +728,13 @@ export class InspectionActsService {
principal: AuthPrincipal,
): Promise<number> {
const [row] = (await manager.query(`
UPDATE inspection_acts
SET current_version = current_version + 1
WHERE id = $1
RETURNING current_version AS "versionNumber"
WITH updated AS (
UPDATE inspection_acts
SET current_version = current_version + 1
WHERE id = $1
RETURNING current_version
)
SELECT current_version AS "versionNumber" FROM updated
`, [act.id])) as Array<{ versionNumber: number }>;
const versionNumber = Number(row.versionNumber);
act.currentVersion = versionNumber;
+1 -1
View File
@@ -1,2 +1,2 @@
export const API_VERSION = '0.29.0-2';
export const API_VERSION = '0.29.0-3';
export const API_PHASE = 'F6.1';
+1 -1
View File
@@ -8,5 +8,5 @@ test('health metadata reports the current F6.1 release', () => {
assert.equal(API_PHASE, 'F6.1');
const pkg = JSON.parse(readFileSync(resolve(process.cwd(), 'package.json'), 'utf8')) as { version: string };
assert.equal(API_VERSION, pkg.version);
assert.equal(API_VERSION, '0.29.0-2');
assert.equal(API_VERSION, '0.29.0-3');
});
@@ -63,3 +63,12 @@ test('F6.1 Acta urgency is null while drafting and is persisted atomically at lo
assert.match(migration, /ALTER COLUMN urgency DROP NOT NULL/);
assert.match(migration, /SET urgency=NULL WHERE status='DRAFT'/);
});
test('F6.3 Acta version capture uses a SELECT-shaped CTE so TypeORM never turns the version into NaN', () => {
const service = source('src/inspection-acts/inspection-acts.service.ts');
assert.match(service, /WITH updated AS \(/);
assert.match(service, /RETURNING current_version/);
assert.match(service, /SELECT current_version AS "versionNumber" FROM updated/);
assert.match(service, /const versionNumber = Number\(row\.versionNumber\)/);
});