mirror of
https://github.com/wekan/wekan.git
synced 2025-04-20 12:07:11 -04:00
Add integrations model
This commit is contained in:
parent
24290b66a3
commit
bcd42ad958
1 changed files with 54 additions and 0 deletions
54
models/integrations.js
Normal file
54
models/integrations.js
Normal file
|
@ -0,0 +1,54 @@
|
|||
Integrations = new Mongo.Collection('integrations');
|
||||
|
||||
Integrations.attachSchema(new SimpleSchema({
|
||||
enabled: {
|
||||
type: Boolean,
|
||||
defaultValue: true,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
},
|
||||
url: { // URL validation regex (https://mathiasbynens.be/demo/url-regex)
|
||||
type: String,
|
||||
},
|
||||
token: {
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
boardId: {
|
||||
type: String,
|
||||
},
|
||||
createdAt: {
|
||||
type: Date,
|
||||
denyUpdate: false,
|
||||
autoValue() { // eslint-disable-line consistent-return
|
||||
if (this.isInsert) {
|
||||
return new Date();
|
||||
} else {
|
||||
this.unset();
|
||||
}
|
||||
},
|
||||
},
|
||||
userId: {
|
||||
type: String,
|
||||
autoValue() { // eslint-disable-line consistent-return
|
||||
if (this.isInsert || this.isUpdate) {
|
||||
return this.userId;
|
||||
}
|
||||
},
|
||||
},
|
||||
}));
|
||||
|
||||
Integrations.allow({
|
||||
insert(userId, doc) {
|
||||
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
|
||||
},
|
||||
update(userId, doc) {
|
||||
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
|
||||
},
|
||||
fetch: ['boardId'],
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue