5 changed files with 201 additions and 163 deletions
@ -0,0 +1,53 @@ |
|||
// kaleidoscope-event.js
|
|||
// Copyright (C) 2022 DTP Technologies, LLC
|
|||
// License: Apache-2.0
|
|||
|
|||
'use strict'; |
|||
|
|||
const mongoose = require('mongoose'); |
|||
const Schema = mongoose.Schema; |
|||
|
|||
const KaleidoscopeEventSchema = new Schema({ |
|||
created: { type: Date, default: Date.now, required: true, index: -1, expires: '30d' }, |
|||
action: { type: String, required: true, lowercase: true }, |
|||
label: { type: String }, |
|||
content: { type: String }, |
|||
href: { type: String }, |
|||
source: { |
|||
pkg: { |
|||
name: { type: String, required: true }, |
|||
version: { type: String, required: true }, |
|||
}, |
|||
site: { |
|||
name: { type: String, required: true }, |
|||
description: { type: String }, |
|||
domain: { type: String, lowercase: true, required: true }, |
|||
domainKey: { type: String, lowercase: true, required: true }, |
|||
company: { type: String }, |
|||
coreAuth: { |
|||
scopes: { type: [String] }, |
|||
}, |
|||
}, |
|||
author: { |
|||
userId: { type: Schema.ObjectId, required: true }, |
|||
displayName: { type: String }, |
|||
username: { type: String }, |
|||
href: { type: String }, |
|||
}, |
|||
}, |
|||
attachmentType: { type: String }, |
|||
attachment: { type: Schema.ObjectId, refPath: 'attachmentType' }, |
|||
}); |
|||
|
|||
/* |
|||
* Compound index for site.domainKey, author.userId for when local members |
|||
* subscribe to a specific author on a domain, or the whole domain. |
|||
*/ |
|||
KaleidoscopeEventSchema.index({ |
|||
'source.site.domainKey': 1, |
|||
'source.author.userId': 1, |
|||
}, { |
|||
name: 'evtsrc_site_author_index', |
|||
}); |
|||
|
|||
module.exports = mongoose.model('KaleidoscopeEvent', KaleidoscopeEventSchema); |
@ -1,5 +1,5 @@ |
|||
mixin renderUserNotification (userNotification) |
|||
div |
|||
div= moment(userNotification.created).fromNow() |
|||
div= userNotification.source |
|||
div= userNotification.message |
|||
div= userNotification.event.source |
|||
div= userNotification.event.message |
Loading…
Reference in new issue