== ERModel Current version == Diagram == [[Image(ERModel_v01.png)]] == Data requirements == === ENTITIES === {{{User}}} [[BR]] 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. [[BR]] '''[[span(style=color: #E30B5C, Candidate keys: )]]''' * {{{user_id}}} – surrogate numeric identifier (chosen primary key). * {{{username}}} – natural key, must be unique, but can change in the future. * {{{email}}} – also unique, but might change and can be reused if a user is deleted. {{{user_id}}} is chosen as PK because it is stable, short, and independent of business rules. [[BR]] '''[[span(style=color: #E30B5C, Attributes: )]]''' * {{{user_id}}} – numeric, required. Auto-generated positive integer; primary key. * {{{username}}} – text, required. Unique; max length ~30; only letters, digits and some symbols. * {{{role}}} – text, required. Limited set of values: {ADMIN, USER, GUEST}; implemented as enum. * {{{fullname}}} – text, required. Free-text full name. * {{{name}}} – text, required. First name; max length ~50. * {{{surname}}} – text, required. Last name; max length ~50. * {{{email}}} – text, required. Must be unique; email format validation. * {{{created_at}}} – datetime, required. Automatically set when the account is created. == ERModel History