-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJakefile.coffee
More file actions
84 lines (68 loc) · 1.84 KB
/
Jakefile.coffee
File metadata and controls
84 lines (68 loc) · 1.84 KB
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
connection = require "./server/config/connection"
model = require "./server/models/model"
connect = ->
connection.connect connection[process.env.NODE_ENV || "development"]
disconnect = ->
connection.disconnect()
desc "Seed datastore"
task "seed", [], (params) ->
connect()
Group = model "group"
User = model "user"
Person = model "person"
Photo = model "photo"
sys = new Group
name: "System"
code: "380800"
email: "system@perceptal.co.uk"
tel: "01896 830894"
sys.save()
demo = new Group
name: "Demo"
code: "999999"
email: "demo@perceptal.co.uk"
tel: "01896 830894"
parent: sys._id
demo.save()
root_user = new User
username: "root"
email: "root@perceptal.co.uk"
root_user.set_password "password"
root_user.save()
johnny_user = new User
username: "johnny"
email: "johnny@recipher.co.uk"
johnny_user.set_password "password"
johnny_user.save()
root = new Person
first_name: "System"
last_name: "Administrator"
email: "root@perceptal.co.uk"
user: root_user._id
group: sys._id
root.save()
johnny = new Person
first_name: "Johnny"
last_name: "Hall"
gender: "Male"
title: "Mr"
marital: "Married"
dob: "1971-05-14"
email: "johnny@recipher.co.uk"
tel: "07971 880871"
user: johnny_user._id
group: sys._id
johnny.save()
johnny_photo = new Photo
person: johnny._id
is_default: true
johnny_photo.put "./client/images/photos/bill.jpg", "bill.jpg"
johnny_photo.save(disconnect)
desc "Clean datastore"
task("clean", [], (params) ->
connect()
Group = model "group"
User = model "user"
Person = model "person"
Person.find({}).remove -> User.find({}).remove -> Group.find({}).remove disconnect
)