From ba68b5ee0465fd70e15d229591df9d8dfaacba64 Mon Sep 17 00:00:00 2001 From: Iron_Felix Date: Sat, 22 Nov 2025 07:09:30 +0300 Subject: [PATCH] feat: getusertitles now must return all the title info --- api/_build/openapi.yaml | 5 ++--- api/api.gen.go | 18 ++++++++++-------- api/schemas/UserTitle.yaml | 5 ++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/api/_build/openapi.yaml b/api/_build/openapi.yaml index c059166..c07dbbc 100644 --- a/api/_build/openapi.yaml +++ b/api/_build/openapi.yaml @@ -424,9 +424,8 @@ components: user_id: type: integer format: int64 - title_id: - type: integer - format: int64 + title: + $ref: '#/components/schemas/Title' status: $ref: '#/components/schemas/UserTitleStatus' rate: diff --git a/api/api.gen.go b/api/api.gen.go index e56f6b8..320e7a2 100644 --- a/api/api.gen.go +++ b/api/api.gen.go @@ -143,7 +143,7 @@ type UserTitle struct { // Status User's title status Status UserTitleStatus `json:"status"` - TitleId int64 `json:"title_id"` + Title *Title `json:"title,omitempty"` UserId int64 `json:"user_id"` AdditionalProperties map[string]interface{} `json:"-"` } @@ -493,12 +493,12 @@ func (a *UserTitle) UnmarshalJSON(b []byte) error { delete(object, "status") } - if raw, found := object["title_id"]; found { - err = json.Unmarshal(raw, &a.TitleId) + if raw, found := object["title"]; found { + err = json.Unmarshal(raw, &a.Title) 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 { @@ -554,9 +554,11 @@ func (a UserTitle) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("error marshaling 'status': %w", err) } - object["title_id"], err = json.Marshal(a.TitleId) - if err != nil { - return nil, fmt.Errorf("error marshaling 'title_id': %w", err) + if a.Title != nil { + object["title"], err = json.Marshal(a.Title) + if err != nil { + return nil, fmt.Errorf("error marshaling 'title': %w", err) + } } object["user_id"], err = json.Marshal(a.UserId) diff --git a/api/schemas/UserTitle.yaml b/api/schemas/UserTitle.yaml index 658e350..3beaec6 100644 --- a/api/schemas/UserTitle.yaml +++ b/api/schemas/UserTitle.yaml @@ -7,9 +7,8 @@ properties: user_id: type: integer format: int64 - title_id: - type: integer - format: int64 + title: + $ref: ./Title.yaml status: $ref: ./enums/UserTitleStatus.yaml rate: