v1 blog API routes

This commit is contained in:
ari melody 2025-11-07 19:31:34 +00:00
parent fec3325503
commit eaa2f6587d
Signed by: ari
GPG key ID: CF99829C92678188
9 changed files with 286 additions and 34 deletions

View file

@ -200,7 +200,7 @@ func CreateRelease(app *model.AppState) http.Handler {
}
if release.ID == "" {
http.Error(w, "Release ID cannot be empty\n", http.StatusBadRequest)
http.Error(w, "Release ID cannot be empty", http.StatusBadRequest)
return
}
@ -216,7 +216,7 @@ func CreateRelease(app *model.AppState) http.Handler {
err = controller.CreateRelease(app.DB, &release)
if err != nil {
if strings.Contains(err.Error(), "duplicate key") {
http.Error(w, fmt.Sprintf("Release %s already exists\n", release.ID), http.StatusBadRequest)
http.Error(w, fmt.Sprintf("Release %s already exists", release.ID), http.StatusBadRequest)
return
}
fmt.Printf("WARN: Failed to create release %s: %s\n", release.ID, err)