Add system announcements interface

This commit is contained in:
garrettmills
2020-08-12 21:27:51 -05:00
parent 143fccf179
commit 1458e4126b
9 changed files with 270 additions and 4 deletions

View File

@@ -24,10 +24,6 @@ class ClientModel extends Model {
}
}
can(scope) {
return this.api_scopes.includes()
}
async application() {
const Application = this.models.get('Application')
return Application.findOne({ active: true, oauth_client_ids: this.id })

View File

@@ -0,0 +1,26 @@
const { Model } = require('flitter-orm')
class AnnouncementModel extends Model {
static get schema() {
return {
title: String,
message: String,
user_ids: [String],
group_ids: [String],
type: String, // login | email | banner
}
}
async to_api() {
return {
id: this.id,
title: this.title,
message: this.message,
user_ids: this.user_ids,
group_ids: this.group_ids,
type: this.type,
}
}
}
module.exports = exports = AnnouncementModel