Skip to content

Commit

Permalink
fix: utopia
Browse files Browse the repository at this point in the history
  • Loading branch information
Tguntenaar committed Nov 7, 2024
1 parent 41efdaa commit fc6e6dc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/entrypoints/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use devhub_shared::proposal::VersionedProposal;
use rocket::fairing::AdHoc;
use rocket::serde::json::Json;
use utoipa::OpenApi;
pub mod proposal;
// pub mod rfp;
Expand All @@ -11,10 +13,12 @@ use crate::types::PaginatedResponse;
version = "0.0.1",
),
paths(
proposal::get_proposals
proposal::get_proposals,
proposal::get_proposal
),
components(schemas(
PaginatedResponse<ProposalWithLatestSnapshotView>
PaginatedResponse<ProposalWithLatestSnapshotView>,
// Json<VersionedProposal>
)),
tags(
(name = "Devhub Cache", description = "Devhub cache endpoints.")
Expand Down
7 changes: 6 additions & 1 deletion src/entrypoints/proposal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ pub mod proposal_types;
// TODO input -> search name description summary fields
fn search() {}

#[utoipa::path(get, path = "/proposals?<order>&<limit>&<offset>&<filters>")]
#[utoipa::path(get, path = "/proposals?<order>&<limit>&<offset>&<filters>", params(
("order"= &str, Path, description ="order"),
("limit"= i64, Path, description = "limit"),
("offset"= i64, Path, description = "offset"),
("filters"= GetProposalFilters, Path, description = "filters struct that contains stuff like category, labels (vec), author_id, stage, block_timestamp (i64)"),
))]
#[get("/?<order>&<limit>&<offset>&<filters>")]
async fn get_proposals(
order: Option<&str>,
Expand Down
3 changes: 2 additions & 1 deletion src/entrypoints/proposal/proposal_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ use near_sdk::near;
use rocket::form::FromForm;
use rocket::serde::{Deserialize, Serialize};
use std::collections::HashSet;
use utoipa::ToSchema;
// NOTE should this be VersionedProposal instead of Proposal?
use devhub_shared::proposal::Proposal as ContractProposal;

#[derive(Clone, Debug, FromForm)]
#[derive(Clone, Debug, FromForm, ToSchema)]
pub struct GetProposalFilters {
pub category: Option<String>,
pub labels: Option<Vec<String>>,
Expand Down

0 comments on commit fc6e6dc

Please sign in to comment.