33 lines
1.5 KiB
PowerShell
33 lines
1.5 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
$api = Get-Content -LiteralPath (Join-Path $root 'utils/api.js') -Raw -Encoding UTF8
|
|
$t04 = Get-Content -LiteralPath (Join-Path $root 'pages/tree/t04-add-relative.vue') -Raw -Encoding UTF8
|
|
$t05 = Get-Content -LiteralPath (Join-Path $root 'pages/tree/t05-edit-member.vue') -Raw -Encoding UTF8
|
|
|
|
foreach ($required in @(
|
|
'const normalizeLineageWritePayload = (payload) =>',
|
|
"const lineageRelationPath = Object.freeze({",
|
|
"FATHER: 'parents'",
|
|
"SPOUSE: 'spouses'",
|
|
"SIBLING: 'siblings'",
|
|
"SON: 'children'",
|
|
'async createRelatedPerson(genealogyId, personId, relationType, payload, requestOptions = {})',
|
|
'async updatePerson(genealogyId, personId, payload, requestOptions = {})',
|
|
'method: ''PUT''',
|
|
'requestStrict({'
|
|
)) {
|
|
if (-not $api.Contains($required)) { throw "Lineage Apifox write contract missing: $required" }
|
|
}
|
|
|
|
foreach ($forbidden in @('relationType: relationType.value', 'sex: addForm.gender', 'sortOrder:')) {
|
|
if ($t04.Contains($forbidden)) { throw "T04 must not guess unsupported wire field: $forbidden" }
|
|
}
|
|
|
|
foreach ($required in @('appApi.createRelatedPerson(', 'appApi.createPerson(', 'appApi.updatePerson(', 'failedAction.value = "save"')) {
|
|
$source = if ($required -eq 'appApi.updatePerson(' -or $required -eq 'failedAction.value = "save"') { $t05 } else { $t04 }
|
|
if (-not $source.Contains($required)) { throw "Lineage write page missing: $required" }
|
|
}
|
|
|
|
Write-Output 'LINEAGE-WRITE-APIFOX-CONTRACT PASS'
|