fix: update release workflow repository and enhance user deletion logic

This commit is contained in:
naiba 2024-11-25 22:24:33 +08:00
parent 0552b69b36
commit 45f11483ec
2 changed files with 9 additions and 2 deletions

View File

@ -146,7 +146,7 @@ jobs:
- uses: robinraju/release-downloader@v1
with:
repository: hamster1963/nezha-dash-react
repository: nezhahq/user-frontend
fileName: dist.zip
latest: true
extract: true

View File

@ -1,6 +1,8 @@
package controller
import (
"slices"
"github.com/gin-gonic/gin"
"golang.org/x/crypto/bcrypt"
@ -97,9 +99,14 @@ func createUser(c *gin.Context) (uint64, error) {
// @Success 200 {object} model.CommonResponse[any]
// @Router /batch-delete/user [post]
func batchDeleteUser(c *gin.Context) (any, error) {
var ids []uint
var ids []uint64
if err := c.ShouldBindJSON(&ids); err != nil {
return nil, err
}
auth := c.MustGet(model.CtxKeyAuthorizedUser).(*model.User)
if slices.Contains(ids, auth.ID) {
return nil, singleton.Localizer.ErrorT("can't delete yourself")
}
return nil, singleton.DB.Where("id IN (?)", ids).Delete(&model.User{}).Error
}