Skip to content

Commit

Permalink
s/name/boardName/ and s/description/boarDesc
Browse files Browse the repository at this point in the history
For consistency
  • Loading branch information
dropofwill committed Apr 13, 2016
1 parent f53ed6c commit fd60fd3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions api/controllers/v1/boards/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { create as createBoard } from '../../../services/BoardService';
import { anyAreNil } from '../../../helpers/utils';

export default function create(req, res) {
const { userToken, name, description } = req.body;
const { userToken, boardName, boardDesc } = req.body;
const required = { userToken };

if (anyAreNil(values(required))) {
Expand All @@ -19,7 +19,7 @@ export default function create(req, res) {

return verifyAndGetId(userToken)
.then((userId) => {
return createBoard(userId, name, description)
return createBoard(userId, boardName, boardDesc)
.then((boardId) => res.created({boardId: boardId}))
.catch((err) => res.serverError(err));
});
Expand Down
6 changes: 3 additions & 3 deletions api/models/Board.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import IdeaCollection from './IdeaCollection.js';
import Idea from './Idea.js';
import Result from './Result';

const adminEditables = ['isPublic', 'name', 'description',
const adminEditables = ['isPublic', 'boardName', 'boardDesc',
'userColorsEnabled', 'numResultsShown',
'numResultsReturn'];

Expand All @@ -25,12 +25,12 @@ const schema = new mongoose.Schema({
adminEditable: false,
},

name: {
boardName: {
type: String,
trim: true,
},

description: {
boardDesc: {
type: String,
trim: true,
},
Expand Down
13 changes: 6 additions & 7 deletions api/services/BoardService.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ const self = {};
* Create a board in the database
* @returns {Promise<String|Error>} the created boards boardId
*/
self.create = function(userId, name, description) {
self.create = function(userId, name, desc) {
const boardName = emptyDefaultTo('Project Title', name);
const boardDesc = emptyDefaultTo('This is a description.', description);
const boardDesc = emptyDefaultTo('This is a description.', desc);

return new Board({users: [userId], admins: [userId],
name: boardName, description: boardDesc})
return new Board({users: [userId], admins: [userId], boardName, boardDesc})
.save()
.then((result) => {
return createIdeasAndIdeaCollections(result.boardId, false, '')
Expand Down Expand Up @@ -113,7 +112,7 @@ self.exists = function(boardId) {
*/
self.getBoardOptions = function(boardId) {
return Board.findOne({boardId: boardId})
.select('-_id userColorsEnabled numResultsShown numResultsReturn name description')
.select('-_id userColorsEnabled numResultsShown numResultsReturn boardName boardDesc')
.then(toPlainObject)
.then((board) => {
if (isNil(board)) {
Expand Down Expand Up @@ -373,8 +372,8 @@ self.hydrateRoom = function(boardId) {
.then(([board, collections, ideas, options, userIds, usersOnBoard]) => {
hydratedRoom.collections = stripNestedMap(collections);
hydratedRoom.ideas = stripMap(ideas);
hydratedRoom.room = { name: board.name,
description: board.description,
hydratedRoom.room = { boardName: board.boardName,
boardDesc: board.boardDesc,
userColorsEnabled: options.userColorsEnabled,
numResultsShown: options.numResultsShown,
numResultsReturn: options.numResultsReturn };
Expand Down
12 changes: 6 additions & 6 deletions test/unit/services/BoardService.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ describe('BoardService', function() {
})
.then(([boardId, board]) => {
expect(boardId).to.be.a('string');
expect(board.name).to.equal('title');
expect(board.description).to.equal('description');
expect(board.boardName).to.equal('title');
expect(board.boardDesc).to.equal('description');
expect(BoardService.exists(boardId)).to.eventually.be.true;
done();
});
Expand Down Expand Up @@ -377,7 +377,7 @@ describe('BoardService', function() {
.then((users) => {
return Promise.all([
monky.create('Board', {boardId: BOARDID, users: users,
admins: users[0], name: 'name', description: 'description'}),
admins: users[0], boardName: 'name', boardDesc: 'description'}),
monky.create('Idea'),
]);
})
Expand All @@ -388,12 +388,12 @@ describe('BoardService', function() {
});

xit('Should generate all of the data for a board to send back on join', function(done) {
BoardService.hydrateRoom(BOARDID, USERID)
BoardService.hydrateRoom(BOARDID)
.then((hydratedRoom) => {
expect(hydratedRoom.collections).to.have.length(1);
expect(hydratedRoom.ideas).to.have.length(1);
expect(hydratedRoom.room.name).to.be.a('string');
expect(hydratedRoom.room.description).to.be.a('string');
expect(hydratedRoom.room.boardName).to.be.a('string');
expect(hydratedRoom.room.boardDesc).to.be.a('string');
expect(hydratedRoom.room.userColorsEnabled).to.be.false;
expect(hydratedRoom.room.numResultsShown).to.equal(25);
expect(hydratedRoom.room.numResultsReturn).to.equal(5);
Expand Down

0 comments on commit fd60fd3

Please sign in to comment.