-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding some logging for messages sent. #29
- Loading branch information
1 parent
cffb819
commit 801eb35
Showing
3 changed files
with
65 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* This module provides a schema for the message log. Message logs are saved anytime a message is sent to a user by Slack. This is useful for tracking messages sent to users. | ||
*/ | ||
|
||
import mongoose from 'mongoose'; | ||
|
||
/** | ||
* Model for the message log. | ||
* @type {Model<any>} | ||
*/ | ||
export const MessageLog = mongoose.model( | ||
'MessageLog', | ||
new mongoose.Schema({ | ||
timestamp: { | ||
type: Date, | ||
default: Date.now, | ||
}, | ||
target: { | ||
type: { | ||
type: String, | ||
enum: ['project', 'sig', 'people'], | ||
required: true, | ||
}, | ||
projectName: { type: String, required: false, default: '' }, | ||
sigName: { type: String, required: false, default: '' }, | ||
people: [{ type: String, required: false, default: '' }], | ||
}, | ||
message: { | ||
type: String, | ||
required: true, | ||
}, | ||
error: { | ||
type: String, | ||
required: false, | ||
default: '', | ||
}, | ||
}) | ||
); |