Created
May 3, 2020 18:20
-
-
Save acomito/b23af4a8d5ed0777d27d37b088815460 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const schema = new Mongo.Schema({ | |
...baseFields, // baseFields includes createdAt, createdBy, updatedAt, updatedBy | |
id: String, | |
title: String, // "Task Created" | |
description: String, // "Anthony created a task for Jessica" | |
activityType: { | |
// list of all possible types | |
type: String, | |
enum: [ | |
'noteAdded', // when somebody adds a note | |
'projectActivity', // general catchall for when a project is created/updated | |
'attachmentAdded', // when an attachment is added to something (project, business profile, contact profile, etc) | |
'taskAdded', // when somebody adds a task to something (project, business profile, contact profile, etc) | |
], | |
}, | |
parent: { | |
type: String, | |
enum: ['business', 'contact', 'project'], // different modules in the app have activity feeds... they're similar enough to all use this same collection | |
}, | |
parentId: String, // the mongo ID of the business profile, project or contact this activity item relates to... used to query the activity feed | |
sourceId: String, // id of the mongodb document related to this | |
sourceType: String, // collection name of the source... Tasks, Attachments, Notes, etc... sourceId+sourceType helps you find the relevant record for linking etc | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment