pinakes-server: integrate plugin system into routes & application state
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ib5d482326cae1dcb43603bffb76a6a186a6a6964
This commit is contained in:
parent
f686e8a777
commit
e9c5390c45
6 changed files with 206 additions and 46 deletions
|
|
@ -48,6 +48,15 @@ pub async fn create_collection(
|
|||
req.filter_query.as_deref(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
state.emit_plugin_event(
|
||||
"CollectionCreated",
|
||||
&serde_json::json!({
|
||||
"id": col.id.to_string(),
|
||||
"name": col.name,
|
||||
}),
|
||||
);
|
||||
|
||||
Ok(Json(CollectionResponse::from(col)))
|
||||
}
|
||||
|
||||
|
|
@ -73,6 +82,12 @@ pub async fn delete_collection(
|
|||
Path(id): Path<Uuid>,
|
||||
) -> Result<Json<serde_json::Value>, ApiError> {
|
||||
state.storage.delete_collection(id).await?;
|
||||
|
||||
state.emit_plugin_event(
|
||||
"CollectionDeleted",
|
||||
&serde_json::json!({"id": id.to_string()}),
|
||||
);
|
||||
|
||||
Ok(Json(serde_json::json!({"deleted": true})))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue