| 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. |
| | 8 | User represents every account in the system (admins and clients). It is the supertype in the user-hierarchy, holding all shared identity and login data. Modeling it as a separate entity avoids duplicating attributes in Admin/Client/Owner and makes authorization logic easier. It is needed to authenticate users, assign roles, and link their actions (listings, reviews, notifications, ownership of animals). |
| | 24 | [[BR]] |
| | 25 | ---- |
| | 26 | {{{Admin}}} |
| | 27 | [[BR]] |
| | 28 | Admin is a specialization of User representing accounts with administrative privileges (approving clinics, moderating listings, etc.). |
| | 29 | [[BR]] |
| | 30 | '''[[span(style=color: #E30B5C, Candidate keys: )]]''' |
| | 31 | * {{{user_id}}} - inherited from User, serves as primary key and foreign key to {{{User}}} |
| | 32 | [[BR]] |
| | 33 | '''[[span(style=color: #E30B5C, Attributes: )]]''' |
| | 34 | * No additional attributes beyond those of User. |
| | 35 | [[BR]] |
| | 36 | ---- |
| | 37 | {{{Client}}} |
| | 38 | [[BR]] |
| | 39 | Client is the specialization for “regular” platform users (people who interact with clinics and animals). It is modeled as a subtype to distinguish them from Admins, while still sharing the common User attributes. |
| | 40 | [[BR]] |
| | 41 | '''[[span(style=color: #E30B5C, Candidate keys: )]]''' |
| | 42 | * {{{user_id}}} - inherited from User, serves as primary key and foreign key to {{{User}}} |
| | 43 | [[BR]] |
| | 44 | '''[[span(style=color: #E30B5C, Attributes: )]]''' |
| | 45 | * No additional attributes beyond those of User. |
| | 46 | [[BR]] |
| | 47 | ---- |
| | 48 | {{{Owner}}} |
| | 49 | [[BR]] |
| | 50 | Owner is a client who actually has animals registered in the system. It’s modeled as a subtype of Client to explicitly express that only some clients own pets, and to support constraints like “only owners may book appointments”. |
| | 51 | [[BR]] |
| | 52 | '''[[span(style=color: #E30B5C, Candidate keys: )]]''' |
| | 53 | * {{{user_id}}} - inherited, primary key and FK to {{{Client}}} (and transitively User). |
| | 54 | [[BR]] |
| | 55 | '''[[span(style=color: #E30B5C, Attributes: )]]''' |
| | 56 | * No additional attributes.. |
| | 167 | [[BR]] |
| | 168 | ---- |
| | 169 | {{{UserReview}}} |
| | 170 | [[BR]] |
| | 171 | UserReview is the specialization of Review used when a review is directed at a user (for example another owner, sitter, or vet user). It is modeled as a subtype of Review so that all generic review attributes (text, rating, author, time) come from the parent, while UserReview adds only the information specific to “reviews about users”, namely who the target user is. |
| | 172 | [[BR]] |
| | 173 | '''[[span(style=color: #E30B5C, Candidate keys: )]]''' |
| | 174 | * {{{review_id}}} – inherited from Review and used as both primary key and foreign key to {{{Review.review_id}}}. |
| | 175 | [[BR]] |
| | 176 | '''[[span(style=color: #E30B5C, Attributes: )]]''' |
| | 177 | * {{{target_user_id}}} – required; Foreign key to User.user_id; identifies the user being reviewed. Must reference an existing user account. |
| | 178 | [[BR]] |
| | 179 | ---- |
| | 180 | {{{ClinicReview}}} |
| | 181 | [[BR]] |
| | 182 | ClinicReview is the specialization of Review for feedback that targets a veterinary clinic. It is a subtype of Review for the same reasons as UserReview: all generic review data is stored once in Review, while ClinicReview adds only the clinic being reviewed. This allows you to attach the special business rule “a user may review a clinic only if they have at least one DONE appointment at that clinic” specifically to ClinicReview without complicating user reviews. |
| | 183 | [[BR]] |
| | 184 | '''[[span(style=color: #E30B5C, Candidate keys: )]]''' |
| | 185 | * {{{review_id}}} – inherited from Review; primary key of ClinicReview and foreign key to {{{Review.review_id}}} |
| | 186 | [[BR]] |
| | 187 | '''[[span(style=color: #E30B5C, Attributes: )]]''' |
| | 188 | * {{{target_clinic_id}}} – required; Foreign key to User.user_id; identifies the clinic being reviewed. Must reference an existing clinic. |