mirror of
https://github.com/Dvorinka/Containr.git
synced 2026-10-28 07:41:27 +00:00
feat(notifications): persistent notification center
- notifications table (goose migration) + sqlc queries; list with unread count, mark-one, mark-all endpoints under /notifications. - Deployment success/failure now writes a notification row for the owner (insertUserNotification — best-effort, never breaks the deploy flow). - Shell bell reads the real persisted feed: unread badge, click-to-read, mark-all, 30s polling. Replaces the transient builds+audit derivation. Verified e2e: migration applies clean, list/read/read-all round-trips. Authored By: TDvorak <[email protected]>
This commit is contained in:
1 parent
08d92fb10f
commit
07ac54aa05
14 files changed
+685
-45
No files matched your search
@@ -4,6 +4,7 @@ import (
|
||||
"containr/internal/database"
|
||||
"containr/internal/deployment"
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -368,12 +369,19 @@ func runDeploymentAndSync(
|
||||
`UPDATE services SET status = 'running', updated_at = $1 WHERE id = $2`,
|
||||
time.Now(), service.ID,
|
||||
)
|
||||
insertUserNotification(db, userID, "deployment", "Deployment succeeded",
|
||||
fmt.Sprintf("Service %s is now running.", service.Name), "service", service.ID.String())
|
||||
return
|
||||
case "failed":
|
||||
_, _ = db.Exec(
|
||||
`UPDATE services SET status = 'failed', updated_at = $1 WHERE id = $2`,
|
||||
time.Now(), service.ID,
|
||||
)
|
||||
body := fmt.Sprintf("Service %s failed to deploy.", service.Name)
|
||||
if current.Error != "" {
|
||||
body = fmt.Sprintf("Service %s failed to deploy: %s", service.Name, current.Error)
|
||||
}
|
||||
insertUserNotification(db, userID, "deployment", "Deployment failed", body, "service", service.ID.String())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user