-
Notifications
You must be signed in to change notification settings - Fork 0
/
Profiles.js
33 lines (31 loc) · 1.17 KB
/
Profiles.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { Mongo } from 'meteor/mongo';
import SimpleSchema from 'simpl-schema';
import { Tracker } from 'meteor/tracker';
/** Encapsulates state and variable values for this collection. */
class ProfilesCollection {
constructor() {
// The name of this collection.
this.name = 'ProfilesCollection';
// Define the Mongo collection.
this.collection = new Mongo.Collection(this.name);
// Define the structure of each document in the collection.
this.schema = new SimpleSchema({
username: String,
firstName: String,
lastName: String,
imageURL: String,
sport: String,
age: Number, // MILESTONE 3, keep track of birthday!
height: String,
weight: String,
graduation: String,
major: String,
}, { tracker: Tracker });
// Attach the schema to the collection, so all attempts to insert a document are checked against schema.
this.collection.attachSchema(this.schema);
// Define names for publications and subscriptions
this.userPublicationName = `${this.name}.publication.user`;
this.adminPublicationName = `${this.name}.publication.admin`;
}
}
export const Profiles = new ProfilesCollection();