tangled
alpha
login
or
join now
t1c.dev
/
rocksky
forked from
rocksky.app/rocksky
2
fork
atom
A decentralized music tracking and discovery platform built on AT Protocol 🎵
2
fork
atom
overview
issues
pulls
pipelines
[scrobbler] fix listenbrainz api
tsiry-sandratraina.com
9 months ago
811b76ac
1ebf8727
+14
-3
2 changed files
expand all
collapse all
unified
split
crates
scrobbler
src
repo
user.rs
xata
user.rs
+3
-3
crates/scrobbler/src/repo/user.rs
···
1
1
use anyhow::Error;
2
2
use sqlx::{Pool, Postgres};
3
3
4
4
-
use crate::xata::user::User;
4
4
+
use crate::xata::user::{User, UserWithoutSecret};
5
5
6
6
7
7
pub async fn get_user_by_apikey(pool: &Pool<Postgres>, apikey: &str) -> Result<Option<User>, Error> {
···
22
22
}
23
23
24
24
25
25
-
pub async fn get_user_by_did(pool: &Pool<Postgres>, did: &str) -> Result<Option<User>, Error> {
26
26
-
let results: Vec<User> = sqlx::query_as(r#"
25
25
+
pub async fn get_user_by_did(pool: &Pool<Postgres>, did: &str) -> Result<Option<UserWithoutSecret>, Error> {
26
26
+
let results: Vec<UserWithoutSecret> = sqlx::query_as(r#"
27
27
SELECT * FROM users
28
28
WHERE did = $1
29
29
"#)
+11
crates/scrobbler/src/xata/user.rs
···
12
12
#[serde(with = "chrono::serde::ts_seconds")]
13
13
pub xata_createdat: DateTime<Utc>,
14
14
}
15
15
+
16
16
+
#[derive(Debug, sqlx::FromRow, Serialize, Deserialize, Clone)]
17
17
+
pub struct UserWithoutSecret {
18
18
+
pub xata_id: String,
19
19
+
pub display_name: String,
20
20
+
pub did: String,
21
21
+
pub handle: String,
22
22
+
pub avatar: String,
23
23
+
#[serde(with = "chrono::serde::ts_seconds")]
24
24
+
pub xata_createdat: DateTime<Utc>,
25
25
+
}