feat: now GetUser returnes all the image info
This commit is contained in:
parent
673ce48fac
commit
3aafab36c2
6 changed files with 63 additions and 33 deletions
|
|
@ -224,19 +224,31 @@ func (q *Queries) GetTitleTags(ctx context.Context, titleID int64) ([]json.RawMe
|
|||
}
|
||||
|
||||
const getUserByID = `-- name: GetUserByID :one
|
||||
SELECT id, avatar_id, mail, nickname, disp_name, user_desc, creation_date
|
||||
FROM users
|
||||
WHERE id = $1
|
||||
SELECT
|
||||
t.id as id,
|
||||
t.avatar_id as avatar_id,
|
||||
t.mail as mail,
|
||||
t.nickname as nickname,
|
||||
t.disp_name as disp_name,
|
||||
t.user_desc as user_desc,
|
||||
t.creation_date as creation_date,
|
||||
i.storage_type as storage_type,
|
||||
i.image_path as image_path
|
||||
FROM users as t
|
||||
LEFT JOIN images as i ON (t.avatar_id = i.id)
|
||||
WHERE id = $1::bigint
|
||||
`
|
||||
|
||||
type GetUserByIDRow struct {
|
||||
ID int64 `json:"id"`
|
||||
AvatarID *int64 `json:"avatar_id"`
|
||||
Mail *string `json:"mail"`
|
||||
Nickname string `json:"nickname"`
|
||||
DispName *string `json:"disp_name"`
|
||||
UserDesc *string `json:"user_desc"`
|
||||
CreationDate time.Time `json:"creation_date"`
|
||||
ID int64 `json:"id"`
|
||||
AvatarID *int64 `json:"avatar_id"`
|
||||
Mail *string `json:"mail"`
|
||||
Nickname string `json:"nickname"`
|
||||
DispName *string `json:"disp_name"`
|
||||
UserDesc *string `json:"user_desc"`
|
||||
CreationDate time.Time `json:"creation_date"`
|
||||
StorageType *StorageTypeT `json:"storage_type"`
|
||||
ImagePath *string `json:"image_path"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetUserByID(ctx context.Context, id int64) (GetUserByIDRow, error) {
|
||||
|
|
@ -250,6 +262,8 @@ func (q *Queries) GetUserByID(ctx context.Context, id int64) (GetUserByIDRow, er
|
|||
&i.DispName,
|
||||
&i.UserDesc,
|
||||
&i.CreationDate,
|
||||
&i.StorageType,
|
||||
&i.ImagePath,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue