diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2024-10-17 02:19:23 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2024-10-17 02:19:23 -0400 |
| commit | bde5aea211e9838b4511a2b57c6a256fe89b66ab (patch) | |
| tree | 729caf0811cea28d639c893034586e79dfc71392 /src/invite/repo.rs | |
| parent | ea74daca4809e4008dd8d01039db9fff3be659d9 (diff) | |
Get loaded data using `export let data`, instead of fishing around in $page.
This is mostly a how-to-Svelte thing.
I've also made the API responses for invites a bit more caller-friendly by flattening them and adding the ID field into them. The ID is redundant (the client knows it because the client has the invitation URL), but it makes presenting invitations and actioning them a bit easier.
Diffstat (limited to 'src/invite/repo.rs')
| -rw-r--r-- | src/invite/repo.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/invite/repo.rs b/src/invite/repo.rs index 2ab993f..643f5b7 100644 --- a/src/invite/repo.rs +++ b/src/invite/repo.rs @@ -68,6 +68,7 @@ impl<'c> Invites<'c> { let invite = sqlx::query!( r#" select + invite.id as "invite_id: Id", issuer.id as "issuer_id: login::Id", issuer.name as "issuer_name", invite.issued_at as "invite_issued_at: DateTime" @@ -78,10 +79,8 @@ impl<'c> Invites<'c> { invite, ) .map(|row| Summary { - issuer: Login { - id: row.issuer_id, - name: row.issuer_name, - }, + id: row.invite_id, + issuer: row.issuer_name, issued_at: row.invite_issued_at, }) .fetch_one(&mut *self.0) |
