Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions documentation/apiObjects/contracts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#Object - contract

Represents an agreement between user and patron for a specific event

| Fields | Type | Description
| ------------- | ------- | ------------|
| title | String | Title of the contract |
| description | String | Description of the contract |
| customer | customer | Primary customer to associated with contract |
| event | event | Event object describing the contracts event (see below)|
| rentalItems | [rentalItem] | collection of rentalItem Objects needed for the contract event|
| menuItems | [menuItem] | collection of menuItems served at the event |
| commLog | [commItem] | collection of communications about the event |
| status | enum | A contract may be in one of serveral statues (init, bid, contract, completed) |
| notes | String | Other related information about the contract |

#Object - Event

| Fields | Type | Description
| ------------- | ------- | ------------|
| Date | Date | Date of the event |
| startTime | Date | Event start time |
| endTime | Date | Event end time |
| numOfPeople | number | number of people attending the event |
| venue | venue | location of the event |

#Object - commItem
A single communication interaction with a customer (e.g. emails, calls, in person meetings)

| Fields | Type | Description
| ------------- | ------- | ------------|
| Date | Date | Date of the communication |
| commType | Enum | what mode of communication was used? (email, call, in person) |
| rep | String | Which employee represented the restaurant during the communication |
| description | String | Summary of the communication with the customer |



##Other Notes

**contract**
- I lost the document we collaborated on last thursday, this is the best I could do from memory.
- Do we need a deposit field on contracts object
- How should "Sequence of events be implemented"? Do we need a sequence object to do this?
- Should we have custom fields for customizable contracts to fit each restaurants needs? How would we implement this?
- We will evenutally implement "employees" or "staff" field to assign staff to a contract

**Events**
- Events are broken out as a sperate object, is this effective? Are the fields assigned to the appropriate objects?

**commItem**
- Old town dining has commType implemented as a enum drop down list. Is this how we should implement it for Banquet Ninja?

##Pending changes

**contracts**
- Initial review and implementation

**events**
- Initial review and implementation

**commItem**
- Intial review and implementation
50 changes: 50 additions & 0 deletions documentation/apiObjects/customer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#Object - Customer
Restaurant patron

| Fields | Type | Description
| ------------- | ------- | ------------|
| firstName | String | First name of customer |
| lastName | Number | Last name of customer |
| address | [address] | collection of address associated with a customer |
| emails | [email] | collection of emails associated with a customer |
| contactNumbers| [contactNumber]| collection of phone numbers associated with a customer |
| contracts | [contractID] | ID's of contract objects associated with a customer |

#Object - address
Address

| Fields | Type | Description
| ------------- | ------- | ------------|
| addressType | String | Type of address |
| primary | Boolean | Is this the primary address |
| address1 | String | address line 1 |
| address2 | String | address line 2 |
| city | String | City |
| State | String | State |
| Zip | String | Zip |

#Object - email
Email address

| Fields | Type | Description
| ------------- | ------- | ------------|
| emailType | Enum | type of email |
| primary | Boolean | Is this the primary email |
| email | String | email address |

#Object - contactNumber
Email address

| Fields | Type | Description
| ------------- | ------- | ------------|
| contactType | Enum | type of phone number |
| primary | Boolean | Is this the primary contact number |
| number | String | phone number |

##Other Notes
- none

##Pending changes

- Initial review

35 changes: 35 additions & 0 deletions documentation/apiObjects/menu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Object - menu

Colleciton of menuItem objects representing a menu.


| Fields | Type | Description
| ------------- | ------- | ------------|
| name | String | Name of the menu (for internal restaurant use/identification |
| title | String | Title of menu for restaurant guests |
| description | String | Description of menus purpose |
| subtitle | String | Subtitle of menu for restaurnt guests |
| sections | [menuSection] | Sections of the menu |
| footer | String | Footer of the menu |



#Object - menuSection

One section of a menu

| Fields | Type | Description
| ------------- | ------- | ------------|
| title | String | Title of the section |
| subtitle | String | Subtitle of the section |
| items | [menuItem] | Collection of menuItems in the section |
| footer | String | Footer for the section |


##Other Notes

-

###Pending changes

- none
20 changes: 20 additions & 0 deletions documentation/apiObjects/menuGroup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

#Object - menuGroup

Collection of one or more menu Objects

| Fields | Type | Description
| ------------- | ------- | ------------|
| title | String | title of the menu group |
| description | String | description of the menu group |
| subtitle | String | subtitle of the menu group |
| menus | [menu] | Collection of menu objects |


##Other Notes

- Do we need the "State" Field that is currently implemented in the schema? I'm unclear on this fields purpose - Michael

###Pending changes

- abstracting dateCreated to the meta Data Object
19 changes: 19 additions & 0 deletions documentation/apiObjects/menuItem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# menuItem

fully implemented 10/3/15

Represents any item (usually food or beverage) for sale by a restaurant.


| Fields | Type | Description
| ------------- | ------- | ------------|
| name | String | Name of the item |
| Description | String | Description of the item |
| Category | String | Type of food/beverage |


##Other Notes

- Michael - Unclear on what category would, need examples
- Do we want to implement "varations" field?

16 changes: 16 additions & 0 deletions documentation/apiObjects/metaData.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# MetaData

Data fileds inherited by each API object.


| Fields | Type | Description
| ------------- | ------- | ------------|
| createDate | Date | Date of the objects creation |
| lastMod | Date | Last Date the object was modified |
| company | String | Company the object is associated with |


##Other Notes

- Missing one field, current build not available

31 changes: 31 additions & 0 deletions documentation/apiObjects/rentalItems.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#Object - rentalItem
An item that may be rented by a patron.

Fully Implemented - 9/18/15

| Fields | Type | Description
| ------------- | ------- | ------------|
| Name | String | Name of the item |
| Price | Number | Price to rent the item |
| inHouse | Boolean | Is the item stored in house (true), or is it kept with a third party (false) |
| contact | Contact | Contact object to be used if the rentalItem is kept with a third party |

#Object - Contact
conctact information of third party that keeps a rental item

| Fields | Type | Description
| ------------- | ------- | ------------|
| Name | String | Name of the contact |
| phone | Number | Phone number of contact |
| email | String | email of contact |



##Other Notes

- Should there be a third party rental price in the case that the third party rents the item to the restaurant?
- Third party contacts are abstracted, is this a good idead?

##Pending changes


18 changes: 18 additions & 0 deletions documentation/apiObjects/venue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#Object - venue
A location where events can be help

Fully implemented 9/21/2015

| Fields | Type | Description
| ------------- | ------- | ------------|
| Name | String | Name of the venue |
| Description | String | Description of the venue |
| capacity | Number | Maximum amount of people the venue can support |
| price | Number | Price to rent the venue |
| notes | String | Additional information about the venue |

##Other Notes

- Should price field be attached to this object? or maybe the contract object?

##Pending changes
15 changes: 0 additions & 15 deletions documentation/contracts/contract.md

This file was deleted.

14 changes: 7 additions & 7 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ require('./server/config/errors')(app);
app.set('port', config.port);
//app.listen(app.get('port'));
var server = require('http').Server(app);
var io = require('socket.io')(server);
//var io = require('socket.io')(server);
server.listen(app.get('port'));

io.on('connection', function(socket){
socket.emit('news', {hello: 'world'});
socket.on('my other event', function(data){
console.log(data);
});
});
// io.on('connection', function(socket){
// socket.emit('news', {hello: 'world'});
// socket.on('my other event', function(data){
// console.log(data);
// });
//});


console.log('Listening on port ' + config.port + "...");
6 changes: 5 additions & 1 deletion server/config/mongoose.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ var mongoose = require('mongoose'),
menuGroupModel = require('../models/MenuGroup'),
menuItemModel = require('../models/MenuItem'),
menuModel = require('../models/Menu'),
lookupsModel = require('../models/Lookups');
lookupsModel = require('../models/Lookups'),
rentalItemModel = require('../models/RentalItem'),
venuesModel = require('../models/venues.js');

module.exports = function (config) {

Expand Down Expand Up @@ -54,6 +56,8 @@ module.exports = function (config) {
.then(customerModel.createDefaultCustomers(seedCompanyId))
.then(navigationModel.createDefaultNavigation())
.then(lookupsModel.createDefaultLookups(seedCompanyId))
.then(rentalItemModel.createDefaultRentalItems(seedCompanyId))
.then(venuesModel.createDefaultVenues(seedCompanyId))

);

Expand Down
9 changes: 6 additions & 3 deletions server/config/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ var auth = require('./auth'),
menuRoutes = require('../routes/api_menus.js'),
menuItemRoutes = require('../routes/api_menuItems.js'),
menuGroupRoutes = require('../routes/api_menuGroups.js'),
lookupsRoutes = require('../routes/api_lookups.js');

lookupsRoutes = require('../routes/api_lookups.js'),
rentalItemRoutes = require('../routes/api_rentalItems.js'),
venueRoutes = require('../routes/api_venues.js');


module.exports = function (app) {
Expand Down Expand Up @@ -41,7 +42,9 @@ module.exports = function (app) {
app.use('/api/menuItems', menuItemRoutes);
app.use('/api/menuGroups', menuGroupRoutes);
app.use('/api/lookups', lookupsRoutes);

app.use('/api/rentalItems', rentalItemRoutes);
app.use('/api/venues', venueRoutes);

// Partials
app.get('/partials/*', function (req, res) {
res.render('../../public/app/' + req.params[0]);
Expand Down
55 changes: 55 additions & 0 deletions server/controllers/rentalItems.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
var RentalItem = require('mongoose').model('RentalItem');

exports.getRentalItems = function (req, res) {
RentalItem.find({ "meta.company": req.user.company}).exec(function (err, collection) {
if(err){
res.status(400);
}
res.send(collection);
});


};

exports.getRentalItemById = function (req, res) {

RentalItem.findOne({ _id: req.params.id, "meta.company": req.user.company }).exec(function (err, rentalitem) {
res.send(rentalitem);
});

};

exports.createRentalItem = function (req, res, next) {
var rentalItemData = req.body;
rentalItemData.meta.company = req.user.company;
RentalItem.create(rentalItemData, function (err, rentalItem) {
if (err) {
res.status(400);
return res.send({ reason: err.toString() });
}
res.send(rentalItem.toObject());
});
};

exports.updateRentalItem = function (req, res) {
delete req.body._id;

RentalItem.findByIdAndUpdate({ _id: req.params.id }, req.body, function (err, rentalItem) {
if (err) {
console.log(err);
res.status(400);
return res.send({ reason: err.toString() });
}
res.send(rentalItem.toObject());
});
};

exports.deleteRentalItem = function (req, res) {
RentalItem.remove({ _id: req.params.id }, function (err) {
if (err) {
res.status(400);
return res.send({ reason: err.toString() });
}
res.send(204);
});
};
Loading