Skip to content

Firebase Structure

Chris Schmitz edited this page Nov 4, 2018 · 2 revisions

Below are the major structures which should be contained in Firebase. All key names use camel case, starting with a lowercase letter. Types are listed in camel case, starting with an uppercase letter. There is also a shorthand for lists of a specific item type with IDs as keys: ById. When square brackets ([]) are used they indicate an array of the specified values. When curly braces ({}) are used they indicate a collecton of key-value pairs. When ellipses are used they indicate repeating the preceding pattern.

Firebase Structure:

  ctrees: {CTreesById},
  users: {UsersById}

CTree Structure:

name: String,
types: {TypesById},
segmentTypes: {SegmentTypesById},
elements: {ElementsById},
descriptions: {
  forElement: {
    ElementId: {DescriptionConfigsById},
    ...
  }
}
segmentVariations: {
  forSegment: {
    SegmentId: {SegmentVariationsById},
    ...
  }
}
feedback: {
  forDescription: {
    DescriptionConfigId: {FeedbackById},
    ...
  },
  forSegment: {
    SegmentVariationId: {FeedbackById},
    ...
  },
  forFeedback: {
    FeedbackId: {FeedbackById},
    ...
  }
}
userData: {CTreeUserDataById}
admins: {
  UserId: Boolean,
  ...
}

Type Structure:

name: String,
description: String,
iconUrl: String,
color: String,
parentsRequired: Boolean,
parentsMax: Number,
parentTypes: {
  TypeId: Boolean,
  ...
},

Segment Type Structure:

componentName: String,
canBeThumbnail: Boolean

Element Structure:

type: ElementTypeId,
title: String,
children: {
  ElementId: {
    rating: Number
  },
  ...
},
designer: UserId,
contributors: {
  UserId: {
    contributions: Number
  },
  ...
},
feedback: {
  FeedbackId: {
    reviewer: UserId,
    text: String,
  },
  ...
}

Description Config Structure:

segments: [SegmentIds]

Segment Structure:

type: SegmentTypeId

Segment Variation Structure:

data: dynamic // data type depends on segment types

Feedback Structure:

reviewer: UserId,
text: String,

User Structure:

public: {
  name: String,
  avatar: String
},
private: {
  // TODO: add more private user data
}

CTree User Data Structure:

public: {
  history: {
    UUID: {
      timestamp: Number // timestamp value
      element: ElementId,
      // TODO: add more info
    }
  }
}
private: {
  suggested: {
    ElementId: {
      reason: Number,
      priority: Number,
      descriptionId: Number,  // optional
      segmentVariationIds: {  // optional
        SegmentId: SegmentVariationId,
      }
    },
    ...
  },
  bookmarked: {
    ElementId: {
      updated: Number // timestamp value
    },
    ...
  }
}
Clone this wiki locally