Changeset 0.17.1 (#76)

This commit is contained in:
2026-02-28 01:40:31 +00:00
parent c9141a6896
commit 856dc9b0ac
64 changed files with 8037 additions and 1657 deletions

View File

@@ -3,10 +3,10 @@ package handlers
import (
"database/sql"
"net/http"
"strings"
"github.com/gin-gonic/gin"
"git.gobha.me/xcaliber/chat-switchboard/database"
"git.gobha.me/xcaliber/chat-switchboard/models"
"git.gobha.me/xcaliber/chat-switchboard/store"
)
@@ -88,7 +88,7 @@ func (h *GroupHandler) CreateGroup(c *gin.Context) {
}
if err := h.stores.Groups.Create(c.Request.Context(), g); err != nil {
if strings.Contains(err.Error(), "duplicate key") {
if database.IsUniqueViolation(err) {
c.JSON(http.StatusConflict, gin.H{"error": "group name already exists in this scope"})
return
}
@@ -142,7 +142,7 @@ func (h *GroupHandler) UpdateGroup(c *gin.Context) {
return
}
if err != nil {
if strings.Contains(err.Error(), "duplicate key") {
if database.IsUniqueViolation(err) {
c.JSON(http.StatusConflict, gin.H{"error": "group name already exists in this scope"})
return
}