pinakes-server: integrate plugin system into routes & application state

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ib5d482326cae1dcb43603bffb76a6a186a6a6964
This commit is contained in:
raf 2026-03-08 15:06:11 +03:00
commit e9c5390c45
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
6 changed files with 206 additions and 46 deletions

View file

@ -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})))
}