| | 1 | = ERModel |
| | 2 | |
| | 3 | == Diagram |
| | 4 | [[Image(ERModel_v02.png)]] |
| | 5 | |
| | 6 | == Entities |
| | 7 | |
| | 8 | {{{User}}} |
| | 9 | |
| | 10 | This is the core entity that represents every person registered on [https://develop.finki.ukim.mk/projects/petsitter/#PetSitter PetSitter]. It acts as a supertype for {{{Admin}}}/{{{PetOwner}}}/{{{PetSitter}}} so we can store the common attributes only in {{{User}}}. |
| | 11 | |
| | 12 | '''Candidate keys:''' |
| | 13 | * {{{user_id}}} - '''Primary key'''; numeric id, most efficient for indexing |
| | 14 | * {{{username}}} - unique but not as efficient as {{{user_id}}} |
| | 15 | * {{{email}}} - unique but not as efficient as {{{user_id}}} |
| | 16 | |
| | 17 | '''Attributes:''' |
| | 18 | |
| | 19 | * {{{user_id}}} - Numeric (Required, Unique, Auto-generated integer). |
| | 20 | |
| | 21 | * {{{username}}} - Text (Required, Unique, 4-20 characters). |
| | 22 | |
| | 23 | * {{{first_name}}} - Text (Required). |
| | 24 | |
| | 25 | * {{{last_name}}} - Text (Required). |
| | 26 | |
| | 27 | * {{{password}}} - Text (Required, Hashed format, Min. 8 characters). |
| | 28 | |
| | 29 | * {{{email}}} - Text (Required, Unique, Standard email format). |
| | 30 | |
| | 31 | ---- |
| | 32 | |
| | 33 | {{{Admin}}} |
| | 34 | |
| | 35 | Subtype/specialization of {{{User}}} entity. Inherits from {{{User}}}. Has administrator privileges. |
| | 36 | |
| | 37 | '''Candidate keys:''' |
| | 38 | * {{{user_id}}} - Inherits {{{user_id}}} from {{{User}}} |
| | 39 | |
| | 40 | '''Attributes:''' |
| | 41 | |
| | 42 | * Inherits all attributes from {{{User}}} |
| | 43 | |
| | 44 | ---- |
| | 45 | |
| | 46 | {{{PetOwner}}} |
| | 47 | |
| | 48 | Subtype/specialization of {{{User}}} entity. Inherits from {{{User}}}. Is able to make bookings for their {{{Pet}}} and request a {{{PetSitter}}}. |
| | 49 | |
| | 50 | '''Candidate keys:''' |
| | 51 | * {{{user_id}}} - Inherits {{{user_id}}} from {{{User}}} |
| | 52 | |
| | 53 | '''Attributes:''' |
| | 54 | |
| | 55 | * Inherits all attributes from {{{User}}} |
| | 56 | |
| | 57 | ---- |
| | 58 | |
| | 59 | {{{PetSitter}}} |
| | 60 | |
| | 61 | Subtype/specialization of {{{User}}} entity. Inherits from {{{User}}}. Provides services to {{{PetOwner}}}. Is able to confirm or deny bookings. |
| | 62 | |
| | 63 | '''Candidate keys:''' |
| | 64 | * {{{user_id}}} - Inherits {{{user_id}}} from {{{User}}} |
| | 65 | |
| | 66 | '''Attributes:''' |
| | 67 | |
| | 68 | * Inherits all attributes from {{{User}}} |
| | 69 | |
| | 70 | ---- |
| | 71 | |
| | 72 | {{{Pet}}} |
| | 73 | |
| | 74 | The animal that will be taken care of. Track the identity, special needs, age of the pet in the booking. Linked to {{{PetType}}} to categorize animals more efficiently. |
| | 75 | |
| | 76 | '''Candidate keys:''' |
| | 77 | * {{{pet_id}}} - '''Primary key'''; Unique surrogate key. |
| | 78 | |
| | 79 | '''Attributes:''' |
| | 80 | |
| | 81 | * {{{pet_id}}} - Numeric (Required, Unique, Auto-generated integer). |
| | 82 | |
| | 83 | * {{{name}}} - Text (Required). |
| | 84 | |
| | 85 | * {{{photo}}} - Text/URL (Optional, URL format). |
| | 86 | |
| | 87 | * {{{age}}} - Numeric (Required, non-negative integer). |
| | 88 | |
| | 89 | * {{{special_needs}}} - Text (Optional). |
| | 90 | |
| | 91 | * {{{description}}} - Text (Optional). |
| | 92 | |
| | 93 | ---- |
| | 94 | |
| | 95 | {{{PetType}}} |
| | 96 | |
| | 97 | Entity used to categorize pets (for example Cat, Dog, Rabbit, Bird). Used for storing attributes that would repeat a lot of times in one single {{{Pet}}} entity. |
| | 98 | |
| | 99 | '''Candidate keys:''' |
| | 100 | * {{{pettype_id}}} - '''Primary key'''; Unique surrogate key. |
| | 101 | * {{{species}}} - Unique but not as efficient as a numeric id key. |
| | 102 | |
| | 103 | '''Attributes:''' |
| | 104 | |
| | 105 | * {{{pettype_id}}} - Numeric (Required, Unique, Auto-generated integer). |
| | 106 | |
| | 107 | * {{{species}}} - Text (Required, Unique). |
| | 108 | |
| | 109 | * {{{average_lifespan}}} - Numeric (Optional). |
| | 110 | |
| | 111 | * {{{needs_outdoor_walk}}} - Boolean (Required, 0 or 1). |
| | 112 | |
| | 113 | |
| | 114 | ---- |
| | 115 | |
| | 116 | {{{Booking}}} |
| | 117 | |
| | 118 | The entity that connects {{{PetOwner}}}, {{{PetSitter}}}, {{{Pet}}} and the services requested for the {{{Pet}}} |
| | 119 | |
| | 120 | '''Candidate keys:''' |
| | 121 | * {{{booking_id}}} - '''Primary key'''; Unique surrogate key. |
| | 122 | |
| | 123 | '''Attributes:''' |
| | 124 | |
| | 125 | * {{{booking_id}}} - Numeric (Required, Unique, Auto-generated integer). |
| | 126 | |
| | 127 | * {{{status}}} - Text (Required, for example 'Pending', 'Confirmed', 'Completed', 'Rejected'). |
| | 128 | |
| | 129 | * {{{date_from}}} - Date (Required). |
| | 130 | |
| | 131 | * {{{date_to}}} - Date (Required). |
| | 132 | |
| | 133 | * {{{address}}} - Text (Required, location of the service). |
| | 134 | |
| | 135 | ---- |
| | 136 | |
| | 137 | {{{Review}}} |
| | 138 | |
| | 139 | The feedback that the {{{PetOwner}}} leaves for the {{{PetSitter}}} after a completed {{{Booking}}}. This is optional but it helps maintain trust and establish quality on the platform. |
| | 140 | |
| | 141 | '''Candidate keys:''' |
| | 142 | * {{{review_id}}} - '''Primary key'''; Unique surrogate key. |
| | 143 | |
| | 144 | '''Attributes:''' |
| | 145 | |
| | 146 | * {{{review_id}}} - Numeric (Required, Unique, Auto-generated integer). |
| | 147 | |
| | 148 | * {{{rating}}} - Numeric (Required, Integer from 1 to 5). |
| | 149 | |
| | 150 | * {{{comment}}} - Text (Optional). |
| | 151 | |
| | 152 | ---- |
| | 153 | |
| | 154 | {{{Service}}} |
| | 155 | |
| | 156 | Defines the type of care offered for the {{{Pet}}}, for example walking, overnight stay or short visit. If needed new services can be added without changing the database schema. |
| | 157 | |
| | 158 | '''Candidate keys:''' |
| | 159 | * {{{service_id}}} - '''Primary key'''; Unique surrogate key. |
| | 160 | |
| | 161 | '''Attributes:''' |
| | 162 | |
| | 163 | * {{{service_id}}} - Numeric (Required, Unique, Auto-generated integer). |
| | 164 | |
| | 165 | * {{{type}}} - Text (Required). |
| | 166 | |
| | 167 | * {{{description}}} - Text (Optional). |
| | 168 | |
| | 169 | |
| | 170 | ---- |
| | 171 | |
| | 172 | {{{Payment}}} |
| | 173 | |
| | 174 | Defines the financial transaction related to a {{{Booking}}}. |
| | 175 | |
| | 176 | '''Candidate keys:''' |
| | 177 | * {{{payment_id}}} - '''Primary key'''; Unique surrogate key. |
| | 178 | |
| | 179 | '''Attributes:''' |
| | 180 | |
| | 181 | * {{{payment_id}}} - Numeric (Required, Unique, Auto-generated integer). |
| | 182 | |
| | 183 | * {{{amount}}} - Numeric (Required, positive integer > 0). |
| | 184 | |
| | 185 | * {{{payment_type}}} - Text (Required, for example Cash or Card). |
| | 186 | |
| | 187 | == Relations |
| | 188 | |
| | 189 | {{{manage - Admin to User}}} |
| | 190 | * M:N relation |
| | 191 | * an {{{Admin}}} can manage multiple users, and a {{{User}}} can be managed by multiple admins. |
| | 192 | * Partial participation on Admin, Partial participation on User |
| | 193 | |
| | 194 | ---- |
| | 195 | |
| | 196 | {{{owns - PetOwner to Pet}}} |
| | 197 | * 1:N relation |
| | 198 | * one {{{PetOwner}}} can register multiple pets, but each {{{Pet}}} belongs to one owner. |
| | 199 | * Partial participation on PetOwner, Total participation on Pet |
| | 200 | |
| | 201 | ---- |
| | 202 | |
| | 203 | {{{produces - Booking to Review}}} |
| | 204 | * 1:1 relation |
| | 205 | * one {{{Booking}}} produces max. one {{{Review}}} from a client. |
| | 206 | * Partial participation on Booking, Total participation on Review |
| | 207 | |
| | 208 | |
| | 209 | ---- |
| | 210 | |
| | 211 | {{{is_a - Pet to PetType}}} |
| | 212 | * M:1 relation |
| | 213 | * many Pets can have one {{{PetType}}} (for example Cat), but each {{{Pet}}} has exactly one type. |
| | 214 | * Total participation on Pet, Partial participation on PetType |
| | 215 | |
| | 216 | ---- |
| | 217 | |
| | 218 | {{{is_for - Pet to Booking}}} |
| | 219 | * N:N relation |
| | 220 | * a {{{Booking}}} can have two pets from the same owner, while a {{{Pet}}} can be part of many bookings during its life. |
| | 221 | * Partial participation on Pet, Total participation on Booking |
| | 222 | |
| | 223 | ---- |
| | 224 | |
| | 225 | {{{books - PetOwner to Booking}}} |
| | 226 | * 1:N relation |
| | 227 | * a {{{PetOwner}}} can schedule many bookings, but each {{{Booking}}} is created by and owned by one unique {{{PetOwner}}}. |
| | 228 | * Partial participation on PetOwner, Total participation on Booking |
| | 229 | |
| | 230 | ---- |
| | 231 | |
| | 232 | {{{is_booked - PetSitter to Booking}}} |
| | 233 | * 1:N relation |
| | 234 | * a {{{PetSitter}}} can be booked for many bookings, but each {{{Booking}}} is assigned to only one {{{PetSitter}}} at a time. |
| | 235 | * Partial participation on PetSitter, Total participation on Booking |
| | 236 | |
| | 237 | ---- |
| | 238 | |
| | 239 | {{{provides - PetSitter to Service}}} |
| | 240 | * M:N relation |
| | 241 | * a {{{PetSitter}}} can provide multiple services (Walking, Overnight stay) and a {{{Service}}} (Walking) can be provided by many different sitters. |
| | 242 | * Total participation on PetSitter, Partial participation on Service |
| | 243 | |
| | 244 | ---- |
| | 245 | |
| | 246 | {{{requires - Booking to Service}}} |
| | 247 | * M:N relation |
| | 248 | * a {{{Booking}}} can require multiple services (Walking, Overnight stay) and a specific {{{Service}}} type can be requested in many different bookings. |
| | 249 | * Total participation on Booking, Partial participation on Service |
| | 250 | |
| | 251 | ---- |
| | 252 | |
| | 253 | {{{charged - Booking to Payment}}} |
| | 254 | * 1:1 relation |
| | 255 | * each {{{Booking}}} has exactly one {{{Payment}}} record, and each {{{Payment}}} record is associated with exactly one {{{Booking}}} |
| | 256 | * Partal participation on Booking, Total participation on Payment |
| | 257 | |
| | 258 | == Version history |
| | 259 | |
| | 260 | [https://develop.finki.ukim.mk/projects/petsitter/wiki/ConceptualModel_v01 v01] |
| | 261 | * Initial version |
| | 262 | |
| | 263 | [https://develop.finki.ukim.mk/projects/petsitter/wiki/ConceptualModel v02] |
| | 264 | * Current version |
| | 265 | * Added '''owns''' relation between {{{PetOwner}}} and {{{Pet}}}; so each pet can be assigned to an owner |
| | 266 | * Added '''produces''' relation between {{{Booking}}} and {{{Review}}}; so each review can be associated directly with only a booking |
| | 267 | * Removed redundant '''leaves''' relation between {{{PetOwner}}} and {{{Review}}} |
| | 268 | * Removed redundant '''receives''' relation between {{{PetSitter}}} and {{{Review}}} |