I am a .net server side developer wish to make web application with the following logic:User registeration (CRUD)Activity registeration (CRUD): What, Where, WhenUser can create activitiy item, for example:Soccer game, rose stadium, Portland, Oregon, 10/12/2016, 20:00.CRUD for User/Activity can be implemented via rest API and save all the json to noSQL.My question is, when designing apps (Client can be Web/Phone app/more), what happens when I want to add additional logic ?When the user adds activity, I want to do the following:1. Create a list of users that might be intereseted in that activity2. Send them suggestion on that activity.So I assume I need a SuggestionService component, Where do i combine it ?  From what I know the flow is usually like this (RestAPI):  ActivityController.AddNewActivity(data) -> Take json and build class  ActivityService.AddNewActivity(data) -> Validate class data   ActivityRepository.AddNewActivity(data) -> add data to mongoDB/RedisWhere the new logic should be ? ActivityService.AddNewActivity implementation should be (pseudo code):  public void ActivityService.AddNewActivity(data)  {  if (!data.IsValid()) throw new Exception(..);  ActivityRepository.AddNewActivity(data);  var relUsers = SuggestionService.GetRelevantUsersForActivity(data.Id);UserService.SendActivityToUsers(data.Id, relUsers);  }  Or should I just do ActivityRepository.AddNewActivity(data);And to have a state machine status on the Activity object, 1=created, 2=suggested, 3=inprogress, 4=completedAnd then to make a jobs/logic service that poll activities from mongoDB, and according to their state do different behaviors.For example every 1 minute it will check, if new activity was made, get relevant users and send them suggestions.  The jobs/logic service is not related by any mean to the CRUD operations, it only manipulates data on mongo and users the REST API to do operations (get relevant users, send activity to users) etc, It can be written in C#, and the CRUD API in java.I am not certain about architecture of complex apps, What I try to do is seperate the logic of the jobs from the logic of the regular CRUD REST API. Am i doing it right ?
Architecture regarding to buisness logic component in REST API
design;architecture;high level