Skip to content

Commit 0567f56

Browse files
authored
chore(cat-gateway): Remove POST /v1/document and related components (#3264)
* chore: removing post document v1 * chore: minor doc * chore: minor * chore: bump api version
1 parent fa42a67 commit 0567f56

File tree

16 files changed

+104
-1068
lines changed

16 files changed

+104
-1068
lines changed

catalyst-gateway/bin/src/db/event/signed_docs/full_signed_doc.rs

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
//! `FullSignedDoc` struct implementation.
22
3-
use futures::{Stream, StreamExt};
4-
53
use super::SignedDocBody;
64
use crate::{
7-
db::event::{common::query_limits::QueryLimits, signed_docs::DocsQueryFilter, EventDB},
5+
db::event::EventDB,
86
jinja::{get_template, JinjaTemplateSource},
97
};
108

@@ -17,13 +15,6 @@ pub(crate) const SELECT_SIGNED_DOCS_TEMPLATE: JinjaTemplateSource = JinjaTemplat
1715
source: include_str!("./sql/select_signed_documents.sql.jinja"),
1816
};
1917

20-
/// Filtered select sql query jinja template
21-
pub(crate) const FILTERED_SELECT_FULL_SIGNED_DOCS_TEMPLATE: JinjaTemplateSource =
22-
JinjaTemplateSource {
23-
name: "filtered_select_full_signed_documents.sql.jinja.template",
24-
source: include_str!("./sql/filtered_select_full_signed_documents.sql.jinja"),
25-
};
26-
2718
/// `FullSignedDoc::store` method error.
2819
#[derive(thiserror::Error, Debug)]
2920
#[error("Document with the same `id` and `ver` already exists")]
@@ -61,6 +52,7 @@ impl FullSignedDoc {
6152
}
6253

6354
/// Returns the document metadata.
55+
#[allow(dead_code)]
6456
pub(crate) fn metadata(&self) -> Option<&serde_json::Value> {
6557
self.body.metadata()
6658
}
@@ -139,29 +131,6 @@ impl FullSignedDoc {
139131
Self::from_row(id, ver, &row)
140132
}
141133

142-
/// Loads a async stream of `FullSignedDoc` from the event db based on the given
143-
/// `conditions`.
144-
pub(crate) async fn retrieve_conditions(
145-
conditions: &DocsQueryFilter,
146-
query_limits: &QueryLimits,
147-
) -> anyhow::Result<impl Stream<Item = anyhow::Result<Self>>> {
148-
let query_template = get_template(&FILTERED_SELECT_FULL_SIGNED_DOCS_TEMPLATE)?;
149-
let query = query_template.render(serde_json::json!({
150-
"conditions": conditions.to_string(),
151-
"query_limits": query_limits.to_string(),
152-
}))?;
153-
let rows = EventDB::query_stream(&query, &[]).await?;
154-
let docs = rows.map(|res_row| {
155-
res_row.and_then(|row| {
156-
let id = row.try_get("id")?;
157-
let ver = row.try_get("ver")?;
158-
159-
FullSignedDoc::from_row(&id, Some(&ver), &row)
160-
})
161-
});
162-
Ok(docs)
163-
}
164-
165134
/// Returns all signed document fields for the event db queries
166135
fn postgres_db_fields(&self) -> [&(dyn tokio_postgres::types::ToSql + Sync); 7] {
167136
let body_fields = self.body.postgres_db_fields();

catalyst-gateway/bin/src/db/event/signed_docs/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ mod signed_doc_body;
88
mod tests;
99

1010
pub(crate) use doc_ref::DocumentRef;
11-
pub(crate) use full_signed_doc::{
12-
FullSignedDoc, StoreError, FILTERED_SELECT_FULL_SIGNED_DOCS_TEMPLATE,
13-
SELECT_SIGNED_DOCS_TEMPLATE,
14-
};
11+
pub(crate) use full_signed_doc::{FullSignedDoc, StoreError, SELECT_SIGNED_DOCS_TEMPLATE};
1512
pub(crate) use query_filter::DocsQueryFilter;
1613
pub(crate) use signed_doc_body::{
1714
SignedDocBody, FILTERED_COUNT_SIGNED_DOCS_TEMPLATE, FILTERED_SELECT_SIGNED_DOCS_TEMPLATE,

catalyst-gateway/bin/src/db/event/signed_docs/sql/filtered_select_full_signed_documents.sql.jinja

Lines changed: 0 additions & 13 deletions
This file was deleted.

catalyst-gateway/bin/src/jinja.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use std::sync::LazyLock;
55
use minijinja::{Environment, Template};
66

77
use crate::db::event::signed_docs::{
8-
FILTERED_COUNT_SIGNED_DOCS_TEMPLATE, FILTERED_SELECT_FULL_SIGNED_DOCS_TEMPLATE,
9-
FILTERED_SELECT_SIGNED_DOCS_TEMPLATE, SELECT_SIGNED_DOCS_TEMPLATE,
8+
FILTERED_COUNT_SIGNED_DOCS_TEMPLATE, FILTERED_SELECT_SIGNED_DOCS_TEMPLATE,
9+
SELECT_SIGNED_DOCS_TEMPLATE,
1010
};
1111

1212
/// Jinja template source struct.
@@ -33,11 +33,6 @@ static JINJA_ENV: LazyLock<Environment> = LazyLock::new(|| {
3333
FILTERED_SELECT_SIGNED_DOCS_TEMPLATE.source,
3434
)
3535
.unwrap();
36-
env.add_template(
37-
FILTERED_SELECT_FULL_SIGNED_DOCS_TEMPLATE.name,
38-
FILTERED_SELECT_FULL_SIGNED_DOCS_TEMPLATE.source,
39-
)
40-
.unwrap();
4136
env.add_template(
4237
FILTERED_COUNT_SIGNED_DOCS_TEMPLATE.name,
4338
FILTERED_COUNT_SIGNED_DOCS_TEMPLATE.source,

catalyst-gateway/bin/src/service/api/documents/mod.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -90,30 +90,6 @@ impl DocumentApi {
9090
}
9191
}
9292

93-
/// Post A Signed Document Index Query.
94-
///
95-
/// This endpoint produces a summary of signed documents that meet the criteria
96-
/// defined in the request body.
97-
///
98-
/// It does not return the actual documents, just an index of the document identifiers
99-
/// which allows the documents to be retrieved by the `GET document` endpoint.
100-
#[oai(
101-
path = "/v1/document/index",
102-
method = "post",
103-
operation_id = "postDocument"
104-
)]
105-
async fn post_document_v1(
106-
&self,
107-
/// The Query Filter Specification
108-
query: Json<post_document_index_query::v1::request::DocumentIndexQueryFilterBody>,
109-
page: Query<Option<Page>>,
110-
limit: Query<Option<Limit>>,
111-
/// No Authorization required, but Token permitted.
112-
_auth: NoneOrRBAC,
113-
) -> post_document_index_query::v1::AllResponses {
114-
post_document_index_query::v1::endpoint(query.0 .0, page.0, limit.0).await
115-
}
116-
11793
/// Post A Signed Document Index Query for Newer Versions of v0.04.
11894
///
11995
/// Produces a summary of signed documents that meet the criteria
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
//! Document Index Query Implementation
22
3-
pub(crate) mod v1;
43
pub(crate) mod v2;

catalyst-gateway/bin/src/service/api/documents/post_document_index_query/v1/mod.rs

Lines changed: 0 additions & 149 deletions
This file was deleted.

0 commit comments

Comments
 (0)