Changeset 0.8.6 (#49)
This commit is contained in:
@@ -128,7 +128,7 @@ func (h *PresetHandler) CreateUserPreset(c *gin.Context) {
|
||||
var count int
|
||||
err := database.DB.QueryRow(`
|
||||
SELECT COUNT(*) FROM api_configs
|
||||
WHERE id = $1 AND (user_id = $2 OR is_global = true OR user_id IS NULL) AND is_active = true
|
||||
WHERE id = $1 AND (user_id = $2 OR is_global = true) AND is_active = true AND team_id IS NULL
|
||||
`, *req.APIConfigID, userID).Scan(&count)
|
||||
if err != nil || count == 0 {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "invalid or inaccessible API config"})
|
||||
@@ -342,7 +342,7 @@ func (h *PresetHandler) CreateAdminPreset(c *gin.Context) {
|
||||
var count int
|
||||
err := database.DB.QueryRow(`
|
||||
SELECT COUNT(*) FROM api_configs
|
||||
WHERE id = $1 AND (is_global = true OR user_id IS NULL) AND is_active = true
|
||||
WHERE id = $1 AND is_global = true AND is_active = true AND team_id IS NULL
|
||||
`, *req.APIConfigID).Scan(&count)
|
||||
if err != nil || count == 0 {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "global presets must use a global API config"})
|
||||
|
||||
Reference in New Issue
Block a user