refactor(domain): remove public_key/private_key from User model — managed by federation adapter
This commit is contained in:
@@ -31,8 +31,6 @@ pub(crate) struct UserRow {
|
||||
pub local: bool,
|
||||
pub ap_id: Option<String>,
|
||||
pub inbox_url: Option<String>,
|
||||
pub public_key: Option<String>,
|
||||
pub private_key: Option<String>,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
@@ -52,15 +50,13 @@ impl From<UserRow> for User {
|
||||
local: r.local,
|
||||
ap_id: r.ap_id,
|
||||
inbox_url: r.inbox_url,
|
||||
public_key: r.public_key,
|
||||
private_key: r.private_key,
|
||||
created_at: r.created_at,
|
||||
updated_at: r.updated_at,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const USER_SELECT: &str = "SELECT id,username,email,password_hash,display_name,bio,avatar_url,header_url,custom_css,local,ap_id,inbox_url,public_key,private_key,created_at,updated_at FROM users";
|
||||
const USER_SELECT: &str = "SELECT id,username,email,password_hash,display_name,bio,avatar_url,header_url,custom_css,local,ap_id,inbox_url,created_at,updated_at FROM users";
|
||||
|
||||
#[async_trait]
|
||||
impl UserRepository for PgUserRepository {
|
||||
@@ -93,15 +89,14 @@ impl UserRepository for PgUserRepository {
|
||||
|
||||
async fn save(&self, user: &User) -> Result<(), DomainError> {
|
||||
sqlx::query(
|
||||
"INSERT INTO users (id,username,email,password_hash,display_name,bio,avatar_url,header_url,custom_css,local,ap_id,inbox_url,public_key,private_key,created_at,updated_at)
|
||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16)
|
||||
"INSERT INTO users (id,username,email,password_hash,display_name,bio,avatar_url,header_url,custom_css,local,ap_id,inbox_url,created_at,updated_at)
|
||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14)
|
||||
ON CONFLICT(id) DO UPDATE SET
|
||||
username=EXCLUDED.username, email=EXCLUDED.email,
|
||||
password_hash=EXCLUDED.password_hash, display_name=EXCLUDED.display_name,
|
||||
bio=EXCLUDED.bio, avatar_url=EXCLUDED.avatar_url,
|
||||
header_url=EXCLUDED.header_url, custom_css=EXCLUDED.custom_css,
|
||||
local=EXCLUDED.local, ap_id=EXCLUDED.ap_id, inbox_url=EXCLUDED.inbox_url,
|
||||
public_key=EXCLUDED.public_key, private_key=EXCLUDED.private_key,
|
||||
updated_at=NOW()"
|
||||
)
|
||||
.bind(user.id.as_uuid())
|
||||
@@ -116,8 +111,6 @@ impl UserRepository for PgUserRepository {
|
||||
.bind(user.local)
|
||||
.bind(&user.ap_id)
|
||||
.bind(&user.inbox_url)
|
||||
.bind(&user.public_key)
|
||||
.bind(&user.private_key)
|
||||
.bind(user.created_at)
|
||||
.bind(user.updated_at)
|
||||
.execute(&self.pool)
|
||||
|
||||
Reference in New Issue
Block a user