Fix Sync All to update gitea_commit_sha in endpoint_versions
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -389,7 +389,22 @@ class GiteaService {
|
||||
|
||||
for (const ep of result.rows) {
|
||||
try {
|
||||
await this.commitEndpointFiles(ep, cfg.prod_branch || 'main', `Sync: ${ep.name}`);
|
||||
const sha = await this.commitEndpointFiles(ep, cfg.prod_branch || 'main', `Sync: ${ep.name}`);
|
||||
// Mark published version as synced
|
||||
if (sha && ep.published_version_id) {
|
||||
await mainPool.query(
|
||||
'UPDATE endpoint_versions SET gitea_commit_sha = $1 WHERE id = $2',
|
||||
[sha, ep.published_version_id]
|
||||
);
|
||||
} else if (sha) {
|
||||
// No published version yet — mark the latest version
|
||||
await mainPool.query(
|
||||
`UPDATE endpoint_versions SET gitea_commit_sha = $1
|
||||
WHERE endpoint_id = $2 AND gitea_commit_sha IS NULL
|
||||
ORDER BY version_number DESC LIMIT 1`,
|
||||
[sha, ep.id]
|
||||
);
|
||||
}
|
||||
synced++;
|
||||
} catch (err: any) {
|
||||
errors.push(`${ep.name}: ${err.message}`);
|
||||
|
||||
Reference in New Issue
Block a user