-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtweet.js
78 lines (71 loc) · 1.77 KB
/
tweet.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
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const mongoose = require('mongoose');
const locationSchema = new mongoose.Schema({
});
// can't have variable keys
// "rieti" : {
// "lat" : 42.404366,
// "long" : 12.868538
// }
// Resources: [{
// resource: String,
// quantity: String,
// }],
const tweetSchema = new mongoose.Schema({
_id: { // id for tweet
type: String,
unique: true,
required: true,
},
lang: String,
text: { // tweet text
type: String,
required: true,
},
Classification: { // Classification according to system
type: String,
enum: ['Need','Availability'],
},
isCompleted: { // only after status is full
type: Boolean,
default: false,
},
username: {
type: String,
default: '',
},
Matched: { // id of matched tweet
type: String,
default: '',
},
Locations: {}, // all possible detected locations
Sources: [{ // sources - names of people, NGO's, etc
type: String
}],
Resources: {}, // detected json of jsons - each json has resource and quantity
ResourceWords: {
type: Array,
default: [],
},
// to be used for status = 1, 2, 3, 4 => For verified, assigned, etc
// status: {
// type: Number,
// default: 0,
// },
Contact: { // straight forwarsd
Email: [{
type: String,
}],
"Phone number": [{
type: String,
}],
},
created: { // created time - used for matching
type: Date,
default: Date.now,
},
url: { // tweet url in case we want to reply to them
type: String,
default: ''
}
}, { collection: 'tweets'});
module.exports = exports = mongoose.model('Tweet', tweetSchema);