Reputation: 1
I have the below scenerio, I could complete it simply calling each responsible service within other services but this will violate the SRP.
its a post method accessed via /organization. when user send request to this method, I must do the following tasks in the same pattern:
How do I handle this in the organization controller as soon as the request is received? I dont want to inject the UserService inside the OrganizationService and so on for the rest of them.
I am a developer with few months of experience in NestJS and this is bothering me.
I have alread done it this way (psudo code):
OrganizationController {
/organization
saveOrganization(body){
const org = this.organizationService.create(body)
const user = this.userService.create(org.id)
const orgUser = this.orgUserService.create(user.id,org.id)
triggerEvent('user.created',{payload})
}}
Upvotes: 0
Views: 83