Skip to content

Commit

Permalink
Support import of collection for multiple projects
Browse files Browse the repository at this point in the history
  • Loading branch information
imabdulbasit committed Jul 27, 2023
1 parent 4fde4d4 commit 8911e17
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 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,10 @@ impl Mutation {
)),
}),
Some(&NftEventKey {
id: Uuid::new_v4().to_string(),
id: collection

Check warning on line 318 in api/src/mutations/collection.rs

View workflow job for this annotation

GitHub Actions / clippy/check/doc

called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
.map(|c| c.id)
.unwrap_or(Uuid::new_v4())
.to_string(),
project_id: input.project.to_string(),
user_id: user_id.to_string(),
}),
Expand Down

0 comments on commit 8911e17

Please sign in to comment.