#Dynamic relationTo field?

3 messages · Page 1 of 1 (latest)

hidden ibex
#

Hi all,

I setup my payload system with 2 collections: tenant and user.

From there I have setup a single tenant, but in such a way I believe I can have multiple tenants using the same CMS without interferring with each other

export const tenantPrefix = {
  ALEXJONES: "alexjones__",
} as const;

However, when expanding the current system, I wanted to have a tenant specific document upload, inside the tenant collection. So I'd have to make it dynamic. I attempted to make a small function to get the slug from the data object, which works, but ts is warning me that I cannot have anything other than a string in the relationTo field? Is there another way to do this?

hidden ibex