I am building a feature that is powered by a given table, called Urls
, structured as below:
externalId| activatedId | url | userId
This table is populated, driven by 2 scenarios (flows):
Whenever a user creates an account in my system, a event is then consumed from a kafka queue to retrieve the user id and url. These are then persisted
Urls
on the corresponding columns. So at this point we do haveexternalId
andactivatedId
nulled .externalId
andactivatedId
are populated at a later stage, after a user do activate its account. This will mean thatuserId
will also be nulled from table, keepingurl
untouched.
Given these are two independent flows, and am trying to design both flows in a domain driven approach, i am considering to create 2 repositories, accessig the same Urls
table:
UserCreateRepository
UserActivationRepository
Each repository would then have knowledge of it's own representation of the Url:
UserCreateRepository
would useUserCreationUrl
;UserActivationRepository
would useUserActivationUrl
;
I would like to open a discussion to understand what is the best approach, as i feel that having only one repository will mix boths flows and we're handling different scenario entities.