-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBotPosts.js
More file actions
61 lines (52 loc) · 1.1 KB
/
Copy pathBotPosts.js
File metadata and controls
61 lines (52 loc) · 1.1 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
var keystone = require('keystone');
var Types = keystone.Field.Types;
/**
* User Model
* ==========
*/
var BotPosts = new keystone.List('BotPosts', {
defaultSort: 'done'
});
BotPosts.add({
reported: Boolean,
upvotedBy: { type: Types.Relationship, ref: 'BotSettings' },
url: {
type: String,
alias: 'memo'
},
trx_id: {type: String, unique: true },
memo: String,
permlink: String,
amount: String,
to: String,
from: String,
tries: { type: Number, default: 0 },
receivedRefund: {type: Boolean, default: false},
receivedUpvote: {type: Boolean, default: false},
doRefund: { type: Boolean, default: false },
done: {type: Boolean, default: false},
posted: {type: Boolean, default: false }
});
BotPosts.schema.loadClass(
class {
set startProcess (a) {
if (this.tries > 3) {
this.doRefund = true
}
}
set gotRefunded (a) {
this.receivedUpvote = true
this.done = true
}
set gotVoted (a) {
this.receivedUpvote = true
this.done = true
}
}
)
// Provide access to Keystone
/**
* Registration
*/
BotPosts.defaultColumns = 'username, lastUpvote';
BotPosts.register();