fix response format
This commit is contained in:
@@ -23,7 +23,7 @@ func (h *Handler) GetCurrentUser(c echo.Context) error {
|
|||||||
|
|
||||||
u := new(model.User)
|
u := new(model.User)
|
||||||
|
|
||||||
tx := h.DB.Where("id = ?", userId).First(&u)
|
tx := h.DB.Preload("Position").Where("id = ?", userId).First(&u)
|
||||||
|
|
||||||
if tx.RowsAffected == 0 {
|
if tx.RowsAffected == 0 {
|
||||||
return c.NoContent(http.StatusNotFound)
|
return c.NoContent(http.StatusNotFound)
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Organization struct {
|
type Organization struct {
|
||||||
gorm.Model
|
gorm.Model `json:"meta"`
|
||||||
ID uuid.UUID `gorm:"type:uuid;default:gen_random_uuid();primarykey"`
|
ID uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid();primarykey"`
|
||||||
Name string `json:"name" gorm:"unique;index"`
|
Name string `json:"name" gorm:"unique;index"`
|
||||||
ParentID uuid.UUID `json:"parent_id"`
|
ParentID uuid.UUID `json:"parent_id"`
|
||||||
Positions []Position `json:"positions,omitempty"`
|
Positions []Position `json:"positions,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type OrganizationApi struct {
|
type OrganizationApi struct {
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Position struct {
|
type Position struct {
|
||||||
gorm.Model
|
gorm.Model `json:"meta"`
|
||||||
ID uuid.UUID `gorm:"type:uuid;default:gen_random_uuid();primarykey"`
|
ID uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid();primarykey"`
|
||||||
Name string `json:"name" gorm:"unique;index"`
|
Name string `json:"name" gorm:"unique;index"`
|
||||||
RightMask int `json:"right_mask"`
|
RightMask int `json:"right_mask"`
|
||||||
OrganizationID uuid.UUID `json:"organization_id" gorm:"index;not null"`
|
OrganizationID uuid.UUID `json:"organization_id" gorm:"index;not null"`
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
User struct {
|
User struct {
|
||||||
gorm.Model
|
gorm.Model `json:"meta"`
|
||||||
ID uuid.UUID `gorm:"type:uuid;default:gen_random_uuid();primarykey"`
|
ID uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid();primarykey"`
|
||||||
APIUser
|
APIUser
|
||||||
Position Position `gorm:"-:migration"`
|
Position Position `gorm:"-:migration"`
|
||||||
Avatar string `json:"avatar"`
|
Avatar string `json:"avatar"`
|
||||||
|
|||||||
Reference in New Issue
Block a user