fix: Repo-only-Projekte bekommen keine Subdomain vom Webhook; WOID numerisch
- Webhook: Subdomain-Fallback auf Repo-Name nur noch bei aktivierter Preview, Projekte ohne Website behalten leere Subdomain/previewUrl - generateNextWoid: numerisches Maximum statt String-Sortierung (gemischt 5-/6-stellige WOIDs im Bestand) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -58,7 +58,9 @@ router.post('/gitea', async (req, res) => {
|
||||
const previewConfigFile = await fetchPreviewConfig(repoFullName, branch)
|
||||
const previewConfig = previewConfigFile || defaultPreviewConfig(repoFullName)
|
||||
const hasPreview = Boolean(previewConfigFile?.enabled !== false && previewConfigFile)
|
||||
const subdomain = previewConfig.subdomain || repoFullName.split('/').pop()
|
||||
// Nur Projekte mit aktivierter Preview bekommen eine Subdomain zugewiesen -
|
||||
// Repo-only-Projekte (enabled:false, keine Subdomain) bleiben ohne Website.
|
||||
const subdomain = hasPreview ? previewConfig.subdomain || repoFullName.split('/').pop() : ''
|
||||
const previewUrl = subdomain ? buildPreviewUrl(subdomain) : ''
|
||||
|
||||
let deployResult = { deployed: false, skipped: true }
|
||||
|
||||
@@ -11,12 +11,14 @@ import {
|
||||
const WOID_BASE = 9999
|
||||
|
||||
async function generateNextWoid() {
|
||||
const docs = await listDocuments(config.collections.workorders, [
|
||||
Query.orderDesc('woid'),
|
||||
Query.limit(1),
|
||||
])
|
||||
const highest = docs[0]?.woid ? parseInt(docs[0].woid, 10) : WOID_BASE
|
||||
return String(Math.max(WOID_BASE, highest) + 1)
|
||||
// Numerisches Maximum ueber alle Tickets - orderDesc('woid') sortiert Strings
|
||||
// und liefert bei gemischt 5-/6-stelligen WOIDs falsche Ergebnisse.
|
||||
const docs = await listDocuments(config.collections.workorders, [Query.limit(1000)])
|
||||
const highest = docs.reduce((max, doc) => {
|
||||
const n = parseInt(doc.woid, 10)
|
||||
return Number.isNaN(n) ? max : Math.max(max, n)
|
||||
}, WOID_BASE)
|
||||
return String(highest + 1)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user