-
Notifications
You must be signed in to change notification settings - Fork 9
Database
Andrew Smith edited this page Feb 1, 2015
·
10 revisions
The database is implemented with Mongoose.
It has the following collections:
- User
- Screenshot
The user collection has the following key-value pairs:
-
username(String, required) -
password(String, required) --> Hashed password with bcrypt -
images(Array) --> Array of screenshots ids that belong to that user. Ex: [23,43,12,4] -
galleries(Array) --> Array of objects where the key is the name of the gallery and the value is an array of screenshot ids that belong to that gallery. Ex [{TravelPictures: [1,2,3]}, {OtherGallery: [10,21]}] -
createdAt(Date)
The screenshot collection has the following key-value pairs:
-
url(String, required) --> Ex: "http://www.google.com" -
originalImage(String, required) --> Url of screenshot image without the notes. Ex: http://res.cloudinary.com/detd3ybi4/image/upload/v1422570180/bwiwsfpoldbdes5ruw5x.png -
annotatedImage(String, required) --> Url of notes image made above the screenshot without the original screenshot as the background. -
originalImageId(String) --> Thepublic_idproperty of the file on Cloudinary -
username(ObjectId, required) --> Id of user that took the screenshot -
visits(Number) --> Number of visits to that screenshot -
access(String) --> Only possible values are public or private -
createdAt(Date)
The images are stored on Cloudinary
The database is seeding for development environments. Seed data is stored in server/config/seed.js. Currently, it loads 2 sample users and 15 sample screenshots. The screenshots reference extant Cloudinary files.
Seeding the database is called from express.js.
Configuration for which environments will use seeding can be set in the /server/config/environment files. Done by setting seedDB property to equal true.