зеркало из https://github.com/mozilla/galaxy-api.git
Closes #318 - Fixed jslint errors.
This commit is contained in:
Родитель
ab88cad87e
Коммит
e8fedc6d7b
|
@ -1,4 +1,4 @@
|
|||
var Promise = require('es6-promise').Promise;
|
||||
'use strict';
|
||||
|
||||
var Game = require('../models/game');
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
var Promise = require('es6-promise').Promise;
|
||||
|
||||
var db = require('../../lib/db');
|
||||
var server = require('../../index.js');
|
||||
var utils = require('../../lib/utils');
|
||||
|
||||
|
||||
|
@ -66,7 +67,7 @@ Game.getPublicObj = function (row) {
|
|||
Game.objects = {};
|
||||
|
||||
|
||||
Game.objects.all = function (data) {
|
||||
Game.objects.all = function () {
|
||||
return new Promise(function (resolve, reject) {
|
||||
db.query('SELECT * FROM games WHERE deleted = false',
|
||||
function (err, result) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
var joi = require('joi');
|
||||
|
||||
var gameController = require('./controllers/game.js');
|
||||
|
@ -47,7 +49,8 @@ module.exports = function (server) {
|
|||
Sample usage:
|
||||
|
||||
curl -X POST 'http://localhost:4000/games' \
|
||||
-d '{"name": "mario bros", "game_url": "http://nintendo.com", "slug": "mario"}' \
|
||||
-d '{"name": "mario bros", "game_url": "http://nintendo.com", ' \
|
||||
'"slug": "mario"}' \
|
||||
-H 'Content-Type: application/json' -i
|
||||
|
||||
*/
|
||||
|
@ -91,13 +94,15 @@ module.exports = function (server) {
|
|||
// config: {
|
||||
// validate: {
|
||||
// params: {
|
||||
// // Game Slug cannot be all digits, all underscores, or all hyphens
|
||||
// // and must contain only letters, numbers, underscores, and hyphens.
|
||||
// // Game Slug cannot be all digits, all underscores, or all
|
||||
// // hyphens and must contain only letters, numbers, underscores,
|
||||
// // and hyphens.
|
||||
// // TODO: ID *or* slug is required; enforce.
|
||||
// idOrSlug: joi.number().integer().example('9'),
|
||||
|
||||
// // Game Slug cannot be all digits, all underscores, or all hyphens
|
||||
// // and must contain only letters, numbers, underscores, and hyphens.
|
||||
// // Game Slug cannot be all digits, all underscores, or all
|
||||
// // hyphens and must contain only letters, numbers, underscores,
|
||||
// // and hyphens.
|
||||
// // TODO: ID *or* slug is required; enforce.
|
||||
// idOrSlug: joi.string().regex(/^(?!\d*$)(?!_*$)(?!-*$)[\w-]+$/)
|
||||
// .example('mario-bros')
|
||||
|
@ -129,13 +134,16 @@ module.exports = function (server) {
|
|||
Sample usage:
|
||||
|
||||
curl -X PUT 'http://localhost:4000/games/1' \
|
||||
-d '{"name": "mario bros", "game_url": "http://nintendo.com", "slug": "mario"}' \
|
||||
-d '{"name": "mario bros", "game_url": "http://nintendo.com", ' \
|
||||
'"slug": "mario"}' \
|
||||
-H 'Content-Type: application/json' -i
|
||||
curl -X PUT 'http://localhost:4000/games/mario' \
|
||||
-d '{"name": "mario bros", "game_url": "http://nintendo.com", "slug": "mario"}' \
|
||||
-d '{"name": "mario bros", "game_url": "http://nintendo.com", ' \
|
||||
'"slug": "mario"}' \
|
||||
-H 'Content-Type: application/json' -i
|
||||
curl -X PUT 'http://localhost:4000/games/wario' \
|
||||
-d '{"name": "wario bros", "game_url": "http://wintendo.com", "slug": "wario"}' \
|
||||
-d '{"name": "wario bros", "game_url": "http://wintendo.com", ' \
|
||||
'"slug": "wario"}' \
|
||||
-H 'Content-Type: application/json' -i
|
||||
|
||||
*/
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
var exec = require('child_process').exec;
|
||||
'use strict';
|
||||
|
||||
var argv = require('yargs').argv; // Using instead of deprecated `gulp.env`.
|
||||
var inquirer = require('inquirer');
|
||||
var Promise = require('es6-promise').Promise;
|
||||
var stylish = require('jshint-stylish');
|
||||
|
||||
var gulp = require('gulp');
|
||||
|
@ -22,6 +21,7 @@ var internals = {
|
|||
scripts: [
|
||||
'**/*.js',
|
||||
'!./node_modules/**/*.js',
|
||||
'!./migrations/*.js',
|
||||
]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
var Joi = require('joi');
|
||||
var pg = require('pg');
|
||||
|
||||
|
@ -25,7 +26,7 @@ internals._requireConnection = function (func) {
|
|||
|
||||
exports.connect = function (connectionString) {
|
||||
Joi.string().regex(/(postgres|tcp):\/\/(.+)\/(.+)/).required()
|
||||
.validate(connectionString, function (err, data) {
|
||||
.validate(connectionString, function (err) {
|
||||
|
||||
if (err) {
|
||||
throw err;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = {};
|
||||
|
||||
[
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
var Boom = require('boom');
|
||||
var Promise = require('es6-promise').Promise;
|
||||
|
||||
|
|
|
@ -24,5 +24,7 @@ exports.POSTGRES_URL = 'postgres://localhost/galaxy-api';
|
|||
exports.SECRET = 'a secret string';
|
||||
|
||||
for (var k in settings_local) {
|
||||
exports[k] = settings_local[k];
|
||||
if (settings_local.hasOwnProperty(k)) {
|
||||
exports[k] = settings_local[k];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
var Lab = require('lab');
|
||||
var Code = require('code');
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
var Lab = require('lab');
|
||||
var Code = require('code');
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче