Skip to content

Commit

Permalink
Added date to all objects in schema #217
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardLitt committed Jul 15, 2015
1 parent 437a40e commit 23496aa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
19 changes: 16 additions & 3 deletions js/data/schema.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/*globals emit, localStorage */

var crypto = require('crypto')
var validator = require('validator')
var _ = require('lodash')
// var validator = require('validator')
// var _ = require('lodash')
var galapagos = require('../utilities/galapagos.js')
var moment = require('moment')

var PouchDBUrl = require('../env.js').PouchDBUrl
// var BeagleProxyAPI = 'http://localhost:5000'
Expand Down Expand Up @@ -48,6 +49,7 @@ module.exports.account = exports.account = {
'name': 'Richard Feynman',
'avatar': 'http://upload.wikimedia.org/wikipedia/en/4/42/Richard_Feynman_Nobel.jpg',
'primaryEmail': '[email protected]',
'created': moment(),
'emails': [
'[email protected]',
'[email protected]'
Expand Down Expand Up @@ -79,6 +81,7 @@ module.exports.user = exports.user = {
module.exports.group = exports.group = {
'_id': 'hash5678',
'author': 'hash1234',
'created': moment(),
'members': {
'hash1234': 'share',
'sdfasdfa': 'read'
Expand All @@ -99,6 +102,7 @@ module.exports.group = exports.group = {
module.exports.conversation = exports.conversation = {
'_id': '1234hash',
'title': "Surely you're joking!",
'created': moment(),
'author': [
'hash1234'
],
Expand Down Expand Up @@ -153,6 +157,7 @@ module.exports.mediaTypes = exports.mediaTypes = [
module.exports.mediaObject = exports.mediaObject = {
'title': 'Boy with apple',
'type': 'image',
'created': moment(),
'authors': ['Johannes Van Hoyt The Younger', 'Pliny the Elder'], // ID?
'sourceURL': 'http://www.mrtaylor.co.uk/static/images/appleboy_c.jpg',
'metadata': {
Expand All @@ -165,6 +170,7 @@ module.exports.mediaImage = exports.image = exports.mediaObject
module.exports.mediaPublication = exports.publication = {
'title': 'A Structure for Deoxyribose Nucleic Acid',
'type': 'publication',
'created': moment(),
'authors': ['Francis Crick', 'James Watson'],
'sourceURL': 'http://www.nature.com/nature/dna50/watsoncrick.pdf',
'metadata': {
Expand All @@ -185,6 +191,7 @@ module.exports.mediaPublication = exports.publication = {

module.exports.note = exports.note = {
'_id': 'hash4567',
'created': moment(),
'text': 'Ever since I was little, I have always loved the sound of my own voice.',
'author': [
'Richard Feynman'
Expand All @@ -203,7 +210,8 @@ module.exports.note = exports.note = {
module.exports.annotation = exports.annotation = {
'_id': 'ranodmhash',
'source': 'asdfjlw',
'author': 'lksdjfsl'
'author': 'lksdjfsl',
'created': moment()
}

// Type of permission. (this could be an int but may be )
Expand Down Expand Up @@ -286,6 +294,7 @@ function LinkObject (oauthInfo) {
this._id = newID()
this.type = 'LINK'
this.email = oauthInfo.email
this.created = moment(),
this.oauthTokens = [
oauthInfo.token
]
Expand Down Expand Up @@ -503,6 +512,7 @@ module.exports.newConversation = exports.newConversation = function newConversat
var conversation = {
'_id': newID(),
'title': options.title,
'created': moment(),
'author': options.author.id || options.author.userId
}

Expand Down Expand Up @@ -548,6 +558,7 @@ module.exports.newNote = exports.newNote = function newNote (options, cb) {
'text': options.text,
'author': options.author.id,
'conversation': options.conversation.id,
'created': moment(),
'participants': {
'hash1234': 'share',
'sdlkjfla': 'read'
Expand Down Expand Up @@ -624,6 +635,7 @@ module.exports.startBlankConversation = exports.startBlankConversation = functio
var conversation = {
author: options.author,
title: options.title,
created: moment(),
participants: (options.participants) ? options.participants : {
[options.author.id]: 'share'
}
Expand All @@ -641,6 +653,7 @@ module.exports.startBlankConversation = exports.startBlankConversation = functio
author: options.author,
conversation: conversation,
text: options.text,
created: moment(),
participants: options.participants
}

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"level-browserify": "^0.19.1",
"lodash": "^3.8.0",
"minimist": "^1.1.1",
"moment": "^2.10.3",
"nodemailer": "^1.3.4",
"nodemailer-mailgun-transport": "^1.0.0",
"optional": "https://registry.npmjs.org/optional/-/optional-0.1.3.tgz",
Expand Down

0 comments on commit 23496aa

Please sign in to comment.