Add delete endpoints and clean up filters
This commit is contained in:
@@ -62,6 +62,13 @@ impl Model for Shop {
|
||||
.await?)
|
||||
}
|
||||
|
||||
#[instrument(level = "debug", skip(db))]
|
||||
async fn delete(db: &PgPool, id: i32) -> Result<u64> {
|
||||
Ok(sqlx::query!("DELETE FROM shops WHERE id = $1", id)
|
||||
.execute(db)
|
||||
.await?)
|
||||
}
|
||||
|
||||
#[instrument(level = "debug", skip(db))]
|
||||
async fn list(db: &PgPool, list_params: ListParams) -> Result<Vec<Self>> {
|
||||
let result = if let Some(order_by) = list_params.get_order_by() {
|
||||
|
||||
Reference in New Issue
Block a user