Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraccaman committed Dec 1, 2024
1 parent 374f48c commit 78f2e24
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 19 deletions.
6 changes: 5 additions & 1 deletion governance/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,11 @@ async fn crawling_fn(
)?;
}

repository::pgf::update_pgf(transaction_conn, pgf_payments, native_token)?;
repository::pgf::update_pgf(
transaction_conn,
pgf_payments,
native_token,
)?;

repository::crawler_state::upsert_crawler_state(
transaction_conn,
Expand Down
12 changes: 6 additions & 6 deletions governance/src/repository/pgf.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
use anyhow::Context;
use diesel::query_dsl::methods::FilterDsl;
use diesel::BoolExpressionMethods;
use diesel::{upsert::excluded, ExpressionMethods, PgConnection, RunQueryDsl};
use diesel::upsert::excluded;
use diesel::{
BoolExpressionMethods, ExpressionMethods, PgConnection, RunQueryDsl,
};
use namada_governance::cli::onchain::PgfAction;
use orm::balances::BalancesInsertDb;
use orm::pgf::PublicGoodFundingPaymentInsertDb;
use orm::schema::{balances, public_good_funding};
use shared::{
id::Id,
pgf::{PaymentRecurrence, PgfPayment},
};
use shared::id::Id;
use shared::pgf::{PaymentRecurrence, PgfPayment};

pub fn update_pgf(
transaction_conn: &mut PgConnection,
Expand Down
66 changes: 55 additions & 11 deletions orm/src/schema.rs
Original file line number Diff line number Diff line change
@@ -1,47 +1,91 @@
// @generated automatically by Diesel CLI.

pub mod sql_types {
#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "crawler_name"))]
pub struct CrawlerName;

#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "governance_kind"))]
pub struct GovernanceKind;

#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "governance_result"))]
pub struct GovernanceResult;

#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "governance_tally_type"))]
pub struct GovernanceTallyType;

#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "payment_kind"))]
pub struct PaymentKind;

#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "payment_recurrence"))]
pub struct PaymentRecurrence;

#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "token_type"))]
pub struct TokenType;

#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "transaction_kind"))]
pub struct TransactionKind;

#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "transaction_result"))]
pub struct TransactionResult;

#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "validator_state"))]
pub struct ValidatorState;

#[derive(diesel::query_builder::QueryId, std::fmt::Debug, diesel::sql_types::SqlType)]
#[derive(
diesel::query_builder::QueryId,
std::fmt::Debug,
diesel::sql_types::SqlType,
)]
#[diesel(postgres_type(name = "vote_kind"))]
pub struct VoteKind;
}
Expand Down
2 changes: 1 addition & 1 deletion shared/src/pgf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ pub struct PgfPayment {
pub kind: PaymentKind,
pub receipient: Id,
pub amount: Amount,
pub action: Option<PgfAction>
pub action: Option<PgfAction>,
}

0 comments on commit 78f2e24

Please sign in to comment.