Skip to content

App Database Documentation

Cassio Manuguerra edited this page May 8, 2024 · 3 revisions

Introduction

This document provides an overview of the database schemas and models used in our application, which uses Firebase Firestore as its NoSQL database solution. Below are the detailed schemas for each collection in our database.

Collections and Schemas

users

User entry defined by userId:

  • userId: string (unique identifier for each user)
  • userName: string (user's display name)
  • email: string (user's email address)
  • profilePictureUrl: string (URL to the user's profile picture)
  • description: string (user's self-description)
  • language: string (user's preferred language)
  • prefActivity: string (user's preferred activity type)
  • levels: object
    • climbingLevel: string
    • hikingLevel: string
    • bikingLevel: string
    • ... (additional levels can be added as needed)
  • friends: array of strings (user IDs of friends)
  • friendRequests: array of strings (user IDs of pending friend requests)
  • favorites: array of strings (activity IDs of favorite activities)

user_activities

User Activity defined by userId:

  • Climbing: array of objects with fields:
    • activityId: string
    • timeStarted: timestamp
    • timeFinished: timestamp
    • numPitches: integer
    • totalElevation: float
  • Hiking: array of objects with fields:
    • activityId: string
    • timeStarted: timestamp
    • timeFinished: timestamp
    • avgSpeed: float
    • distanceDone: float
    • elevationChange: float
  • Biking: array of objects with fields:
    • activityId: string
    • timeStarted: timestamp
    • timeFinished: timestamp
    • avgSpeed: float
    • distanceDone: float
    • elevationChange: float

activities

Each Activity by activityId:

  • activityId: string (unique identifier for each activity)
  • osmId: integer (OpenStreetMap identifier)
  • activityType: string (type of activity)
  • name: string (name of the activity)
  • startPosition: geopoint (starting position of the activity)
  • rating: float (average rating of the activity)
  • numRatings: integer (number of ratings for the activity)
  • ratings: array of user made ratings
    • userId: string
    • comment: string
    • rating: integer
  • difficulty: string (difficulty level of the activity)
  • activityImageUrl: string (URL to the activity image)
  • climbingStyle: string (What type of climbing this activity represents)
  • elevationTotal: float (How much you have to climb)
  • from: string (Starting point of activity)
  • to: string (End point of activity)
  • distance: float (Total distance of the activity)

conversations

Each conversation document is identified by concatenation of the 2 userIds of the people interacting with each other

  • members: array of strings:
    • userId0: string
    • userId1: string
  • messages: array of object message defined below
    • content: string (message content)
    • from: string (userId of the sender)
    • timeStamp: timestamp (time when message was sent)
  • lastMessage: object message

user_fcm_tokens

Each user token document is identified by the user's id

  • token : string (token associated)
  • createdAt : Timestamp (date/time at which the token was created)