Fix editing project without social image.
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
|||||||
} from 'src/services/helpers'
|
} from 'src/services/helpers'
|
||||||
import { requireAuth } from 'src/lib/auth'
|
import { requireAuth } from 'src/lib/auth'
|
||||||
import { requireOwnership, requireProjectOwnership } from 'src/lib/owner'
|
import { requireOwnership, requireProjectOwnership } from 'src/lib/owner'
|
||||||
|
import { socialCard } from '../socialCards/socialCards'
|
||||||
|
|
||||||
export const projects = ({ userName }) => {
|
export const projects = ({ userName }) => {
|
||||||
if (!userName) {
|
if (!userName) {
|
||||||
@@ -102,14 +103,18 @@ export const updateProject = async ({ id, input }: UpdateProjectArgs) => {
|
|||||||
const descriptionChange =
|
const descriptionChange =
|
||||||
input.description && input.description !== oldProject.description
|
input.description && input.description !== oldProject.description
|
||||||
if (titleChange || descriptionChange) {
|
if (titleChange || descriptionChange) {
|
||||||
return db.socialCard.update({
|
const socialCard = await db.socialCard.findUnique({where: {projectId}})
|
||||||
data: { outOfDate: true },
|
if (socialCard) {
|
||||||
where: { projectId },
|
return db.socialCard.update({
|
||||||
})
|
data: { outOfDate: true },
|
||||||
|
where: { id: socialCard.id },
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
requireAuth()
|
requireAuth()
|
||||||
const originalProject = await requireProjectOwnership({ projectId: id })
|
const originalProject = await requireProjectOwnership({ projectId: id })
|
||||||
|
console.log('yooooo', originalProject)
|
||||||
if (input.title) {
|
if (input.title) {
|
||||||
input.title = enforceAlphaNumeric(input.title)
|
input.title = enforceAlphaNumeric(input.title)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user