Schema setup Firestore

Set up Firestore 

In order to have the posibilities of adding complete elements, let's say add new events, with all fields and collections inside, we will need to have the "Schema" definied so the admin panel to understand to how the new elements and collections should look. When you define your schema, your will see a "+" button on top of each table, allowing you to insert new collections and documents.

The schema for Firestore should be defined in "src/config/firestoreschema.json".

Let'm make Firestore simple. Firstore consists of Collection and documents.

STEP 1. write all your collections ex, no need to nest them

var collectionMeta={
    "events":{},
    "tickets":{}
}

STEP 2. add the "collections" element in each of them. Example each event's document has collection of ticketes. And tickets doesn't have any collection so just use empty array

var collectionMeta={
    "events":{
        "collections":["tickets"],
    },
    "tickets":{
        "collections":[],
    }
}

STEP 3. describe each collection documents by adding the "fields" element ex.

var collectionMeta={
    "events":{
        "fields":{
            "name":"My Event name"
        },
        "collections":["tickets"],
    },
    "tickets":{
        "fields":{
            "price":"300",
            "name":"My ticket name"
        },
        "collections":[],
    }
}