Merge pull request #219 from medusajs/hotfix/claim-items
hotfix: create claim item w/o tags/images
This commit is contained in:
@@ -83,27 +83,35 @@ class ClaimItemService extends BaseService {
|
||||
)
|
||||
}
|
||||
|
||||
const claimTagRepo = manager.getCustomRepository(this.claimTagRepository_)
|
||||
const tagsToAdd = await Promise.all(
|
||||
tags.map(async t => {
|
||||
const normalized = t.trim().toLowerCase()
|
||||
const existing = await claimTagRepo.findOne({
|
||||
where: { value: normalized },
|
||||
let tagsToAdd = []
|
||||
if (tags && tags.length) {
|
||||
const claimTagRepo = manager.getCustomRepository(
|
||||
this.claimTagRepository_
|
||||
)
|
||||
tagsToAdd = await Promise.all(
|
||||
tags.map(async t => {
|
||||
const normalized = t.trim().toLowerCase()
|
||||
const existing = await claimTagRepo.findOne({
|
||||
where: { value: normalized },
|
||||
})
|
||||
if (existing) {
|
||||
return existing
|
||||
}
|
||||
|
||||
return claimTagRepo.create({ value: normalized })
|
||||
})
|
||||
if (existing) {
|
||||
return existing
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
return claimTagRepo.create({ value: normalized })
|
||||
let imagesToAdd = []
|
||||
if (images && images.length) {
|
||||
const claimImgRepo = manager.getCustomRepository(
|
||||
this.claimImageRepository_
|
||||
)
|
||||
imagesToAdd = images.map(url => {
|
||||
return claimImgRepo.create({ url })
|
||||
})
|
||||
)
|
||||
|
||||
const claimImgRepo = manager.getCustomRepository(
|
||||
this.claimImageRepository_
|
||||
)
|
||||
const imagesToAdd = images.map(url => {
|
||||
return claimImgRepo.create({ url })
|
||||
})
|
||||
}
|
||||
|
||||
const created = ciRepo.create({
|
||||
...rest,
|
||||
|
||||
Reference in New Issue
Block a user