M
M
Maxim2019-07-07 21:04:59
Software design
Maxim, 2019-07-07 21:04:59

Microservices how to display a general profile?

Hello!
I would like to ask how a common profile is implemented in microservices.
I have multiple services of the same application. An example of two:
user - serves for authentication and a single account.
event - used to work with events.
The event has its own entities. Entities, of course, are not connected in any way either in the database or in the code by other services. Entities in event have only a link by user_id to the user service.
Example
- id
- user_id
- first_name
- last_name
- city
And now the question arises ... How to display a general profile and photo in the event microservice. Provided that they must be both independent?
An example of what I mean can be seen on the well-known Yandex platform. Yandex has a passport where profile data and an avatar are stored. And there are also other services: Yandex taxi, Yandex reviews...
Accordingly, Yandex reviews display information from the passport service profile: avatar and full name. I understand that the first and last names are simply copied from the passport to the feedback service into their entity. But what about the avatar?
And another question. How to use the unified system of cities? All entities need cities. From the point of view of normalization, it is better to separate them into separate tables and refer to them. But then again we come to connectedness. It turns out that each service needs to implement its own cities?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2019-07-07
@myks92

The phrase 'displayed' means you have methods that convert these objects into a representation (html for example), this is either a part of the user/event/.. entities (that is, each entity can display itself) or a separate entity who knows about all existing ones and knows how to draw them.
Actually this is the answer to your question - your implementation will walk between these extremes.
But when it comes to data usage, i.e. if suddenly one entity needs a piece of data from another, i.e. for example, event must know the user's date of birth in order to be able to add DR to the calendar, then either you must create some kind of abstract intermediary entity that can give additional dates for the calendar and knows where they can be taken from (both about user and having methods that event knows about ), or hammer the relationship between entities into the code (write date methods for user and directly request, i.e. in the user method, you need to register access to objects of the user type, or rather the class then to for all types of user).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question