4028f0d943
- Reordered actix-web imports to standardize import order - Reordered crate module imports to follow alphabetical ordering - Updated function calls to use multi-line formatting for better readability - Standardized blank lines around documentation comments - Applied consistent formatting to response handling methods - Normalized import organization across all repository-related API files - Improved code consistency and maintainability through standardized formatting - Applied formatting updates to all repository endpoint implementations
35 lines
1.1 KiB
Rust
35 lines
1.1 KiB
Rust
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
use uuid::Uuid;
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, sqlx::FromRow, utoipa::ToSchema)]
|
|
pub struct UserProfile {
|
|
pub user_id: Uuid,
|
|
pub full_name: Option<String>,
|
|
pub company: Option<String>,
|
|
pub location: Option<String>,
|
|
pub website_url: Option<String>,
|
|
pub twitter_username: Option<String>,
|
|
pub timezone: Option<String>,
|
|
pub language: Option<String>,
|
|
pub profile_readme: Option<String>,
|
|
pub created_at: DateTime<Utc>,
|
|
pub updated_at: DateTime<Utc>,
|
|
}
|
|
|
|
impl UserProfile {
|
|
pub async fn find_by_user_id(
|
|
pool: &sqlx::PgPool,
|
|
user_id: Uuid,
|
|
) -> Result<Option<Self>, sqlx::Error> {
|
|
sqlx::query_as::<_, UserProfile>(
|
|
"SELECT user_id, full_name, company, location, website_url, twitter_username, \
|
|
timezone, language, profile_readme, created_at, updated_at \
|
|
FROM user_profile WHERE user_id = $1",
|
|
)
|
|
.bind(user_id)
|
|
.fetch_optional(pool)
|
|
.await
|
|
}
|
|
}
|