-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use handlebars custom helper to trigger notifyChannel
- Loading branch information
Showing
5 changed files
with
423 additions
and
109 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,40 @@ | ||
import { ObjectId } from 'mongodb'; | ||
import mongoose, { Schema } from 'mongoose'; | ||
|
||
export enum WebhookService { | ||
Slack = 'slack', | ||
} | ||
|
||
export interface IWebhook { | ||
_id: ObjectId; | ||
createdAt: Date; | ||
name: string; | ||
service: string; | ||
service: WebhookService; | ||
team: ObjectId; | ||
updatedAt: Date; | ||
url: string; | ||
} | ||
|
||
export default mongoose.model<IWebhook>( | ||
'Webhook', | ||
new Schema<IWebhook>( | ||
{ | ||
team: { type: Schema.Types.ObjectId, ref: 'Team' }, | ||
service: String, | ||
name: String, | ||
url: String, | ||
const WebhookSchema = new Schema<IWebhook>( | ||
{ | ||
team: { type: Schema.Types.ObjectId, ref: 'Team' }, | ||
service: { | ||
type: String, | ||
enum: Object.values(WebhookService), | ||
required: true, | ||
}, | ||
name: { | ||
type: String, | ||
required: true, | ||
}, | ||
{ timestamps: true }, | ||
), | ||
url: { | ||
type: String, | ||
required: false, | ||
}, | ||
}, | ||
{ timestamps: true }, | ||
); | ||
|
||
WebhookSchema.index({ team: 1, service: 1, name: 1 }, { unique: true }); | ||
|
||
export default mongoose.model<IWebhook>('Webhook', WebhookSchema); |
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
Oops, something went wrong.