From a74c7bf20ffb212213129e9f70b860905a8f4290 Mon Sep 17 00:00:00 2001 From: Stefan Melmuk Date: Fri, 28 Jun 2024 00:46:27 +0200 Subject: [PATCH] add collections_v2 endpoint --- src/api/core/ciphers.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs index 16f875a9..389a3d5b 100644 --- a/src/api/core/ciphers.rs +++ b/src/api/core/ciphers.rs @@ -79,6 +79,8 @@ pub fn routes() -> Vec { delete_all, move_cipher_selected, move_cipher_selected_put, + put_collections2_update, + post_collections2_update, put_collections_update, post_collections_update, post_collections_admin, @@ -695,6 +697,33 @@ struct CollectionsAdminData { collection_ids: Vec, } +#[put("/ciphers//collections_v2", data = "")] +async fn put_collections2_update( + uuid: &str, + data: Json, + headers: Headers, + conn: DbConn, + nt: Notify<'_>, +) -> JsonResult { + post_collections2_update(uuid, data, headers, conn, nt).await +} + +#[post("/ciphers//collections_v2", data = "")] +async fn post_collections2_update( + uuid: &str, + data: Json, + headers: Headers, + conn: DbConn, + nt: Notify<'_>, +) -> JsonResult { + let cipher_details = post_collections_update(uuid, data, headers, conn, nt).await?; + Ok(Json(json!({ // AttachmentUploadDataResponseModel + "object": "optionalCipherDetails", + "unavailable": false, + "cipher": *cipher_details + }))) +} + #[put("/ciphers//collections", data = "")] async fn put_collections_update( uuid: &str,