This repository has been archived by the owner on Jul 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reset_database.js
161 lines (148 loc) · 4.98 KB
/
reset_database.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
// to clear database, use mongo shell
// $ mongo
// > db.dropDatabase()
var mongoose = require('mongoose');
mongoose.connect(require('./config').db_url);
var Database = require('./models/database');
var Account = Database.Account;
var Participant = Database.Participant;
var Organizer = Database.Organizer;
var Event = Database.Event;
/* admin */
var admin = new Account({
email: '[email protected]',
password: 'adminadmin',
atype: 'admin'
});
admin.save()
/* participants */
// bob
var bob = new Account({
email: '[email protected]',
password: 'hellobob',
atype: 'participant'
});
var bob_info = new Participant({
email: '[email protected]',
name: 'Bob',
description: 'I am a little shy but I am happy to help people.',
account: bob._id
});
bob.save();
bob_info.save();
// kevin
var kevin = new Account({
email: '[email protected]',
password: 'hellokevin',
atype: 'participant'
});
var kevin_info = new Participant({
email: '[email protected]',
name: 'Kevin',
description: 'I am happy to help people!',
account: kevin._id
});
kevin.save();
kevin_info.save();
// stuart
var stuart = new Account({
email: '[email protected]',
password: 'hellostuart',
atype: 'participant'
});
var stuart_info = new Participant({
email: '[email protected]',
name: 'Stuart',
description: 'I am willing to help people.',
account: stuart._id
});
stuart.save();
stuart_info.save();
/* Organizers */
// Care Corner Family Service Center
var carecorner = new Account({
email: '[email protected]',
password: 'carecorner',
atype: 'organizer'
});
var carecorner_info = new Organizer({
email: '[email protected]',
name: 'Care Corner Family Service Center (Admiralty)',
phone: '63658751',
address: 'Blk 718 Woodlands Ave 6, #01-658 Singapore 730718',
account: carecorner._id
});
carecorner.save();
carecorner_info.save();
// Singapore Association for the Deaf
var sadeaf = new Account({
email: '[email protected]',
password: 'sadeaf',
atype: 'organizer'
});
var sadeaf_info = new Organizer({
email: '[email protected]',
name: 'Singapore Association for the Deaf',
address: '227 Mountbatten Road, Singapore 397998',
account: sadeaf._id
});
sadeaf.save();
sadeaf_info.save();
/* Events */
// CCFSC Counselling Service
var ccfsc_cs = new Event({
title: 'Single Family Support Program',
organizer: carecorner_info._id,
date: new Date('2016-01-12'),
vacancy: 15,
description: 'Circle of Care • Child Services is organizing a Single-Parent Program to promote the psycho-emotional wellbeing of single parent families towards stability, growth and acceptance of the new family unit. It is a half-day program to visit the homes of the single-parent families. \nVolunteers are needed to visit the families together with the staff of the service centre on the event day. \nCircle of Care • Child Services is one of the Family Service Centres in Singapore, concerned with the wellbeing of children in Singapore. Volunteers can gain experience of showing care for single families and helping to prepare for voluntary events. 15 families will be visited on event day.',
theme: 'Family',
address: {
name: 'WOODLANDS AVENUE 6',
x: 24595.8943,
y: 46796.9189
},
participants: [
bob_info._id
]
});
ccfsc_cs.save();
// Care Corner Special Day Care for Elderly
var cc_sdcfe = new Event({
title: 'Care Corner Special Day Care for Elderly',
organizer: carecorner_info._id,
date: new Date('2016-01-13'),
vacancy: 15,
description: 'Care Corner SDC supports the needs of busy families who are unable to care for their elderly family members while they are at work. Through a warm, caring and safe home-like environment, we keep our seniors mentally, physically and socially healthy. \nVolunteers are needed for to help caregivers to take care of the elderlies for a whole day, in the Day Care centre.',
phone: '62536979',
theme: 'Eldercare',
address: {
name: 'TOA PAYOH BRIDGE',
x: 31392.6616,
y: 34738.8717
},
participants: [
bob_info._id,
kevin_info._id
]
});
cc_sdcfe.save();
// SADeaf Flag Day
var sadeaf_fd = new Event({
title: 'SADeaf Flag Day',
organizer: sadeaf_info._id,
date: new Date('2015-12-3'),
description: 'SADeaf Flag Day is one of the major fundraising efforts for Singapore Association for the Deaf to support essential services for the Deaf and hard-of-hearing community. These include sign language interpretation service; note-taking; support for students with hearing loss; and audiology services. \nThe Singapore Association for the Deaf (SADeaf) facilitates communications of persons with hearing impairment with the community for educational, employment, legal and recreational purposes. SADeaf Community Services also provide counselling and case management to persons with hearing impairment via specialised mode of communication.',
theme: 'Disability',
address: {
name: 'SADEAF COMMUNITY SERVICES (VOLUNTARY WELFARE ORGS)',
x: 33167.0173,
y: 32244.0010
},
participants: [
bob_info._id,
stuart_info._id
]
});
sadeaf_fd.save();
console.log('Done populating to database. ');