Merge branch 'master' into fix/discount-usage

This commit is contained in:
olivermrbl
2021-04-07 12:22:09 +02:00
56 changed files with 772 additions and 160 deletions
+26 -18
View File
@@ -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,