Skip to content

Commit 8afd644

Browse files
committed
Vaporize outdated agencies.json from existence
1 parent 690da90 commit 8afd644

3 files changed

Lines changed: 16 additions & 173 deletions

File tree

.sqlx/query-fcd0f86c82eccae68150db9c713c94202f946bb80b3caf9cd13e068bcf5d998f.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

agencies.json

Lines changed: 0 additions & 155 deletions
This file was deleted.

src/utils/database.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,24 @@ impl Client {
1515
}
1616

1717
/// Adds a user, a.k.a 'Passenger' to the database
18-
pub async fn add_user(pool: &PgPool, user: User) -> Result<UserId, Error> {
19-
sqlx::query!(
18+
pub async fn add_user(self: Self, user: User) -> Result<UserId, Error> {
19+
sqlx::query(
2020
r#"INSERT INTO users(id) VALUES ( $1 )"#,
21-
user.id.get() as i32
2221
)
23-
.execute(pool)
22+
.bind(user.id.get() as i32)
23+
.execute(&self.pool)
24+
.await?;
25+
26+
Ok(user.id)
27+
}
28+
29+
/// Gets a user, a.k.a 'Passenger' from the database
30+
pub async fn get_user(self: Self, user: User) -> Result<UserId, Error> {
31+
sqlx::query(
32+
r#"SELECT * FROM users WHERE id = $1"#,
33+
)
34+
.bind(user.id.get() as i32)
35+
.execute(&self.pool)
2436
.await?;
2537

2638
Ok(user.id)

0 commit comments

Comments
 (0)