Can delete inbox entry
This commit is contained in:
parent
6c41b66d1c
commit
6e0d0fb48d
@ -56,3 +56,9 @@ pub async fn update(
|
||||
|
||||
Ok(HttpResponse::Ok().json(inbox_service::get_by_id(inbox_entry.as_ref().id()).await?))
|
||||
}
|
||||
|
||||
/// Delete a single inbox entry
|
||||
pub async fn delete(inbox_entry: InboxEntryInPath) -> HttpResult {
|
||||
inbox_service::delete(inbox_entry.as_ref().id()).await?;
|
||||
Ok(HttpResponse::Accepted().finish())
|
||||
}
|
||||
|
@ -166,6 +166,10 @@ async fn main() -> std::io::Result<()> {
|
||||
"/api/inbox/{inbox_id}",
|
||||
web::put().to(inbox_controller::update),
|
||||
)
|
||||
.route(
|
||||
"/api/inbox/{inbox_id}",
|
||||
web::delete().to(inbox_controller::delete),
|
||||
)
|
||||
// Statistics controller
|
||||
.route("/api/stats/global", web::get().to(stats_controller::global))
|
||||
.route(
|
||||
|
@ -105,3 +105,9 @@ pub async fn get_by_id(entry_id: InboxEntryID) -> anyhow::Result<InboxEntry> {
|
||||
.filter(inbox::dsl::id.eq(entry_id.0))
|
||||
.get_result(&mut db()?)?)
|
||||
}
|
||||
|
||||
/// Delete an inbox entry
|
||||
pub async fn delete(id: InboxEntryID) -> anyhow::Result<()> {
|
||||
diesel::delete(inbox::dsl::inbox.filter(inbox::dsl::id.eq(id.0))).execute(&mut db()?)?;
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user