bug fix
This commit is contained in:
@@ -65,7 +65,7 @@ func (ct *Tag) Create(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
t := f.ToTag()
|
t := f.ToTag()
|
||||||
u := service.AllService.UserService.CurUser(c)
|
u := service.AllService.UserService.CurUser(c)
|
||||||
if !service.AllService.UserService.IsAdmin(u) {
|
if !service.AllService.UserService.IsAdmin(u) || t.UserId == 0 {
|
||||||
t.UserId = u.Id
|
t.UserId = u.Id
|
||||||
}
|
}
|
||||||
err := service.AllService.TagService.Create(t)
|
err := service.AllService.TagService.Create(t)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ type TagForm struct {
|
|||||||
Id uint `json:"id"`
|
Id uint `json:"id"`
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
Color uint `json:"color" validate:"required"`
|
Color uint `json:"color" validate:"required"`
|
||||||
UserId uint `json:"user_id" validate:"required"`
|
UserId uint `json:"user_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *TagForm) FromTag(group *model.Tag) *TagForm {
|
func (f *TagForm) FromTag(group *model.Tag) *TagForm {
|
||||||
|
|||||||
Reference in New Issue
Block a user