Mendix generates proxy classes that can do this really easily for you.
Look in javasource/<yourmodulename>/proxies
The code could then be as simple as
If you really don’t want to use the proxy classes, have a look at the code it generates and use that, but it’s really not recommended to do so.
try the below:
const team_department = domainmodels.Association.createIn(domainModel);
team_Customer.name = `team_department`;
eventType_Customer.parent = eventType ;
eventType_Customer.child = department;