<@U72QG90JZ> You might be able to achieve that usi...
# prisma-whats-new
p
@chandlervdw You might be able to achieve that using a Request Pipeline function. I'm doing something similar for auto-generated slugs.
c
Do you happen to have an example?
p
I'm out for lunch at the moment so I don't have my computer with me, but it goes something like this... 1. Set up vanityURL field WITHOUT unique constraint. 2. Create new request pipeline function that gets called whenever a campaign is created or updated. 3. In this function, write a query to see if other campaigns in the same organization have the same vanityURL. 4. If others have the same vanityURL, either return an error or generate a different one. Your choice.
c
I found the docs for it! Thanks
👍 1
do I have to query Graph.cool within that function? It seems like I can’t define any Campaign relationships to get passed with the event (i.e. organizations)
@nilan ☝️
@Pkmmte I wasn’t able to figure this out using request pipelines (at least using the inline functions). The ecosystem there is very behind the times… I guess I’ll have to go with zeit.co/now or something like that.
p
@chandlervdw Yeah, I can see why you'd say that. I'm actually using my own server for this and calling it as a webhook.
c
@Pkmmte so when you call it as a webhook, do you still have to make requests back to Graph.cool for relationship data or can you somehow add it to the pipeline payload?
p
@chandlervdw I have to make requests back to Graphcool if I want to check something not included in the payload. In my case, yeah, I make a query to check if there's an existing duplicate. It's not efficient but it's the best thing I found that works.
c
man, it seems like they should allow you to edit the request pipeline payload, much like they do with server-side subscriptions
that would save a lot of effort, pings and time
n
please ask broader questions in the forum: https://www.graph.cool/forum/ unfortunately, I can't keep up with all messages here 🙂
c
done. thanks!
🙏 2