summaryrefslogtreecommitdiff
path: root/src/token/repo/token.rs
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-03-24 23:33:36 -0400
committerOwen Jacobson <owen@grimoire.ca>2025-03-24 23:33:36 -0400
commit45eea07a56022f647b3a273798a5255cda73f13d (patch)
tree0606cd011204ca263c550585f743903f0e0c8a1c /src/token/repo/token.rs
parentc3d774545cefd6168cfdc69c128a84bf9dee4776 (diff)
Rename a bunch of straggler references to `login`.
Diffstat (limited to 'src/token/repo/token.rs')
-rw-r--r--src/token/repo/token.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/token/repo/token.rs b/src/token/repo/token.rs
index 145ba2d..e49c2d4 100644
--- a/src/token/repo/token.rs
+++ b/src/token/repo/token.rs
@@ -27,12 +27,12 @@ impl Tokens<'_> {
// be used to control expiry, until the token is actually used.
pub async fn issue(
&mut self,
- login: &History,
+ user: &History,
issued_at: &DateTime,
) -> Result<Secret, sqlx::Error> {
let id = Id::generate();
let secret = Uuid::new_v4().to_string();
- let login = login.id();
+ let user = user.id();
let secret = sqlx::query_scalar!(
r#"
@@ -43,7 +43,7 @@ impl Tokens<'_> {
"#,
id,
secret,
- login,
+ user,
issued_at,
)
.fetch_one(&mut *self.0)
@@ -85,8 +85,8 @@ impl Tokens<'_> {
}
// Revoke tokens for a login
- pub async fn revoke_all(&mut self, login: &user::History) -> Result<Vec<Id>, sqlx::Error> {
- let login = login.id();
+ pub async fn revoke_all(&mut self, user: &user::History) -> Result<Vec<Id>, sqlx::Error> {
+ let user = user.id();
let tokens = sqlx::query_scalar!(
r#"
delete
@@ -94,7 +94,7 @@ impl Tokens<'_> {
where user = $1
returning id as "id: Id"
"#,
- login,
+ user,
)
.fetch_all(&mut *self.0)
.await?;
@@ -132,7 +132,7 @@ impl Tokens<'_> {
// sqlite3, as of this writing, does not allow an update's `returning`
// clause to reference columns from tables joined into the update. Two
// queries is fine, but it feels untidy.
- let (token, login) = sqlx::query!(
+ let (token, user) = sqlx::query!(
r#"
update token
set last_used_at = $1
@@ -148,7 +148,7 @@ impl Tokens<'_> {
.fetch_one(&mut *self.0)
.await?;
- let login = sqlx::query!(
+ let user = sqlx::query!(
r#"
select
id as "id: user::Id",
@@ -159,7 +159,7 @@ impl Tokens<'_> {
from user
where id = $1
"#,
- login,
+ user,
)
.map(|row| {
Ok::<_, name::Error>(History {
@@ -173,7 +173,7 @@ impl Tokens<'_> {
.fetch_one(&mut *self.0)
.await??;
- Ok((token, login))
+ Ok((token, user))
}
}