Created
July 29, 2017 17:48
-
-
Save michael-mckenna/b8142c5d39be7394c3df93d529dc8d92 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const moment = require('moment'); | |
const Realm = require('realm'); | |
// these two lines were copied and pasted from the email sent me after registering for the free trial | |
var token = "***"; | |
Realm.Sync.setAccessToken(token); | |
// TODO: make this admin key an environmental variable | |
const adminUser = Realm.Sync.User.adminUser('**'); | |
const AppointmentSchema = { | |
name: 'Appointment', | |
primaryKey: 'id', | |
properties: { | |
id: 'string', | |
phoneNumber: 'string', | |
message: 'string', | |
time: {type: 'date', indexed: true} | |
} | |
}; | |
// Appointment schema | |
class Appointment { | |
static sendNotifications() { | |
// set up realm. ********** IF USING THE REALM-JS LIB AND NOT realm-professional.tgz, IT FAILS HERE ************** | |
let appointmentRealm = new Realm({ | |
sync: { | |
user: adminUser, | |
url: "realm://***/appointments" | |
}, | |
schema: [AppointmentSchema] | |
}); | |
// ...more irrelevant code below.... | |
} | |
} | |
Appointment.schema = AppointmentSchema; | |
module.exports = Appointment; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment