Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

The Schools database is provided to simplify the creation of new School Organisations on the Voluntarily Platform. When a new School Ambassador is invited onto the platform Invite someone to setup a new Organisation They can pick the school from a drop down list. The data for this list is provided by an API call `api/schools` which in turn is provided by a database collection `schoollookups`

The schema for this collection is

const schoolLookUpSchema = new Schema({
  schoolId: { type: Number, required: true },
  name: { type: String },
  telephone: { type: String },
  emailDomain: { type: String, required: true },
  contactName: { type: String },
  contactEmail: { type: String },
  website: String,
  address: String,
  schoolType: {
    type: String,
    enum: Object.values(SCHOOL_TYPES),
    required: true
  },
  decile: Number
})

Instructions

If the dropdown of schools has no data, or the collection needs to be refreshed with new data then an admin must run a command line script to update the collection from an external NZ schools database API.

For Developers

node --http-parser=legacy x/db/import-schools.js 

For Production Cloud Servers

set MONGODB_URI environment variable to the selected database.

e.g

`MONGODB_URI=mongodb+srv://vly-client:XXXXXXXXXXXXXX@cluster0-kwmsu.mongodb.net/vly2-alpha?retryWrites=true`

and then run

node --http-parser=legacy x/db/import-schools.js 

Output is

Inserted 82 schools
Inserted 176 schools
Inserted 266 schools
Inserted 357 schools
Inserted 454 schools
Inserted 545 schools
Inserted 634 schools
Inserted 724 schools
Inserted 813 schools
Inserted 906 schools
Inserted 997 schools
Inserted 1088 schools
Inserted 1183 schools
Inserted 1274 schools
Inserted 1365 schools
Inserted 1453 schools
Inserted 1536 schools
Inserted 1631 schools
Inserted 1724 schools
Inserted 1817 schools
Inserted 1900 schools
Inserted 1983 schools
Inserted 2069 schools
Inserted 2159 schools
Inserted 2250 schools
Inserted 2302 schools
Done

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.