Database Schema - tais-yakimovich/nadatrace-app GitHub Wiki
Purpose
This section outlines the structure of the Firestore collections used in the Nadatrace App. The schemas are represented using JSON Schema format and describe the required structure, types, and validation rules for each document in the database.
Collection users
- Purpose: This collection contains the documents that represent the user information for their account. Each document represents a single user.
- Document ID: This is the uid generated automatically to represent this document.
- Document structure: Each document in the Users collection represents an individual user and contains fields that describe their profile and interactions in the app. A user document is structured as follows:
{
"created_time": "March 31, 2025 at 7:23:31 PM UTC-4",
"display_name": "example name",
"email": "[email protected]",
"photo_url": "image path",
"uid": "example UID",
"bday": "March 31, 2001",
"address": "1 Main Street, Kingston, RI"
}
Collection nps_response
- Purpose: This collection contains the documents that represent the user information for their feedback. Each document represents a single user's feedback.
- Document ID: This is the uid generated automatically to represent this document.
- Document structure: Each document in the nps_response collection represents an individual user's response and contains fields that describe their ratings for the app. A user document is structured as follows:
{
"rating": "8 😊",
"responseText": "Best app ever!",
"userid": "/users/User123"
}
JSON Schema
This section displays the JSON schema of the documents within the Firestore following the 305Soft standard JSON schema format.
Users:
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://nadatrace.app/schemas/users.json", "title": "User Document", "type": "object", "properties": { "birthdate": { "type": "string", "format": "date-time", "description": "User's birthdate as a Firestore timestamp" }, "created_time": { "type": "string", "format": "date-time", "description": "Account creation time" }, "display_name": { "type": "string", "description": "Name displayed in the app" }, "email": { "type": "string", "format": "email", "description": "User's email address" }, "photo_url": { "type": "string", "format": "uri", "description": "URL of the user's profile picture" }, "uid": { "type": "string", "description": "Unique Firebase user ID" } }, "required": ["birthdate", "created_time", "display_name", "email", "photo_url", "uid"] }
nps-response:
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://nadatrace.app/schemas/nps-response.json", "title": "NPS Response Document", "type": "object", "properties": { "uid": { "type": "string", "pattern": "^/users/[A-Za-z0-9_-]+$", "description": "Reference path to the user document" }, "rating": { "type": "string", "description": "NPS score, possibly with emoji" }, "responseText": { "type": "string", "description": "User's free-form response" } }, "required": ["uid", "rating", "responseText"] }