Does the user create an order in OrderController or UserController?

problem description

should the user create an order in UserController or OrderController?

//
public void UserController{

}
//
public void OrderController{

}

for example, adding users to a group, should it be placed in GroupController or UserController?

//UserController
public void UserController{

}
//GroupController
public void GroupController{
    
}

personally, from the point of view of code implementation, no matter which controller is placed, it can be implemented. But from a business point of view, there should be a basic principle of division . I would like to ask you usually develop according to what principles to divide ?
Thank you!

Mar.25,2021

personal understanding:
when the user creates an order, the result is that a new record is added to the order table, so I think it should be placed in OrderController.

I hope I can help you. Thank you


if designed according to the restful-style interface, the order created by the user can be designed as follows:

POST /user/{userId}/order

this interface I will write under UserController
can also be designed as

POST /order?userId={userId}

if this is the interface, I will write it under OrderController.
you can use whatever you are used to

Menu