lint project

This commit is contained in:
Kurt Hutten
2021-06-26 06:14:49 +10:00
parent 0845575680
commit e91a264768
2 changed files with 8 additions and 3 deletions

View File

@@ -77,13 +77,17 @@ export const updatePart = async ({ id, input }) => {
}
const originalPart = await db.part.findUnique({ where: { id } })
const imageToDestroy =
originalPart.mainImage !== input.mainImage && input.mainImage && originalPart.mainImage
originalPart.mainImage !== input.mainImage &&
input.mainImage &&
originalPart.mainImage
const update = await db.part.update({
data: foreignKeyReplacement(input),
where: { id },
})
if (imageToDestroy) {
console.log(`image destroyed, publicId: ${imageToDestroy}, partId: ${id}, replacing image is ${input.mainImage}`)
console.log(
`image destroyed, publicId: ${imageToDestroy}, partId: ${id}, replacing image is ${input.mainImage}`
)
// destroy after the db has been updated
destroyImage({ publicId: imageToDestroy })
}

View File

@@ -27,7 +27,8 @@ const PartProfile = ({
const [isInvalid, setIsInvalid] = useState(false)
const { currentUser } = useAuth()
const editorRef = useRef(null)
const canEdit = currentUser?.sub === userPart.id || currentUser?.roles.includes('admin')
const canEdit =
currentUser?.sub === userPart.id || currentUser?.roles.includes('admin')
const isImageEditable = !isEditable && canEdit // image is editable when not in profile edit mode in order to separate them as it's too hard too to upload an image to cloudinary temporarily until the use saves (and maybe have to clean up) for the time being
const part = userPart?.Part
const emotes = countEmotes(part?.Reaction)