diff options
| author | Santo Cariotti <santo@dcariotti.me> | 2022-09-18 16:32:13 +0000 |
|---|---|---|
| committer | Santo Cariotti <santo@dcariotti.me> | 2022-09-18 16:32:13 +0000 |
| commit | d6490fe2887d96651d25a16d773d8fbefee073a8 (patch) | |
| tree | ee06ac10c63fd869a9f8b94675860fa88f59bebc /src | |
| parent | 0343c9b700c145d3f76b6fffc0c3141e516a78c9 (diff) | |
Show users avatar on get models
Diffstat (limited to 'src')
| -rw-r--r-- | src/models/model.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/models/model.rs b/src/models/model.rs index f8e7057..828dfc2 100644 --- a/src/models/model.rs +++ b/src/models/model.rs @@ -129,7 +129,7 @@ impl Model { r#" SELECT models.*, - json_build_object('id', users.id, 'email', users.email, 'username', users.username, 'is_staff', users.is_staff) as author, + json_build_object('id', users.id, 'email', users.email, 'username', users.username, 'is_staff', users.is_staff, 'avatar', users.avatar) as author, json_agg(uploads.*) filter (where uploads.* is not null) as uploads FROM models JOIN users ON users.id = models.author_id @@ -151,7 +151,7 @@ impl Model { r#" SELECT models.*, - json_build_object('id', users.id, 'email', users.email, 'username', users.username, 'is_staff', users.is_staff) as author, + json_build_object('id', users.id, 'email', users.email, 'username', users.username, 'is_staff', users.is_staff, 'avatar', users.avatar) as author, json_agg(uploads.*) filter (where uploads.* is not null) as uploads FROM models JOIN users ON users.id = models.author_id |
