Changes between Version 8 and Version 9 of ConceptualModel


Ignore:
Timestamp:
12/10/25 18:53:18 (3 weeks ago)
Author:
231035
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ConceptualModel

    v8 v9  
    66{{{User}}}
    77[[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.
     8User 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).
    99[[BR]]
    1010'''[[span(style=color: #E30B5C, Candidate keys: )]]'''
     
    1717* {{{user_id}}} – numeric, required. Auto-generated positive integer; primary key.
    1818* {{{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.
    2019* {{{fullname}}} – text, required. Free-text full name.
    2120* {{{name}}} – text, required. First name; max length ~50.
     
    2322* {{{email}}} – text, required. Must be unique; email format validation.
    2423* {{{created_at}}} – datetime, required. Automatically set when the account is created.
     24[[BR]]
     25----
     26{{{Admin}}}
     27[[BR]]
     28Admin 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]]
     39Client 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]]
     50Owner 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..
    2557[[BR]]
    2658----
     
    118150{{{Review}}}
    119151[[BR]]
    120 Represents feedback written by a user about either another user (e.g., a seller) or a veterinary clinic. It is essential for trust, transparency, and reputation. It is modeled with two optional foreign keys — {{{target_user_id}}} and {{{target_clinic_id}}} — so that a single structure supports reviewing people and organizations. A design constraint ensures that at least one of them must be non-null.
     152Represents feedback written by a user about either another user (e.g., a seller) or a veterinary clinic. It is essential for trust, transparency, and reputation.
    121153[[BR]]
    122154'''[[span(style=color: #E30B5C, Candidate keys: )]]'''
     
    129161* {{{comment}}} – text, optional. Free-text comment; up to ~1000 characters.
    130162* {{{reviewer_id}}} – numeric, required. Foreign key to User.user_id.
    131 * {{{target_user_id}}} – numeric, optional. FK to User.user_id. Must be non-null when review is about a user.
    132 * {{{target_clinic_id}}} – numeric, optional. FK to VetClinic.clinic_id. Must be non-null when review is about a clinic.
    133163* {{{created_at}}} – datetime, required. Time of submission.
    134164* {{{rating}}} – numeric, required. Integer 1–5; enforce interval [1, 5].
    135165'''[[span(style=color: #E30B5C, Special constraint: )]]'''
    136166At least one of {{{target_user_id}}} or {{{target_clinic_id}}} must be NOT NULL (exactly one in normal operation).
     167[[BR]]
     168----
     169{{{UserReview}}}
     170[[BR]]
     171UserReview 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]]
     182ClinicReview 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.
    137189[[BR]]
    138190----
     
    167219----
    168220[[BR]]
    169 {{{made_by (User – Listing)}}}
     221{{{made_by (Owner – Listing)}}}
    170222[[BR]]
    171223Links each listing to the user who created it. It is needed to track authorship, rights to modify the listing, and contact information. Modeled as 1–N because one user can create many listings, but each listing is created by exactly one user.
     
    191243[[BR]]
    192244----
    193 {{{owns (User – Animal)}}}
     245{{{owns (Owner – Animal)}}}
    194246[[BR]]
    195247Represents ownership of animals. It ensures that only the rightful owner can manage listings or initiate health-related actions. Modeled as 1–N: one user can own many animals, while each animal has exactly one current owner.
     
    201253'''[[span(style=color: #E30B5C, Attributes: )]]'''
    202254Foreign key {{{owner_id}}} is stored in Animal.
     255----
     256[[BR]]
     257{{{approves (Admin – Listing)}}}
     258[[BR]]
     259Represents that a admin approves a vetclinic to be a part of the system.
    203260----
    204261[[BR]]