# All files / src/model contactGroups.coffee

100% Statements 6/6
100% Branches 0/0
100% Functions 0/0
100% Lines 6/6

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    161x
    1x
    1x
    1x

    1x

    1x
     mongoose = require "mongoose"
    server = require "../server"
    connectionDefault = server.connectionDefault
    Schema = mongoose.Schema

    exports.ContactUserDef = ContactUserDef =
      "user":       type: String, required: true
      "method":     type: String, required: true, enum: ["email", "sms" ]
      "maxAlerts":  type: String, enum: ["no max", "1 per hour", "1 per day" ], default: "no max"

    ContactGroupSchema = new Schema
      "group":      type: String, required: true, unique: true
      "users":      [ContactUserDef]

    exports.ContactGroup = connectionDefault.model 'ContactGroup', ContactGroupSchema