From bde5aea211e9838b4511a2b57c6a256fe89b66ab Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Thu, 17 Oct 2024 02:19:23 -0400 Subject: 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. --- src/invite/repo.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/invite/repo.rs') 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) -- cgit v1.2.3