Skip to content

Commit

Permalink
Merge pull request #155 from holaplex/abdul/multi-proj-coll
Browse files Browse the repository at this point in the history
Support import of collection for multiple projects
  • Loading branch information
imabdulbasit authored Jul 27, 2023
2 parents 5a13b0c + c845984 commit dda0525
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions api/src/mutations/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,15 @@ impl Mutation {
validate_solana_address(&input.collection)?;

let collection = Collections::find()
.filter(collections::Column::Address.eq(input.collection.clone()))
.filter(
collections::Column::Address
.eq(input.collection.clone())
.and(collections::Column::ProjectId.eq(input.project)),
)
.one(db.get())
.await?;

if let Some(collection) = collection {
if let Some(collection) = collection.clone() {
let mints = CollectionMints::find()
.filter(collection_mints::Column::CollectionId.eq(collection.id))
.all(&txn)
Expand Down Expand Up @@ -311,7 +315,7 @@ impl Mutation {
)),
}),
Some(&NftEventKey {
id: Uuid::new_v4().to_string(),
id: collection.map_or(Uuid::new_v4(), |c| c.id).to_string(),
project_id: input.project.to_string(),
user_id: user_id.to_string(),
}),
Expand Down

0 comments on commit dda0525

Please sign in to comment.