Standardized the upsert and delete pattern across the repo.
This commit is contained in:
@@ -103,13 +103,16 @@ pub async fn delete_by_id<'e, E>(
|
||||
executor: E,
|
||||
app_id: Uuid,
|
||||
id: Uuid,
|
||||
) -> Result<super::dtos::Delete, RepositoryError>
|
||||
) -> Result<Option<UserAppSecret>, RepositoryError>
|
||||
where
|
||||
E: sqlx::Executor<'e, Database = sqlx::Postgres>,
|
||||
{
|
||||
let result = db::delete_by_id(executor, app_id, id).await?.into();
|
||||
let secret = db::delete_by_id(executor, app_id, id)
|
||||
.await?
|
||||
.map(decode)
|
||||
.transpose()?;
|
||||
|
||||
Ok(result)
|
||||
Ok(secret)
|
||||
}
|
||||
|
||||
fn decode(row: UserAppSecretRow) -> Result<UserAppSecret, DecodeError> {
|
||||
|
||||
Reference in New Issue
Block a user