Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Destoy files when destroying post #62

Merged
merged 1 commit into from
Apr 1, 2022

Conversation

jazcarate
Copy link
Collaborator

Fixes #51 though we should consider adding a overarching transaction over the whole deletion 😸.

The deletion here:

if (post.files?.length)
await Promise.all(post.files.map((file) => file.destroy()))

was ok, but files key was never set.

@vercel
Copy link

vercel bot commented Apr 1, 2022

Someone is attempting to deploy a commit to a Personal Account owned by @MaxLeiter on Vercel.

@MaxLeiter first needs to authorize it.

@jazcarate
Copy link
Collaborator Author

I'll try and understand the whole PostAuthor seemingly one-to-one relation, and then try to make a DB transaction on the endpoint

@MaxLeiter
Copy link
Owner

Great catch, thank you 🙏

For what its worth, I originally envisioned supporting multiple post authors, hence the through table. But now I'm not sure that's necessary, so if it simplifies your work feel free to make it a one-to-many

@MaxLeiter MaxLeiter merged commit 8da6d62 into MaxLeiter:main Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Post deletion is broken: sequelize constraint failed
2 participants