How do I design MySQL schema to store Resource MetaData that varies from caller to caller

56
March 03, 2021, at 01:40 AM

Consider a hypothetical situation given below

Assume that we have multiple entities for different types of users in our application, like

  1. Producer
  2. Seller
  3. Employee

These 3 entities have their own tables which have the fields like name, address, and other details which vary from user to user

There is a shared resource among them that has a structure as follows

Table Name: Images Fields:

  1. ID AUTO_INCREMENT
  2. URL VARHAR
  3. Timestamp
  4. UserID INT
  5. Role ENUM ("Producer", "Seller", "Consumer")

Consider the above table to be a resource accessible via a microservice that maintains it's own state. Is there a way to decouple the userId and role from the service? Here I am considering the userId and role to be metadata that is not directly linked to the resource. What modifications can we make in the above schema to make it more flexible for N different users?

Do I need to write specific queries and APIs for each type of users when I am fetching the data? Or can we make a single general API to fetch the data. Consider that I want to show metadata along with the resource data to the user.

This question is more of a discussion than a problem. Apologies if it doesn't match the StackOverflow guidelines.

READ ALSO
Regular expression that accepts only letters, spaces in between words and hyphens after word

Regular expression that accepts only letters, spaces in between words and hyphens after word

I'm trying to write a regular expression to capture what I mentioned above but for the hyphen part, it seems like it still matches words that start with a hyphen

65
Importing whole SVG images folder from another direction

Importing whole SVG images folder from another direction

I want to import whole folder with my SVG icons from another directionFor now i know how to import a single file one by one

38
Xamarin Android On tab on push notification app not launched if in background or killed

Xamarin Android On tab on push notification app not launched if in background or killed

i am using both notification and data payload for push notificationit is working find if app is running

59
Does Google Big query Node library uses gRPC

Does Google Big query Node library uses gRPC

I would like to know if Google Node library uses gRPC or notI don't find any option to raise Question against Git repo so looking for guidance here

40