Add duplicate detection for new articles and import a new blog post
Implement duplicate slug checking before article creation and add the "Folx Stadl – Sendung 21" article with its content and embed. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 413891e8-d784-4bea-b9f5-91a5a68316b4 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 196c1db7-32c2-4384-81d2-0e7348b04b59 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/f209e72a-0939-48fa-84fc-57854de71967/413891e8-d784-4bea-b9f5-91a5a68316b4/kmpcO4B Replit-Helium-Checkpoint-Created: true
This commit is contained in:
parent
db5ec8b74c
commit
dc99ca0dfc
1
.replit
1
.replit
@ -16,6 +16,7 @@ PORT = "5000"
|
||||
deploymentTarget = "autoscale"
|
||||
run = ["node", "./dist/index.cjs"]
|
||||
build = ["npm", "run", "build"]
|
||||
publicDir = "dist/public"
|
||||
|
||||
[workflows]
|
||||
runButton = "Project"
|
||||
|
||||
BIN
client/public/uploads/folx-stadl-21.jpg
Normal file
BIN
client/public/uploads/folx-stadl-21.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 109 KiB |
@ -71,6 +71,10 @@ export async function registerRoutes(
|
||||
if (!parsed.success) {
|
||||
return res.status(400).json({ message: "Invalid article data", errors: parsed.error.flatten() });
|
||||
}
|
||||
const existing = await storage.getArticleBySlug(parsed.data.slug);
|
||||
if (existing) {
|
||||
return res.status(409).json({ message: `Artikel "${existing.title}" existiert bereits (ID: ${existing.id})` });
|
||||
}
|
||||
const article = await storage.createArticle(parsed.data);
|
||||
res.status(201).json(article);
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user