Skip to main content

Overview

This section documents the database models used, powered by Prisma and PostgreSQL. Each model represents a database table, such as users, worlds, bosses, events, and their relationships.

How Models Relate

  • Boss: Represents a boss. Boss progress is tracked per world.
  • Event: Events scheduled in worlds, created by users.
  • EventRSVP: Tracks which users have RSVP'd to which events.
  • JoinCode: Unique code for joining a world.
  • Note: Notes created by users within worlds.
  • User: Represents a user. Users can create new worlds or join existing worlds via join codes. They can also create events, RSVP to events, and create notes.
  • World: Represents a game world. Worlds have members, bosses, notes, and events.
  • WorldBossProgress: Tracks the killed state of bosses in worlds.
  • WorldMembership: Links users to worlds with a specific role

Enum: Role

Defines possible roles for world membership:

  • OWNER: Full control over the world.
  • ADMIN: Admin privileges.
  • SUB_ADMIN: Limited admin privileges.
  • MEMBER: Regular member.

Relationships Diagram

ModelRelated ToRelationship
UserWorldMembershipOne user can have many memberships
WorldWorldMembershipOne world can have many memberships
WorldJoinCodeOne world has one join code
WorldWorldBossProgressOne world can have many boss progress records
BossWorldBossProgressOne boss can have many progress records (per world)
WorldNoteOne world can have many notes
UserNoteOne user can author many notes
WorldEventOne world can have many events
UserEventOne user can create many events
EventEventRSVPOne event can have many RSVPs
UserEventRSVPOne user can RSVP to many events

Usage Notes

  • All IDs are generated using cuid() for uniqueness.
  • Unique constraints (e.g., usernames, join codes) ensure data integrity.
  • Prisma is used for querying and managing relationships between models.