Skip to content

Commit

Permalink
feat: api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lauti7 committed Jun 7, 2024
1 parent c9bcce6 commit 20c58a6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions crates/db/src/core/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ pub struct AddEvent<'a> {
pub event: Vec<u8>,
}

#[derive(Default, PartialEq, Serialize, Deserialize, Clone, Debug)]
#[derive(Default, PartialEq, Serialize, Deserialize, Clone, Debug, ToSchema)]
pub struct Event {
pub id: String,
pub user_address: String,
Expand All @@ -101,7 +101,7 @@ pub struct Event {
pub event: Vec<u8>,
}

#[derive(Default, PartialEq, Serialize, Deserialize, Clone, Debug)]
#[derive(Default, PartialEq, Serialize, Deserialize, Clone, Debug, ToSchema)]
pub struct QuestInstance {
pub id: String,
pub quest_id: String,
Expand Down
15 changes: 14 additions & 1 deletion crates/server/src/api/routes/api_doc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use super::creators;
use super::health;
use super::quest_instances;
use super::quests;
use actix_web::web::ServiceConfig;
use actix_web_lab::__reexports::serde_json::{json, to_value};
Expand All @@ -26,7 +27,10 @@ use utoipa_redoc::Servable;
quests::get_quest_stats,
quests::activate_quest,
quests::get_quest_updates,
quests::get_quest_instances,
creators::get_quests_by_creator_id,
quest_instances::reset_quest_instance,
quest_instances::get_quest_instance_state
),
components(
schemas(
Expand All @@ -47,14 +51,23 @@ use utoipa_redoc::Servable;
quests_protocol::definitions::Task,
quests_protocol::definitions::Action,
quests_protocol::definitions::Connection,
quests_protocol::definitions::QuestState,
quests_protocol::definitions::StepContent,
quests_protocol::definitions::Task,
quests_db::core::definitions::QuestReward,
quests_db::core::definitions::QuestRewardHook,
quests_db::core::definitions::QuestRewardItem,
quests_db::core::definitions::Event,
quests_db::core::definitions::QuestInstance,
quest_instances::state::GetInstanceStateResponse,
quests::get_instances::GetQuestInstacesResponse,
quests::get_instances::GetQuestInstancesQuery
)
),
tags(
(name = "quests", description = "Quests endpoints."),
(name = "creators", description = "Creators endpoints.")
(name = "creators", description = "Creators endpoints."),
(name = "quest_instances", description = "Quest Instances endpoints.")
),
)]
struct ApiDoc;
Expand Down

0 comments on commit 20c58a6

Please sign in to comment.