-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema
62 lines (49 loc) · 1.72 KB
/
schema
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
var scriberSchema = new mongoose.Schema({
email: { type: String, unique: true, lowercase: true },
password: String,
id: {type: Number, unique: true},
projects: Array, // array of project IDs
rank: {type:Number, default:0},
contributor: {type:Boolean, default:false},
profile: {
name: { type: String, default: '' },
organization: { type: Number, default: '' },
gravatar: { type: String, default: '' },
bio: {type: String, default:''}
},
});
var orgSchema = new mongoose.Schema({
wesbite: { type: String, unique: true, lowercase: true },
id: {type:Number, unique:true},
profile: {
name: { type: String, default: '' },
gravatar: { type: String, default: '' },
members: Array, // array of user IDs
bio: {type: String, default:''}
},
});
var projectSchema = new mongoose.Schema({
owner: Number,
id: {type:Number, unique:true},
status: Number, // e.g. "pre-launch"/"active"/"embargoed"/"published"/"expired" = 0/1/2/3/4
profile: {
title: { type: String, default: '' },
gravatar: { type: String, default: '' }, // url of gravatar/image for the project
scribers: Array, // array of user IDs
description: {type: String, default:''},
documents: Array, // array of document IDs
sample: Number // document ID of sample document
},
schema: {
fields: [{field_id:Number, position:[Number, Number], width:Number, height:Number, datatype:String}]
}
});
var documentSchema = new mongoose.Schema({
project: Number, // project ID to which this document belongs
id: {type:Number, unique:true},
transcriptions: {
count: {type: Number, default:0}, // number of completed transcriptions on this document
values: [{field_id:Number, value:String}] //actual values entered
});
// possible index for projects
projects.createIndex( { "owner": 1, "status": 1 } )