Skip to content

Commit

Permalink
Merge pull request #225 from holaplex/abdul/sea-orm-0-12-2
Browse files Browse the repository at this point in the history
Update sea-orm crate to 0.12.2
  • Loading branch information
kespinola authored Sep 14, 2023
2 parents 6d202cb + 28c5b59 commit ec86c3e
Show file tree
Hide file tree
Showing 8 changed files with 753 additions and 930 deletions.
1,646 changes: 735 additions & 911 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ categories = ["cryptography::cryptocurrencies", "web-programming"]
[lib]

[dependencies]
sea-orm = { version = "^0.10.0", features = [
sea-orm = { version = "0.12.2", features = [
"debug-print",
"runtime-tokio-rustls",
"sqlx-postgres",
Expand All @@ -31,7 +31,7 @@ async-graphql = { version = "5.0.4", features = [
] }
serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.93"
solana-program = "1.15.0"
solana-program = "1"
poem = { version = "1.3.50", features = ["anyhow", "test"] }
async-graphql-poem = "5.0.3"
prost = "0.11.9"
Expand All @@ -42,7 +42,7 @@ strum = { version = "0.24.1", features = ["derive"] }

[dependencies.hub-core]
package = "holaplex-hub-core"
version = "0.5.3"
version = "0.5.4"
git = "https://github.com/holaplex/hub-core"
branch = "stable"
features = ["kafka", "credits", "asset_proxy", "sea-orm"]
Expand Down
9 changes: 2 additions & 7 deletions api/src/entities/sea_orm_active_enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,12 @@ pub enum CreationStatus {
Queued,
}

#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Enum, Copy)]
#[derive(Debug, Clone, Default, PartialEq, Eq, EnumIter, DeriveActiveEnum, Enum, Copy)]
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "drop_type")]
pub enum DropType {
#[default]
#[sea_orm(string_value = "edition")]
Edition,
#[sea_orm(string_value = "open")]
Open,
}

impl Default for DropType {
fn default() -> Self {
DropType::Edition
}
}
4 changes: 2 additions & 2 deletions api/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ impl Processor {

let created_at = timestamp
.and_then(|t| {
Some(DateTime::from_utc(
Some(DateTime::from_naive_utc_and_offset(
NaiveDateTime::from_timestamp_opt(t.seconds, t.nanos.try_into().ok()?)?,
Utc.fix(),
))
Expand Down Expand Up @@ -863,7 +863,7 @@ impl Processor {
}

async fn mint_updated(&self, id: String, payload: UpdateResult) -> ProcessResult<()> {
let update_history = UpdateHistories::find_by_id(id.parse()?)
let update_history = UpdateHistories::find_by_id(Uuid::from_str(&id)?)
.one(self.db.get())
.await?
.ok_or(ProcessorErrorKind::DbMissingUpdateHistory)?;
Expand Down
2 changes: 1 addition & 1 deletion api/src/mutations/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ pub async fn fetch_owner(

let owner = wallet
.ok_or(Error::new(format!(
"no project wallet found for {blockchain} blockchain"
"no project wallet found for {blockchain:?} blockchain"
)))?
.wallet_address;
Ok(owner)
Expand Down
2 changes: 1 addition & 1 deletion api/src/mutations/drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ async fn fetch_owner(

let owner = wallet
.ok_or(Error::new(format!(
"no project wallet found for {blockchain} blockchain"
"no project wallet found for {blockchain:?} blockchain"
)))?
.wallet_address;
Ok(owner)
Expand Down
12 changes: 8 additions & 4 deletions api/src/mutations/mint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ use hub_core::{
credits::{CreditsClient, TransactionId},
producer::Producer,
};
use sea_orm::{prelude::*, JoinType, Order, QueryOrder, QuerySelect, Set, TransactionTrait};
use sea_orm::{
prelude::*,
sea_query::{Func, SimpleExpr},
JoinType, Order, QueryOrder, QuerySelect, Set, TransactionTrait,
};

use super::collection::{
fetch_owner, validate_creators, validate_json, validate_solana_creator_verification,
Expand Down Expand Up @@ -100,7 +104,7 @@ impl Mutation {

let owner_address = wallet
.ok_or(Error::new(format!(
"no project wallet found for {} blockchain",
"no project wallet found for {:?} blockchain",
collection.blockchain
)))?
.wallet_address;
Expand Down Expand Up @@ -280,7 +284,7 @@ impl Mutation {

let owner_address = wallet
.ok_or(Error::new(format!(
"no project wallet found for {} blockchain",
"no project wallet found for {:?} blockchain",
collection.blockchain
)))?
.wallet_address;
Expand Down Expand Up @@ -1095,7 +1099,7 @@ impl Mutation {
.select_also(collections::Entity)
.filter(collection_mints::Column::CollectionId.eq(drop.collection_id))
.filter(collection_mints::Column::CreationStatus.eq(CreationStatus::Queued))
.order_by(sea_orm::sea_query::Func::random(), Order::Asc)
.order_by(SimpleExpr::FunctionCall(Func::random()), Order::Asc)
.one(conn)
.await?
.ok_or(Error::new("No Queued mint found for the drop"))?;
Expand Down
2 changes: 1 addition & 1 deletion migration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ name = "migration"
tokio = { version = "1.22.0", features = ["macros"] }

[dependencies.sea-orm-migration]
version = "^0.10.0"
version = "0.12.2"
features = [
"runtime-tokio-rustls",
"sqlx-postgres",
Expand Down

0 comments on commit ec86c3e

Please sign in to comment.