Skip to content

Domain Model

Katrina Poulin edited this page Feb 10, 2020 · 6 revisions

Domain Model

Deliverable 1 Version

Untitled Diagram (2)

Classes

The domain model consists of 7 classes:

  • User: Self-explanatory;
  • Forum: Whenever a user creates a thread to ask a question, a Forum class is instantiated. It contains a list of comments that were made on that specific thread, and holds a list of users who chose to subscribe to that thread;
  • Comment: Text messages that are added to a thread;
  • Donation: Objects containing the amount that was donated as well as information such as the date of donation and user who donated;
  • Pet: Self-explanatory;
  • Advertisement: Whenever a user wants to put a pet up for adoption, an advertisement is created with information about the pet, and extra details such as reason as to why the pet is being given away.
  • AdoptionApplication: Such an object is created when a user applies to have a pet up for adoption.

Important Decisions

  • Since there is no case in which users change roles, we did not use the User-Role pattern. Instead, we used an enumeration UserType for the different types of users (User, admin).
  • We have picture attributes in User and Pet of type byte[]. Those are for the profile picture of the user and a picture of the pet.
  • The Forum class has references to all of the comments that are posted in the thread itself; they can be sorted by Date.
  • Users can subscribe to threads; the Forum class holds the Users who subscribed to the thread.
  • Advertisements can advertise infinitely many pets.
  • Users do not need to be logged in to make a donation.
  • When a User registers, a JWT token is generated and an email is sent to the user's email with a link to confirm the user's account. When the user clicks on the link, the account is validated.
  • The only composition we have is for Forum -> Comment. When a thread is deleted, all of the comments serve no purpose so they should be deleted. When a user is deleted however, its comments should still exist, but be displayed as posted by "deleted". We will also have applications be deleted when either the advertisement linked to it is deleted or when the user making the application is deleted. Since that would be two composition constraints on the same class, we cannot have that constraint in the domain model, so we stayed clear of that.