fixes
This commit is contained in:
@@ -24,7 +24,7 @@ func (aH *AccessHandler) AddWorkspace(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if a workspace with this name already exists
|
// Check if a workspace with this name already exists
|
||||||
if aH.dbHandler.Exists(&models.Workspace{}, "workspace", workspace.Name, false) {
|
if aH.dbHandler.Exists(&models.Workspace{}, "name", workspace.Name, false) {
|
||||||
aH.logger.Error("AddWorkspace", fmt.Sprintf("workspace with name %s already exists", workspace.Name))
|
aH.logger.Error("AddWorkspace", fmt.Sprintf("workspace with name %s already exists", workspace.Name))
|
||||||
c.JSON(http.StatusBadRequest, models.NewJsonMessageResponse(fmt.Sprintf("workspace with name %s already exists", workspace.Name)))
|
c.JSON(http.StatusBadRequest, models.NewJsonMessageResponse(fmt.Sprintf("workspace with name %s already exists", workspace.Name)))
|
||||||
return
|
return
|
||||||
@@ -120,7 +120,7 @@ func (aH *AccessHandler) DeleteWorkspace(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, workspace := range request.Workspaces {
|
for _, workspace := range request.Workspaces {
|
||||||
err = aH.dbHandler.DeleteByKey(&models.Workspace{}, "id", workspace, false)
|
err = aH.dbHandler.DeleteByKey(&models.Workspace{}, "id", workspace.Id, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aH.logger.Error("DeleteWorkspace", err)
|
aH.logger.Error("DeleteWorkspace", err)
|
||||||
c.JSON(http.StatusInternalServerError, nil)
|
c.JSON(http.StatusInternalServerError, nil)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ type User struct {
|
|||||||
NewPassword string `gorm:"-" json:"newPassword,omitempty"`
|
NewPassword string `gorm:"-" json:"newPassword,omitempty"`
|
||||||
Expiration string `gorm:"column:expiration" json:"expiration,omitempty"`
|
Expiration string `gorm:"column:expiration" json:"expiration,omitempty"`
|
||||||
Settings Settings `gorm:"type:json" json:"settings"`
|
Settings Settings `gorm:"type:json" json:"settings"`
|
||||||
Workspaces []*Workspace `gorm:"many2many:users_workspaces;" `
|
Workspaces []*Workspace `gorm:"many2many:users_workspaces;" json:"workspaces"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *User) IsValid() bool {
|
func (u *User) IsValid() bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user