1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*use actix_web::{web, HttpRequest, HttpResponse};
use actix_web::web::Data;
use ant_core::data::Wallet;
use log::debug;
use crate::error::graph_error::GraphError;
use crate::controller::{get_store_type, data_key};
use crate::service::graph_service::{GraphEntry, GraphService};
#[utoipa::path(
post,
path = "/anttp-0/graph_entry",
request_body(
content = GraphEntry
),
responses(
(status = CREATED, description = "Graph entry created successfully", body = GraphEntry),
(status = BAD_REQUEST, description = "Graph entry body was invalid")
),
params(
("x-store-type", Header, description = "Only persist to cache and do not publish (memory|disk|none)",
example = "memory"),
("x-data-key", Header, description = "Private key used to create mutable data (personal|resolver|'custom')",
example = "personal"),
),
)]
pub async fn post_graph_entry(
graph_service: Data<GraphService>,
evm_wallet_data: Data<Wallet>,
graph_entry: web::Json<GraphEntry>,
request: HttpRequest,
) -> Result<HttpResponse, GraphError> {
debug!("Creating new graph entry");
Ok(HttpResponse::Created().json(
graph_service.create_graph_entry(graph_entry.into_inner(), evm_wallet_data.get_ref().clone(), get_store_type(&request), data_key(&request)).await?
))
}
#[utoipa::path(
get,
path = "/anttp-0/graph_entry/{address}",
responses(
(status = OK, description = "Graph entry found successfully", body = GraphEntry),
(status = NOT_FOUND, description = "Graph entry was not found")
),
params(
("address" = String, Path, description = "Graph entry address"),
("x-data-key", Header, description = "Private key used to create mutable data (personal|resolver|'custom')",
example = "personal"),
)
)]
pub async fn get_graph_entry(
path: web::Path<String>,
graph_service: Data<GraphService>,
request: HttpRequest,
) -> Result<HttpResponse, GraphError> {
let address = path.into_inner();
debug!("Getting graph entry at [{}]", address);
Ok(HttpResponse::Ok().json(graph_service.get_graph_entry(address, data_key(&request)).await?))
}
*/