How would you design your database if a user can have multiple types of invites? Invites belonging to admins, system, companies. I have a page showing all invites, which hasn't been problematic. Just wondering how I effectively can accept these invites using API calls?
I want to do something like this: /invite/123/, but since the IDs are different, I am not sure how to tackle this. Should my front-end know what kind of model and use conditions to make it call a specific API route?
I would have one invites table and then have a type field that tells what kind of invite it is. If I then need to connect some foreign key I just add that so the table could look something like
id
invitation
type
type id
That way it doesn't matter what model has created the invite when you do a serach like /invite/123.