chefboyrd.models package

Submodules

chefboyrd.models.base_model module

Base model that all new models should inherit from

written by: Zachary Blanco tested by: Zachary Blanco debugged by: Zachary Blanco

This alows us to create new models which inherit the DB value and also the __str__ method for printing data for debugging purposes

class chefboyrd.models.base_model.BaseModel(*args, **kwargs)[source]

Bases: peewee.Model

A base model which sets up the database connection for all inherited classes

DoesNotExist

alias of BaseModelDoesNotExist

id = <peewee.PrimaryKeyField object>

chefboyrd.models.customers module

A data model for our customer

A data model is an object which helps us define mappings between our data in our databases and the objects that we interact with inside of the program and in our code.

class chefboyrd.models.customers.Customer(*args, **kwargs)[source]

Bases: chefboyrd.models.base_model.BaseModel

A sample customer model Please modify this to fit our needs

DoesNotExist

alias of CustomerDoesNotExist

id = <peewee.PrimaryKeyField object>
name = <peewee.CharField object>

chefboyrd.models.reservation module

The basic reservation model

class chefboyrd.models.reservation.Reservation(*args, **kwargs)[source]

Bases: flask_login.mixins.UserMixin, chefboyrd.models.base_model.BaseModel

DoesNotExist

alias of ReservationDoesNotExist

classmethod cancel_reservation(id)[source]

Cancels a reservation by id :param id: Unique Identifier for reservation. :type id: int

Returns:N/A
classmethod create_reservation(name, num, phone, start)[source]

Creates a new reservation

Parameters:
  • id (int) – Unique Identifier for reservation. This should be auto added by peewee for us.
  • name (str) – Name of person who made the reservation
  • num (int) – Number of people in the reservation
  • phone (str) – Phone number of person who made the reservation
  • start (time) – Starting time of reservation
Returns:

N/A

Raises:

ValueError

id = <peewee.PrimaryKeyField object>
name = <peewee.CharField object>
num = <peewee.IntegerField object>
phone = <peewee.CharField object>
start = <peewee.DateTimeField object>

chefboyrd.models.sms module

Contains the SMS model. Feedback submitted

written by: Seo Bo Shim, Jarod Morin tested by: Seo Bo Shim debugged by: Seo Bo Shim

class chefboyrd.models.sms.Sms(*args, **kwargs)[source]

Bases: chefboyrd.models.base_model.BaseModel

A model for SMS objects to be stored and analyzed. The many flags hold a range of values between -1 and 1

sid

str – is an unique id assigned by twilio. it will help us keep track of sms that is in, or not in db

submission_time

datetime – is the date and time the feedback was submitted

body

str – the message of the Sms

phone_num

str – Phone number of person who sent in text

pos_flag

int – 1 if body includes positive feedback. 0 if not. -1 default value

neg_flag

int – 1 if body includes negative feedback. 0 if not. -1 default value

exception_flag

int – 1 if body includes an exception to a present clause. 0 if not. -1 default value

food_flag

int – 1 if body includes feedback about food. 0 if not. -1 default value

service_flag

int – 1 if indicating body includes feedback about service. 0 if not. -1 default value

DoesNotExist

alias of SmsDoesNotExist

body = <peewee.TextField object>
exception_flag = <peewee.IntegerField object>
food_flag = <peewee.IntegerField object>
id = <peewee.PrimaryKeyField object>
invalid_field = <peewee.BooleanField object>
neg_flag = <peewee.IntegerField object>
phone_num = <peewee.TextField object>
pos_flag = <peewee.IntegerField object>
service_flag = <peewee.IntegerField object>
sid = <peewee.TextField object>
submission_time = <peewee.DateTimeField object>

chefboyrd.models.statistics module

This module contains all of the peewee model classes which correspond to order statistics. They will be used to make predictions and display data about business revenue and growth.

written by: Zachary Blanco tested by: Zachary Blanco debugged by: Zachary Blanco

class chefboyrd.models.statistics.Ingredients(*args, **kwargs)[source]

Bases: chefboyrd.models.base_model.BaseModel

A table which maps ingredient names to ingredient ID’s

DoesNotExist

alias of IngredientsDoesNotExist

id = <peewee.PrimaryKeyField object>
mealingredients_set

Back-reference to expose related objects as a SelectQuery.

name = <peewee.CharField object>
class chefboyrd.models.statistics.MealIngredients(*args, **kwargs)[source]

Bases: chefboyrd.models.base_model.BaseModel

A table mapping a meal to the ingredients used

DoesNotExist

alias of MealIngredientsDoesNotExist

id = <peewee.PrimaryKeyField object>
ingredient_id = <peewee.ForeignKeyField object>
ingredient_id_id = <peewee.ForeignKeyField object>
meal_id = <peewee.ForeignKeyField object>
meal_id_id = <peewee.ForeignKeyField object>
quantity_amt = <peewee.FloatField object>
quantity_meas_id = <peewee.ForeignKeyField object>
quantity_meas_id_id = <peewee.ForeignKeyField object>
class chefboyrd.models.statistics.Meals(*args, **kwargs)[source]

Bases: chefboyrd.models.base_model.BaseModel

A model for restaurant meals

DoesNotExist

alias of MealsDoesNotExist

id = <peewee.PrimaryKeyField object>
mealingredients_set

Back-reference to expose related objects as a SelectQuery.

name = <peewee.CharField object>
orders_set

Back-reference to expose related objects as a SelectQuery.

price = <peewee.FloatField object>
class chefboyrd.models.statistics.Orders(*args, **kwargs)[source]

Bases: chefboyrd.models.base_model.BaseModel

A model for storing every meal ordered and providing mappings to the tabs to meals

DoesNotExist

alias of OrdersDoesNotExist

id = <peewee.PrimaryKeyField object>
meal = <peewee.ForeignKeyField object>
meal_id = <peewee.ForeignKeyField object>
tab = <peewee.ForeignKeyField object>
tab_id = <peewee.ForeignKeyField object>
class chefboyrd.models.statistics.Quantities(*args, **kwargs)[source]

Bases: chefboyrd.models.base_model.BaseModel

A table mapping quantities names to quantity Id’s

DoesNotExist

alias of QuantitiesDoesNotExist

id = <peewee.PrimaryKeyField object>
mealingredients_set

Back-reference to expose related objects as a SelectQuery.

name = <peewee.CharField object>
class chefboyrd.models.statistics.Tabs(*args, **kwargs)[source]

Bases: chefboyrd.models.base_model.BaseModel

A model for a tab - i.e. a list of meals or items ordered at a given table.

DoesNotExist

alias of TabsDoesNotExist

fb_key = <peewee.TextField object>
had_reservation = <peewee.BooleanField object>
id = <peewee.PrimaryKeyField object>
orders_set

Back-reference to expose related objects as a SelectQuery.

party_size = <peewee.IntegerField object>
timestamp = <peewee.DateTimeField object>

chefboyrd.models.tables module

class chefboyrd.models.tables.Booking(*args, **kwargs)[source]

Bases: chefboyrd.models.base_model.BaseModel

DoesNotExist

alias of BookingDoesNotExist

booking_date_time_end = <peewee.DateTimeField object>
booking_date_time_start = <peewee.DateTimeField object>
classmethod cancel_reservation(id)[source]

Attemps to cancel a reservation given an ID

Args: cls(Booking(: an object representing a booking id(int): the id of the booking we want to cancel

classmethod create_booking(table, people, booking_date_time_start, booking_date_time_end, name, phone)[source]

Creates a new reservation

Parameters:
  • id (int) – Unique Identifier for the booking. This should be auto added by peewee for us.
  • people (int) – The number of guests requested for the booking
  • phone (char) – A phone number of the guest making the reservation
  • name (char) – The name of the guest requesting the reservation
  • booking_date_time_start (date) – The starting time of the reservation
  • booking_date_time_end (date) – The ending time of the reservation
Returns:

N/A

Raises:

ValueError

id = <peewee.PrimaryKeyField object>
name = <peewee.CharField object>
people = <peewee.IntegerField object>
phone = <peewee.CharField object>
table = <peewee.ForeignKeyField object>
table_id = <peewee.ForeignKeyField object>
class chefboyrd.models.tables.Restaurant(*args, **kwargs)[source]

Bases: chefboyrd.models.base_model.BaseModel

DoesNotExist

alias of RestaurantDoesNotExist

closing_time = <peewee.IntegerField object>
classmethod create_restaurant(name, description, opening_time, closing_time)[source]

Creates a new reservation

Parameters:
  • id (int) – Unique Identifier for reservation. This should be auto added by peewee for us.
  • name (str) – Name of person who made the reservation
  • description (str) – A description of the restaurant
  • opening_time (int) – The opening time of the restaurant in hours
  • closing_time (int) – The closing time of the restaurant in hours
Returns:

N/A

Raises:

ValueError

description = <peewee.CharField object>
id = <peewee.PrimaryKeyField object>
name = <peewee.CharField object>
opening_time = <peewee.IntegerField object>
tables_set

Back-reference to expose related objects as a SelectQuery.

class chefboyrd.models.tables.Tables(*args, **kwargs)[source]

Bases: chefboyrd.models.base_model.BaseModel

DoesNotExist

alias of TablesDoesNotExist

booking_set

Back-reference to expose related objects as a SelectQuery.

classmethod create_tables(restaurant, size, occupied, posX, posY, shape)[source]

Creates a new reservation

Parameters:
  • id (int) – A unique identifier for the table
  • restaurant (int) – The foreign key of the restaurant
  • size (int) – The max number of guests a table can seat
  • occupied (bool) – Determines if a table is occupied. 0 is not occupied, and 1 is occupied
  • posX (float) – The relative x position of the table
  • posY (float) – The relative y position of the table
  • shape (int) – An integer representing the shape of the table. 0 = Circle, 1 = Square, 2 = Rectangle, 3 = Vertical Rectangle
Returns:

N/A

Raises:

ValueError

classmethod delTable(id)[source]
id = <peewee.PrimaryKeyField object>
occupied = <peewee.BooleanField object>
posX = <peewee.FloatField object>
posY = <peewee.FloatField object>
restaurant = <peewee.ForeignKeyField object>
restaurant_id = <peewee.ForeignKeyField object>
shape = <peewee.IntegerField object>
size = <peewee.IntegerField object>

chefboyrd.models.user module

The basic user model (For logins)

written by: Zachary Blanco tested by: Zachary Blanco debugged by: Zachary Blanco

The users will have roles i.e. chef, manager, host, waitress, etc..

class chefboyrd.models.user.User(*args, **kwargs)[source]

Bases: flask_login.mixins.UserMixin, chefboyrd.models.base_model.BaseModel

A User model for who will be using the software. Users have different levels of access with different roles

Current active roles:

  • host
  • admin
  • chef
  • cust
DoesNotExist

alias of UserDoesNotExist

classmethod create_user(email, password, name, role)[source]

Creates a new user

Parameters:
  • email (str) – The user email
  • password (str) – The password string - no need to hash beforehand
  • name (str) – name, doesn’t have to be unique
  • role (str) – The user role. admin, manager, chef, host, etc..
Returns:

N/A

Raises:

ValueError – When user email already exists

email = <peewee.CharField object>
id = <peewee.PrimaryKeyField object>
name = <peewee.CharField object>
password = <peewee.CharField object>
role = <peewee.CharField object>

Module contents

Reimports all class models within the module to make them more easily accessible