-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
102 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
'use strict'; | ||
|
||
|
||
/** | ||
* @module Campaign | ||
* @name Campaign | ||
* @description A representation of communication intended by the source(sender) | ||
* for consumption by some recipient(receiver) or group of recipients(receivers). | ||
* | ||
* A campaign may be delivered by various means(transports or channels) | ||
* including email, sms, push notification etc. | ||
* | ||
* @see {@link https://en.wikipedia.org/wiki/Campaign} | ||
* @see {@link https://en.wikipedia.org/wiki/Advertising_campaign} | ||
* @author lally elias <lallyelias87@gmail.com> | ||
* @license MIT | ||
* @version 0.1.0 | ||
* @since 0.9.0 | ||
* @public | ||
*/ | ||
|
||
|
||
const { getString } = require('@lykmapipo/env'); | ||
const { model, Schema, SCHEMA_OPTIONS } = require('@lykmapipo/mongoose-common'); | ||
const actions = require('mongoose-rest-actions'); | ||
|
||
|
||
/* constants */ | ||
const MODEL_NAME = getString('CAMPAIGN_MODEL_NAME', 'Campaign'); | ||
|
||
|
||
const FORM_ALERT = 'Alert'; | ||
const FORM_INFORMATION = 'Information'; | ||
const FORM_WARNING = 'Warning'; | ||
const FORM_ANNOUNCEMENT = 'Announcement'; | ||
const FORM_REMINDER = 'Reminder'; | ||
const FORMS = [ | ||
FORM_ALERT, FORM_INFORMATION, FORM_WARNING, | ||
FORM_ANNOUNCEMENT, FORM_REMINDER | ||
]; | ||
|
||
|
||
/** | ||
* @name CampaignSchema | ||
* @type {Schema} | ||
* @author lally elias <lallyelias87@gmail.com> | ||
* @since 0.1.0 | ||
* @version 0.1.0 | ||
* @private | ||
*/ | ||
const CampaignSchema = new Schema({ | ||
|
||
}, SCHEMA_OPTIONS); | ||
|
||
|
||
/* | ||
*------------------------------------------------------------------------------ | ||
* Statics | ||
*------------------------------------------------------------------------------ | ||
*/ | ||
|
||
|
||
CampaignSchema.statics.MODEL_NAME = MODEL_NAME; | ||
|
||
|
||
CampaignSchema.statics.FORM_ALERT = FORM_ALERT; | ||
CampaignSchema.statics.FORM_INFORMATION = FORM_INFORMATION; | ||
CampaignSchema.statics.FORM_WARNING = FORM_WARNING; | ||
CampaignSchema.statics.FORM_ANNOUNCEMENT = FORM_ANNOUNCEMENT; | ||
CampaignSchema.statics.FORM_REMINDER = FORM_REMINDER; | ||
CampaignSchema.statics.FORMS = FORMS; | ||
|
||
|
||
/* | ||
*------------------------------------------------------------------------------ | ||
* Plugins | ||
*------------------------------------------------------------------------------ | ||
*/ | ||
CampaignSchema.plugin(actions); | ||
|
||
|
||
/* export campaign model */ | ||
module.exports = exports = model(MODEL_NAME, CampaignSchema); |
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,11 @@ | ||
'use strict'; | ||
|
||
|
||
/* dependencies */ | ||
const path = require('path'); | ||
const { expect } = require('@lykmapipo/mongoose-test-helpers'); | ||
const { Campaign } = require(path.join(__dirname, '..', '..')); | ||
|
||
describe('Campaign Schema', () => { | ||
expect(Campaign).to.exist; | ||
}); |