feat: getusertitles now must return all the title info
This commit is contained in:
parent
258eb749d9
commit
ba68b5ee04
3 changed files with 14 additions and 14 deletions
|
|
@ -424,9 +424,8 @@ components:
|
||||||
user_id:
|
user_id:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
title_id:
|
title:
|
||||||
type: integer
|
$ref: '#/components/schemas/Title'
|
||||||
format: int64
|
|
||||||
status:
|
status:
|
||||||
$ref: '#/components/schemas/UserTitleStatus'
|
$ref: '#/components/schemas/UserTitleStatus'
|
||||||
rate:
|
rate:
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ type UserTitle struct {
|
||||||
|
|
||||||
// Status User's title status
|
// Status User's title status
|
||||||
Status UserTitleStatus `json:"status"`
|
Status UserTitleStatus `json:"status"`
|
||||||
TitleId int64 `json:"title_id"`
|
Title *Title `json:"title,omitempty"`
|
||||||
UserId int64 `json:"user_id"`
|
UserId int64 `json:"user_id"`
|
||||||
AdditionalProperties map[string]interface{} `json:"-"`
|
AdditionalProperties map[string]interface{} `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
@ -493,12 +493,12 @@ func (a *UserTitle) UnmarshalJSON(b []byte) error {
|
||||||
delete(object, "status")
|
delete(object, "status")
|
||||||
}
|
}
|
||||||
|
|
||||||
if raw, found := object["title_id"]; found {
|
if raw, found := object["title"]; found {
|
||||||
err = json.Unmarshal(raw, &a.TitleId)
|
err = json.Unmarshal(raw, &a.Title)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error reading 'title_id': %w", err)
|
return fmt.Errorf("error reading 'title': %w", err)
|
||||||
}
|
}
|
||||||
delete(object, "title_id")
|
delete(object, "title")
|
||||||
}
|
}
|
||||||
|
|
||||||
if raw, found := object["user_id"]; found {
|
if raw, found := object["user_id"]; found {
|
||||||
|
|
@ -554,9 +554,11 @@ func (a UserTitle) MarshalJSON() ([]byte, error) {
|
||||||
return nil, fmt.Errorf("error marshaling 'status': %w", err)
|
return nil, fmt.Errorf("error marshaling 'status': %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
object["title_id"], err = json.Marshal(a.TitleId)
|
if a.Title != nil {
|
||||||
if err != nil {
|
object["title"], err = json.Marshal(a.Title)
|
||||||
return nil, fmt.Errorf("error marshaling 'title_id': %w", err)
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error marshaling 'title': %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object["user_id"], err = json.Marshal(a.UserId)
|
object["user_id"], err = json.Marshal(a.UserId)
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,8 @@ properties:
|
||||||
user_id:
|
user_id:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
title_id:
|
title:
|
||||||
type: integer
|
$ref: ./Title.yaml
|
||||||
format: int64
|
|
||||||
status:
|
status:
|
||||||
$ref: ./enums/UserTitleStatus.yaml
|
$ref: ./enums/UserTitleStatus.yaml
|
||||||
rate:
|
rate:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue