Skip to content

Commit

Permalink
Fix task URI initial query
Browse files Browse the repository at this point in the history
  • Loading branch information
danenbm committed Dec 21, 2023
1 parent 6ccd27a commit ef1f811
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions nft_ingester/src/tasks/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ impl DownloadMetadataTask {
}
}

#[derive(FromQueryResult, Debug, Default, Clone, Eq, PartialEq)]
struct MetadataUrl {
pub metadata_url: String,
}

#[async_trait]
impl BgTask for DownloadMetadataTask {
fn name(&self) -> &'static str {
Expand Down Expand Up @@ -107,12 +112,12 @@ impl BgTask for DownloadMetadataTask {
_ => serde_json::Value::String("Invalid Uri".to_string()), //TODO -> enumize this.
};

match asset_data::Entity::find_by_id(download_metadata.asset_data_id.clone())
let query = asset_data::Entity::find_by_id(download_metadata.asset_data_id.clone())
.select_only()
.column(asset_data::Column::MetadataUrl)
.one(db)
.await?
{
.build(DbBackend::Postgres);

match MetadataUrl::find_by_statement(query).one(db).await? {
Some(asset) => {
if asset.metadata_url != download_metadata.uri {
debug!(
Expand Down

0 comments on commit ef1f811

Please sign in to comment.