| 2 | | = Diagram = |
| 3 | | = Data requirements = |
| | 2 | == Diagram == |
| | 3 | [[Image(ERModel_v01.png)]] |
| | 4 | == Data requirements == |
| | 5 | === ENTITIES === |
| | 6 | {{{User}}} |
| | 7 | [[BR]] |
| | 8 | Represents every person using the platform: buyers, sellers, and administrators. It is needed to authenticate users, assign roles, and link their actions (listings, reviews, notifications, ownership of animals). It is modeled as a single entity with a role attribute instead of separate tables for buyers/sellers/admins, because one person can play multiple roles over time. |
| | 9 | [[BR]] |
| | 10 | '''[[span(style=color: #E30B5C, Candidate keys: )]]''' |
| | 11 | * {{{user_id}}} – surrogate numeric identifier (chosen primary key). |
| | 12 | * {{{username}}} – natural key, must be unique, but can change in the future. |
| | 13 | * {{{email}}} – also unique, but might change and can be reused if a user is deleted. |
| | 14 | {{{user_id}}} is chosen as PK because it is stable, short, and independent of business rules. |
| | 15 | [[BR]] |
| | 16 | '''[[span(style=color: #E30B5C, Attributes: )]]''' |
| | 17 | * {{{user_id}}} – numeric, required. Auto-generated positive integer; primary key. |
| | 18 | * {{{username}}} – text, required. Unique; max length ~30; only letters, digits and some symbols. |
| | 19 | * {{{role}}} – text, required. Limited set of values: {ADMIN, USER, GUEST}; implemented as enum. |
| | 20 | * {{{fullname}}} – text, required. Free-text full name. |
| | 21 | * {{{name}}} – text, required. First name; max length ~50. |
| | 22 | * {{{surname}}} – text, required. Last name; max length ~50. |
| | 23 | * {{{email}}} – text, required. Must be unique; email format validation. |
| | 24 | * {{{created_at}}} – datetime, required. Automatically set when the account is created. |