Robert
Robert

Reputation: 3543

DDD suggest a relation between entities

I have a following structure.

Resources can have multiple endpoints.

Example: Resource tickets can be accessed on following endpoints:

At first, this looks like aggregate, where Resource is AR, and endpoints are child entities.

I also have UserTypes. What I need is to build a relation between Usertypes and Endpoints, so each UserType can have a diferrent access for endpoints. Example for, UserType admin could access all endpoints for tickets resource, while user type agent could have access to only portion of endpoints for the same resource.

What would be a suggested way to connect EndPoints and UserTypes in terms of DDD?

enter image description here

Upvotes: 1

Views: 406

Answers (1)

tomliversidge
tomliversidge

Reputation: 2369

Do you need anything else other than a collection of mapping a between Resources and Endpoints on a UserType? This would give you all usertypes their unique resource endpoint access rights

Also seems to be the same question as Solve apparent need for outside reference to entity inside aggregate (DDD)

I would probably create something like the following:

class ResourceEndpoint {
    Guid resourceId;
    Guid endpointId;
}

class UserType {
    List<ResourceEndpoint> ThingsICanAccess;
}

Upvotes: 1

Related Questions