Skip to content

Commit

Permalink
fix: warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Tguntenaar committed Nov 6, 2024
1 parent db03b72 commit 8698f5c
Show file tree
Hide file tree
Showing 11 changed files with 551 additions and 649 deletions.
6 changes: 0 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,3 @@ near-api = "0.2.1"
[features]
default = ["workspaces"]
workspaces = ["near-workspaces"]

[profile.dev]
rustc = "nightly"

[profile.release]
rustc = "nightly"
2 changes: 1 addition & 1 deletion src/api_background_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use tokio::{
time::{self, Duration},
};

struct ApiBackgroundService {
pub struct ApiBackgroundService {
api_client: ApiClient,
handle: Option<JoinHandle<()>>,
}
Expand Down
1 change: 0 additions & 1 deletion src/api_client.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use reqwest::Client;
use serde::Deserialize;
use tokio::time::{self, Duration};

#[derive(Deserialize)]
pub struct ApiResponse {
Expand Down
17 changes: 3 additions & 14 deletions src/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,15 @@ use rocket::{
Build, Rocket,
};
use rocket_db_pools::Database;
use sqlx::{
migrate, query, query_as, query_file_as, query_scalar, types::BigDecimal, Error, PgPool,
Postgres, Transaction,
};
use sqlx::{migrate, query, query_scalar, Error, PgPool, Postgres, Transaction};

#[derive(Database, Clone, Debug)]
// devhub_cache_api_rs but locally devhub_cache
#[database("devhub_cache_api_rs")] // Adjust the database name accordingly
#[database("devhub_cache_api_rs")]
pub struct DB(PgPool);

pub mod types;

use devhub_shared::proposal::{Proposal, ProposalSnapshot};

use types::{
AfterDate, ProposalRecord, ProposalSnapshotRecord, ProposalWithLatestSnapshotView,
RfpSnapshotRecord,
};

// use crate::types::ProposalResponse;
use types::{ProposalRecord, ProposalSnapshotRecord, ProposalWithLatestSnapshotView};

impl DB {
// Functions for Proposals
Expand Down
37 changes: 6 additions & 31 deletions src/entrypoints/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
use rocket::fairing::AdHoc;
use utoipa::OpenApi;

// pub mod aliases;
// pub mod leaderboards;
// pub mod statistics;
// pub mod user;
pub mod proposal;
pub mod rfp;
use crate::db::types::{ProposalRecord, ProposalSnapshotRecord, ProposalWithLatestSnapshotView};
// pub mod rfp;
use crate::db::types::ProposalWithLatestSnapshotView;

use devhub_cache_api::types;

Expand All @@ -18,29 +13,10 @@ use devhub_cache_api::types;
version = "0.0.1",
),
paths(
// leaderboards::get_leaderboard,
// leaderboards::get_repos,
// user::get_user,
// user::get_user_contributions,
// user::get_badge,
// statistics::get_statistics
proposal::get_proposals
proposal::get_proposals
),
components(schemas(
// types::PaginatedResponse<types::LeaderboardResponse>,
// types::PaginatedLeaderboardResponse,
// types::PaginatedResponse<types::RepoResponse>,
// types::PaginatedRepoResponse,
// types::PaginatedResponse<types::UserContributionResponse>,
// types::PaginatedUserContributionResponse,
// types::UserContributionResponse,
// types::LeaderboardResponse,
// types::RepoResponse,
// types::UserProfile,
// types::GithubMeta,
// types::Streak,
// types::Statistics,
types::PaginatedResponse<ProposalWithLatestSnapshotView>
types::PaginatedResponse<ProposalWithLatestSnapshotView>
)),
tags(
(name = "Devhub Cache", description = "Devhub cache endpoints.")
Expand All @@ -50,8 +26,7 @@ pub struct ApiDoc;

pub fn stage() -> AdHoc {
AdHoc::on_ignite("Installing entrypoints", |rocket| async {
rocket.attach(proposal::stage()).attach(rfp::stage())
// .attach(aliases::stage())
// .attach(statistics::stage())
rocket.attach(proposal::stage())
// .attach(rfp::stage())
})
}
Loading

0 comments on commit 8698f5c

Please sign in to comment.