-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmethods.coffee
53 lines (45 loc) · 1.02 KB
/
methods.coffee
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
Meteor.methods
createBro: ( name ) ->
return if name.length is 0
id = Bros.insert
name : name
ordered : false
typing : false
missingFood : false
log : []
owner : @userId
last : getToday()
return id
bindBro: ( id ) ->
Bros.update( id, { $set: { owner: @userId } } )
setOrder: ( meal ) ->
Bros.update { owner: @userId }, {
$set: {
ordered : meal.length > 0
meal : meal
last : getToday()
timestamp : ( new Date ).getTime()
typing : false
}
}
setTyping: ( typing ) ->
Bros.update { owner: @userId }, {
$set: {
typing: typing
}
}
toggleEating: ( missing ) ->
Bros.update { owner: @userId }, {
$set: {
missingFood : missing
last : getToday()
}
}
insertMeal: ( title ) ->
Menu.insert
title : title
updated : getToday()
###
wipeBro: ( id ) ->
Bros.remove id
###