wiki:ERModel

Entity-Relationship Model v.02

Diagram

Data Requirements

Entities

Users

Description: Users represents all individuals who interact with the system. This includes teaching staff who reserve resources for lectures and research, students who view availability and access permitted resources, and faculty administrators who manage the system. The entity is central to tracking who makes reservations and who approves them.

Candidate Keys:

  • Primary key: user_id (chosen as a surrogate key for efficiency and to avoid issues with changing natural identifiers)
  • Alternative candidates: email (unique per user, but may change)

Attributes:

AttributeData TypeConstraintsDescription
user_idINTEGERPK, NOT NULLUnique identifier for each user
first_nameVARCHAR(128)NOT NULLUser's first name
last_nameVARCHAR(128)NOT NULLUser's family name
emailVARCHAR(128)NOT NULL, UNIQUEInstitutional email address used for login
passwordVARCHAR(128)NOT NULLHashed password for authentication

UserTypes

Description: UserTypes categorizes users into different roles within the system. This entity enables role-based access control, distinguishing between teaching staff, students, and faculty administrators. Each role has different permissions for viewing, reserving, and managing resources.

Candidate Keys:

  • Primary key: type_id (surrogate key for referential integrity)
  • Alternative candidates: type_name (unique, but surrogate preferred for foreign key references)

Attributes:

AttributeData TypeConstraintsDescription
type_idINTEGERPK, NOT NULLUnique identifier for each user type
type_nameVARCHAR(128)NOT NULL, UNIQUEName of the role (e.g., 'Student', 'Teaching Staff', 'Administrator')
descriptionVARCHAR(128)NOT NULLDetailed description of the role's permissions and purpose

Resources

Description: Resources represents all physical and digital items that can be reserved within the faculty. Physical resources include laboratory equipment, projectors, rooms, and specialized tools. Digital resources may include software licenses, virtual machines, or online services. This entity is central to the reservation system. Availability windows are stored directly on the resource for simplicity.

Candidate Keys:

  • Primary key: resource_id (surrogate key for efficiency)
  • Alternative candidates: name (if unique within the system)

Attributes:

AttributeData TypeConstraintsDescription
resource_idINTEGERPK, NOT NULLUnique identifier for each resource
nameVARCHAR(128)NOT NULLDescriptive name of the resource
descriptionVARCHAR(128)NOT NULLDetailed description including specifications, capacity, or usage instructions
available_fromTIMENOT NULL, DEFAULT '08:00'Daily start time when the resource becomes available
available_toTIMENOT NULL, DEFAULT '20:00'Daily end time when the resource stops being available
available_weekendsBOOLEANNOT NULL, DEFAULT FALSEWhether the resource is available on Saturday and Sunday

ResourceTypes

Description: ResourceTypes categorizes resources into different types for easier navigation and filtering. Examples include 'Laboratory Equipment', 'Classroom', 'Software License', 'Projector', etc. The is_physical attribute distinguishes between physical resources (that have a location) and digital resources.

Candidate Keys:

  • Primary key: type_id (surrogate key for referential integrity)
  • Alternative candidates: type_name (unique, but surrogate preferred)

Attributes:

AttributeData TypeConstraintsDescription
type_idINTEGERPK, NOT NULLUnique identifier for each resource type
type_nameVARCHAR(128)NOT NULL, UNIQUEName of the category (e.g., 'Projector', 'Laboratory', 'Software')
is_physicalVARCHAR(128)NOT NULLIndicates if resources of this type are physical ('Y') or digital ('N')

Locations

Description: Locations stores information about physical places where resources can be found. This enables users to know where to pick up or use a resource. Only physical resources are linked to locations; digital resources do not require this association.

Candidate Keys:

  • Primary key: location_id (surrogate key for efficiency)
  • Alternative candidates: (building, room) composite key

Attributes:

AttributeData TypeConstraintsDescription
location_idINTEGERPK, NOT NULLUnique identifier for each location
buildingVARCHAR(128)NOT NULLBuilding name or code (e.g., 'TMF', 'FINKI-A')
roomVARCHAR(128)NOT NULLRoom number or name within the building

Reservations

Description: Reservations is the core transactional entity that records each booking of a resource by a user. It tracks the time period, status (pending, approved, rejected, completed), and purpose of each reservation. This entity connects users with resources and enables conflict detection and usage analytics. Recurring reservations are linked together via a shared recurrence_group_id, with the actual recurrence pattern logic handled by the application backend.

Candidate Keys:

  • Primary key: reservation_id (surrogate key for unique identification)
  • Alternative candidates: None suitable (combination of user, resource, and time could work but is complex)

Attributes:

AttributeData TypeConstraintsDescription
reservation_idINTEGERPK, NOT NULLUnique identifier for each reservation
start_timeTIMESTAMPNOT NULLWhen the reservation begins
end_timeTIMESTAMPNOT NULLWhen the reservation ends (must be after start_time)
statusVARCHAR(128)NOT NULLCurrent status: 'pending', 'approved', 'rejected', 'completed', 'cancelled'
purposeVARCHAR(128)NOT NULLDescription of why the resource is being reserved
created_atTIMESTAMPNOT NULLWhen the reservation was created in the system
recurrence_group_idUUIDNULLGroups reservations that belong to the same recurring series; NULL for one-time reservations

Relationships

has_type (Users - UserTypes)

Description: Each user is assigned exactly one user type that determines their role and permissions in the system. A user type can be assigned to many users. This is a mandatory relationship for users (total participation) since every user must have a defined role.

Cardinality: N:1 (Many users to one user type)

Participation:

  • Users: Total (every user must have a type)
  • UserTypes: Partial (a type may exist without assigned users)

makes (Users - Reservations)

Description: Users create reservations for resources. One user can make multiple reservations over time, but each reservation is made by exactly one user. This relationship tracks who requested each reservation.

Cardinality: 1:N (One user makes many reservations)

Participation:

  • Users: Partial (not all users make reservations)
  • Reservations: Total (every reservation has a creator)

approves (Users - Reservations)

Description: Faculty administrators approve or reject reservations. This relationship is separate from 'makes' to distinguish between the user who requested a reservation and the administrator who processed it. One administrator can approve many reservations.

Cardinality: 1:N (One administrator approves many reservations)

Participation:

  • Users: Partial (only administrators approve)
  • Reservations: Partial (pending reservations have no approver yet)

reserved_in (Reservations - Resources)

Description: Each reservation is for exactly one resource. A resource can have many reservations over time (though not overlapping for the same time period). This is a mandatory relationship for reservations since every booking must specify what is being reserved.

Cardinality: N:1 (Many reservations to one resource)

Participation:

  • Reservations: Total (every reservation must be for a resource)
  • Resources: Partial (a resource may have no reservations)

categorized_as (Resources - ResourceTypes)

Description: Each resource belongs to exactly one resource type for categorization purposes. This enables filtering and determines whether the resource is physical (requires location) or digital. The relationship is mandatory for resources.

Cardinality: N:1 (Many resources to one resource type)

Participation:

  • Resources: Total (every resource must have a type)
  • ResourceTypes: Partial (a type may exist without resources)

located_at (Resources - Locations)

Description: Physical resources are associated with a location where they can be found or used. Digital resources do not have locations. One location can house multiple resources (e.g., a lab room with multiple pieces of equipment).

Cardinality: N:1 (Many resources to one location)

Participation:

  • Resources: Partial (only physical resources have locations)
  • Locations: Partial (a location may have no resources assigned)

Entity-Relationship Model History

VersionDateChanges
v012025-01-19Initial version with 8 entities and 8 relationships
v022026-02-05Removed RecurrencePatterns entity; added recurrence_group_id to Reservations for simpler recurring reservation handling (pattern logic moved to backend). Removed AvailabilitySlots entity and available_during relationship; added available_from, available_to, available_weekends attributes to Resources.
Last modified 31 hours ago Last modified on 02/05/26 14:42:34

Attachments (4)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.