-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into bot-insensitive-validation
- Loading branch information
Showing
7 changed files
with
582 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* Copyright (c) 2017, salesforce.com, inc. | ||
* All rights reserved. | ||
* Licensed under the BSD 3-Clause license. | ||
* For full license text, see LICENSE.txt file in the repo root or | ||
* https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
|
||
/** | ||
* api/v1/controllers/events.js | ||
*/ | ||
'use strict'; | ||
|
||
const helper = require('../helpers/nouns/events'); | ||
const doFind = require('../helpers/verbs/doFind'); | ||
const doGet = require('../helpers/verbs/doGet'); | ||
const doPost = require('../helpers/verbs/doPost'); | ||
|
||
module.exports = { | ||
|
||
/** | ||
* GET /events | ||
* | ||
* Finds zero or more events and sends them back in the response. | ||
* | ||
* @param {IncomingMessage} req - The request object | ||
* @param {ServerResponse} res - The response object | ||
* @param {Function} next - The next middleware function in the stack | ||
*/ | ||
findEvents(req, res, next) { | ||
doFind(req, res, next, helper); | ||
}, | ||
|
||
/** | ||
* GET /events/{key} | ||
* | ||
* Retrieves the event and sends it back in the response. | ||
* | ||
* @param {IncomingMessage} req - The request object | ||
* @param {ServerResponse} res - The response object | ||
* @param {Function} next - The next middleware function in the stack | ||
*/ | ||
getEvent(req, res, next) { | ||
doGet(req, res, next, helper); | ||
}, | ||
|
||
/** | ||
* POST /events | ||
* | ||
* Creates a new event and sends it back in the response. | ||
* | ||
* @param {IncomingMessage} req - The request object | ||
* @param {ServerResponse} res - The response object | ||
* @param {Function} next - The next middleware function in the stack | ||
*/ | ||
postEvents(req, res, next) { | ||
doPost(req, res, next, helper); | ||
}, | ||
|
||
}; // exports |
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,25 @@ | ||
/** | ||
* Copyright (c) 2017, salesforce.com, inc. | ||
* All rights reserved. | ||
* Licensed under the BSD 3-Clause license. | ||
* For full license text, see LICENSE.txt file in the repo root or | ||
* https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
|
||
/** | ||
* api/v1/helpers/nouns/events.js | ||
*/ | ||
|
||
const Events = require('../../../../db/index').Event; | ||
|
||
const m = 'Events'; | ||
|
||
module.exports = { | ||
apiLinks: { | ||
GET: `Retrieve ${m}`, | ||
POST: `Create a new ${m}`, | ||
}, | ||
baseUrl: '/v1/events', | ||
model: Events, | ||
modelName: 'events', | ||
}; // exports |
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
Oops, something went wrong.