Will server-side subscriptions also be implemented...
# prisma-whats-new
a
Will server-side subscriptions also be implemented for files? They currently dont seem to be triggered.
n
@aflatter hey 👋 what's your use case for this?
a
Hey. My goal is to generate preview images of uploaded files and show them in the UI before the file is attached to a document.
n
that is essentially a resize job, right?
a
nilan unfortunately not, I need to support PDFs, so a single file upload might result in previews of multiple pages
n
Gotcha. You can have another type that's one-to-one connected to the
File
type, let's call it
Document
a
@nilan I should probably add a new type, something like "DocumentFile", and subscribe to that. I would not want to trigger this if my application would for example support uploading avatars or something like that in the future
n
then whenever a document is created, you have a server-side subscription for that
😄
a
🙂
n
that's the same idea
a
yes, right. I think I was just keen to use "File", because that's how I call these things in my domain model
I have Documents which have one or more Files 🙂
but still: it would be nice if you guys would add documentation about subscriptions not working for files
lost some time there because it was the first subscription that I tried and I was confused when it didnt work
n
thanks that's a great suggestion! Will add this right away
👍 1
did you encounter other limitations that confused you?
a
not really, I followed discussions in the GraphQL community around file uploads, so I already kinda expected that they would be handled outside of GraphQL proper
👍 1
but I guess to newcomers this could be stated more explicitly
unrelated question: do you plan to support custom mutations via functions too?
e.g. if I would like to implement a subset of my application using event sourcing, it would be nice to delegate these mutations to a separate backend, which would in turn send mutations back to graphcool
not sure how well this would work in the real world, but it's something that crossed my mind
n
yes, that's a major part of our road map 🙂 you can track progress here: https://github.com/graphcool/feature-requests/issues/40
a
@nilan perfect, thanks