Building Applications with Spring 5 and Kotlin
上QQ阅读APP看书,第一时间看更新

Describing entities

The main entities that we will use and that will hold the data are Notes and TODOs. We can consider each of them as an entry that will be stored and that has common attributes:

  • IDUniversally Unique IDentifier (UUID) String
  • Title: String
  • Message: String
  • Location: String value that represents serialized Location class into JSON.

Here are all the entities that we use:

  • Note: The Note entity will represent Notes in the system with all common attributes.
  • TODO: The TODO entity will represent TODOs in the system with all common attributes and timestamps for a scheduled time.
  • User: The User entity will be completely independent of the main data entities. The user will represent the user and all the attributes that the user of the system can have, including assigned roles. The user will have the following attributes:
    • ID: UUID String
    • Email: String
    • Password: String
    • First name: String
    • Last name: String
    • Roles: String
  • Enabled: Boolean representing whether the user has activated the account or whether it has been activated by the user from a higher user hierarchy
  • Created on: Long representing UTC timestamp when the user was created
  • Updated on: Long representing UTC timestamp when the user was updated

In later stages, we can introduce additional attributes if there is a need. For now, we will stick to the most important ones we just described.