Skip to content

Commit

Permalink
Fix build (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-t-wang authored Jan 6, 2025
1 parent 2461378 commit 374d31c
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 61 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

24 changes: 23 additions & 1 deletion src/routes/api/v1/query_single.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,29 @@ pub async fn query_single(
) -> Result<Response, ErrorResponse> {
if let Some(name) = sqlx::query_as!(
Name,
"SELECT * FROM names WHERE username = $1 UNION ALL SELECT * FROM names WHERE address = $1 AND username <> $1",
r#"
SELECT
username as "username!",
address as "address!",
profile_picture_url,
nullifier_hash as "nullifier_hash!",
verification_level as "verification_level!",
created_at as "created_at!",
updated_at as "updated_at!"
FROM names
WHERE username = $1
UNION ALL
SELECT
username as "username!",
address as "address!",
profile_picture_url,
nullifier_hash as "nullifier_hash!",
verification_level as "verification_level!",
created_at as "created_at!",
updated_at as "updated_at!"
FROM names
WHERE address = $1 AND username <> $1
"#,
validate_address(&name_or_address)
)
.fetch_optional(&db.read_only)
Expand Down
4 changes: 2 additions & 2 deletions src/types/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ use url::Url;
/// A registered username.
#[derive(Debug, FromRow, PgInsert)]
pub struct Name {
/// Checksummed address of the owner.
/// Check-summed address of the owner.
pub address: String,
/// World App username of the owner.
pub username: String,
/// URL of the owner's profile picture.
pub profile_picture_url: Option<String>,
/// The nullifier hash of the proof that was used to register this name.
pub nullifier_hash: String,
/// The verificaiton level of the proof that was used to register this name.
/// The verification level of the proof that was used to register this name.
pub verification_level: String,
/// The time at which this name was registered.
pub created_at: chrono::NaiveDateTime,
Expand Down

0 comments on commit 374d31c

Please sign in to comment.