Need ideas when developing Grails domain classes

I am learning Grails, I am trying to create a small application. And while I'm working on the registration part.

There are 3 different types of registration process 1) As an employee, my registration submission differs from different fields 2) As a type of registration, an employer will be different when I collect data from a company, an authorized representative who can act on behalf of the company. In fact, I thought that the company (employer) is not an actor, but a representative is an actor and, therefore, needs a representative class of the domain. 3) the type of retail registration is different.

Therefore, I need to define the domain classes and its relationships. I am very new to grails and I need to be guided when designing

At first I thought about the user domain class and had UserTypes (which defines different types of users, for example, representative, seller, and employee), but I'm not sure if this works.

Evaluate if anyone can help me create domain classes.

thanks

+4
source share
1 answer

You definitely want to display the domain classes before you start viewing the views. Is an authorized representative always an employee, or is it a completely different organization?

Think about it in terms of objects and try to simulate it as much as possible. The company has employees and may have an authorized representative. Here's a sample layout:

class Employee { String firstName, lastName /* etc... */ } class Company { String name /* etc */ Representative authorizedRepresentative static hasMany = [ employees : Employee ] } class Representative { } 

Of course, you might want Employee links back to Company . See “Relational object mapping” in Grails docs.

+1
source

All Articles