Skip to content

Blog idea

Romans Malinovskis edited this page Sep 5, 2016 · 5 revisions

Requirement

Here are the requirements for the object model:

  • Person superclass (Name, email, password)
  • Admin is a person, who is tagged by another admin (is_admin = true)
  • Employee is a person, who is tagged manually by admin (is_employee = true)
  • Client is a separate entity that is created when "Person" places an Order.
  • Client can represent a company and can have multiple "Persons" associated. One of those is "contact_person".
  • Client can place multiple orders. Person can also create several Client records. Any person associated with Client may have access to associated orders.

Use case scenario

When a new user registers with the portal, new "Person" entry is created. By default he is not admin nor employee. Person can then log in again anytime he needs.

When person wants to go ahead and place a new order, this creates a new "Client" record for him, unless he already has one, in which case the existing record is used. The client record has some mandatory fields but those are not enforced until checkout takes place.

Additionally, new Order is placed, with the status "in-progress". Any parson that is associated with the "Client" can see order while it is in progress and modify it.

When new Client is created, then Person who created it will automatically be linked through "contact_person_id". Any person who is allowed to access client data is related through intermediate "client_person" table.

While Person can access only companies he is linked to, Admin can access any company. Employee has access to a separate section of the site, where he can only see currently placed order and can perform limited number of operations with them.

Application Database Setup

  • tables: person, client, order and 'client_person'.
  • relations: order.client_id, client.contact_person_id and client_person.person_id/client_person.client_id.
  • flags: person.is_employee, person.is_admin.

Logical entity Setup

Person

Define this as a base class extending from Model. addField('is_employee') and addField('is_admin'). Create supplementary classes 'Employee' and 'Admin'.