Skip to content
Open

Cli #80

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
8e541d9
adds Customer, Drin_Order, and Drinks Classes, Edits cli and adds age…
Ketchuso Mar 20, 2025
cd68092
adds prints for age_verification()
Ketchuso Mar 20, 2025
7c3f448
SQL drinks, customer and drink_orders added. Table functions working …
KerissaGit Mar 21, 2025
5ed6fc8
adds basic cli functionality, without much class implementation
Ketchuso Mar 21, 2025
1930cf8
Merge pull request #1 from Ketchuso/sql-start
KerissaGit Mar 21, 2025
b188135
adds basic cli functionality, without much class implementation and m…
Ketchuso Mar 21, 2025
9fcad22
Merge pull request #2 from Ketchuso/cli
Ketchuso Mar 21, 2025
b101b0a
Added a Drawio file
KerissaGit Mar 21, 2025
dbaa9ed
Merge pull request #3 from Ketchuso/sql-start
KerissaGit Mar 21, 2025
b206e60
adds global tab_open bool to check if tab is open
Ketchuso Mar 21, 2025
d5d7d58
ADD: seed.py, deleted sql files
vix219 Mar 21, 2025
c0be0df
Merge pull request #4 from Ketchuso/vic-1st-branch
vix219 Mar 21, 2025
638b92c
Merge branch 'main' into cli
Ketchuso Mar 21, 2025
edda741
adds global tab_open bool to check if tab is open and merges
Ketchuso Mar 21, 2025
e39eacd
Merge pull request #5 from Ketchuso/cli
Ketchuso Mar 21, 2025
b58a722
update seed.py
vix219 Mar 21, 2025
3bb63f8
update seed.py
vix219 Mar 21, 2025
ebdd57f
ADD: seeded drinks
vix219 Mar 24, 2025
1c7cfcd
Merge pull request #6 from Ketchuso/vic-1st-branch
vix219 Mar 24, 2025
1fdc4a4
adds formatting to the cli
Ketchuso Mar 24, 2025
92b1eea
adds formatting to the cli and merges
Ketchuso Mar 24, 2025
562cbf3
Merge pull request #7 from Ketchuso/cli
Ketchuso Mar 24, 2025
af7bd9b
inputs name and age verification
Ketchuso Mar 24, 2025
83d7df2
inputs name and age verification and merges
Ketchuso Mar 24, 2025
fc60d57
UPDATE: drink_orders file, and join tables
vix219 Mar 24, 2025
dcb0bce
Merge pull request #8 from Ketchuso/vics-2nd-branhc
vix219 Mar 24, 2025
e0b69fd
inputs name and age verification and merges
Ketchuso Mar 24, 2025
56169c0
fixes input functionality
Ketchuso Mar 24, 2025
f187457
Merge pull request #9 from Ketchuso/cli
Ketchuso Mar 24, 2025
6c0a5b6
tries to combine cli with delete method for customer
Ketchuso Mar 24, 2025
21f206d
tries to combine cli with delete method for customer and merges
Ketchuso Mar 24, 2025
b5df0c5
adds emoticons for emotions and adds a cutoff point for drinking
Ketchuso Mar 24, 2025
1efa9ce
fixes delete function
Ketchuso Mar 25, 2025
68837ca
Merge pull request #10 from Ketchuso/cli
Ketchuso Mar 25, 2025
8476955
doesn't allow invalid ages in db
Ketchuso Mar 25, 2025
01ec058
doesn't allow invalid ages in db and refreshes db
Ketchuso Mar 25, 2025
86b5790
adds view_tab and select_tab, select_tab just prints choice
Ketchuso Mar 25, 2025
1d87b46
sets up view_tab and select_tab for get_by_id
Ketchuso Mar 25, 2025
f30eea7
Merge pull request #11 from Ketchuso/cli
Ketchuso Mar 25, 2025
f5f8ad8
ADD:colorama in pip.
vix219 Mar 25, 2025
7dfefd0
ADD: find_by and update to drink_orders
vix219 Mar 25, 2025
e58b9e7
Merge pull request #12 from Ketchuso/vics-3rd-branch
vix219 Mar 25, 2025
6a0cf17
sets up select_tab to print out the drinks
Ketchuso Mar 25, 2025
bc88dde
sets up update_birthday()
Ketchuso Mar 25, 2025
d44ab1b
Merge pull request #13 from Ketchuso/cli
Ketchuso Mar 25, 2025
08881c3
Working on Drink_Orders database functionality
KerissaGit Mar 25, 2025
cdaf351
ADD: drink_order table to update with cli selections
vix219 Mar 25, 2025
b716346
Merge pull request #14 from Ketchuso/vics-3rd-branch
vix219 Mar 25, 2025
8b08d82
Merge remote-tracking branch 'origin' into k-python-update
KerissaGit Mar 26, 2025
3dbfad5
cleans up cli and select_tab now shows a clearer output
Ketchuso Mar 26, 2025
43e6a75
Merge pull request #15 from Ketchuso/cli
Ketchuso Mar 26, 2025
1c34f2b
fixes drink_count bug
Ketchuso Mar 26, 2025
dc0e6d1
Merge pull request #16 from Ketchuso/cli
Ketchuso Mar 26, 2025
ddbe892
ADD: Drinks.find_by_id in CLI
vix219 Mar 26, 2025
6612f92
Merge pull request #17 from Ketchuso/vics-5th-branch
vix219 Mar 26, 2025
f940423
Allows creation of a drink
KerissaGit Mar 26, 2025
691afbf
Merge remote-tracking branch 'origin' into k-python-drink
KerissaGit Mar 26, 2025
e1ff33b
Merge pull request #19 from Ketchuso/k-python-drink
KerissaGit Mar 26, 2025
0b5b62d
defines delete_drink
Ketchuso Mar 26, 2025
187453c
implements delete_drink()
Ketchuso Mar 26, 2025
9f71b9b
Merge pull request #20 from Ketchuso/cli
Ketchuso Mar 26, 2025
0131334
ADD: Drink_Orders.delete to CLI
vix219 Mar 26, 2025
7270d64
Merge pull request #21 from Ketchuso/vics-6th-branch
vix219 Mar 26, 2025
e33801b
Different Delete. Don't merge at this time.
KerissaGit Mar 26, 2025
e9fa4e1
Merge branch 'main' into k-python-drink
KerissaGit Mar 26, 2025
03eacb3
Added READ ME file
KerissaGit Mar 26, 2025
e18f4da
Merge pull request #22 from Ketchuso/k-python-drink
KerissaGit Mar 26, 2025
0832ead
Added and Formatted README
KerissaGit Mar 26, 2025
29f58ed
Merge pull request #23 from Ketchuso/k-python-drink
KerissaGit Mar 27, 2025
74105a9
cleans up code and adds colorama to readme
Ketchuso Mar 27, 2025
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
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ name = "pypi"
ipdb = "*"
faker = "*"
pytest = "7.1.3"
colorama = "*"

[dev-packages]

Expand Down
11 changes: 10 additions & 1 deletion Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

176 changes: 27 additions & 149 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,172 +1,50 @@
# Phase 3 CLI+ORM Project Template
# 🍹🍺 The Thirsty Python Bar 🥃🍸

## Learning Goals

- Discuss the basic directory structure of a CLI.
- Outline the first steps in building a CLI.
Welcome to **The Thirsty Python Bar**! 🍻 This terminal-based drink ordering simulator allows you to simulate your experience at a bar, all through a Command-Line Interface (CLI) powered by Python. Whether it's your birthday or you're just looking to grab a drink, this project offers an interactive way to place drink orders, manage customer tabs, and celebrate special occasions — all while keeping track of orders with an SQL database.

---

## Introduction

You now have a basic idea of what constitutes a CLI. Fork and clone this lesson
for a project template for your CLI.

Take a look at the directory structure:
## 🎉 Features 🎉

```console
.
├── Pipfile
├── Pipfile.lock
├── README.md
└── lib
├── models
│ ├── __init__.py
│ └── model_1.py
├── cli.py
├── debug.py
└── helpers.py
```

Note: The directory also includes two files named `CONTRIBUTING.md` and
`LICENSE.md` that are specific to Flatiron's curriculum. You can disregard or
delete the files if you want.
- 🙋 **Customer Creation**: Create a customer profile and verify if they are old enough to enter the bar.
- 🥳 **Birthday Fun**: Celebrate your birthday and automatically update your age when you do.
- 🍹 **Drink Management**: Add, remove, and select drinks from the menu.
- 💳 **Tabs**: Track the drinks a customer has ordered. Open a new tab, view previous orders, and switch between tabs.
- 💵 **Tab Closure**: Once the customer has closed their tab, all their orders are removed from the system, and the customer is logged out.
- 💾 **SQL Backend**: The system uses an SQL database to store, update, and retrieve customer and drink data.

---

## Generating Your Environment

You might have noticed in the file structure- there's already a Pipfile!

Install any additional dependencies you know you'll need for your project by
adding them to the `Pipfile`. Then run the commands:

```console
pipenv install
pipenv shell
```

---

## Generating Your CLI

A CLI is, simply put, an interactive script and prompts the user and performs
operations based on user input.

The project template has a sample CLI in `lib/cli.py` that looks like this:

```py
# lib/cli.py

from helpers import (
exit_program,
helper_1
)


def main():
while True:
menu()
choice = input("> ")
if choice == "0":
exit_program()
elif choice == "1":
helper_1()
else:
print("Invalid choice")

## 💻 Technologies Used 💻

def menu():
print("Please select an option:")
print("0. Exit the program")
print("1. Some useful function")


if __name__ == "__main__":
main()
```

The helper functions are located in `lib/helpers.py`:

```py
# lib/helpers.py

def helper_1():
print("Performing useful function#1.")


def exit_program():
print("Goodbye!")
exit()
```

You can run the template CLI with `python lib/cli.py`, or include the shebang
and make it executable with `chmod +x`. The template CLI will ask for input, do
some work, and accomplish some sort of task.

Past that, CLIs can be whatever you'd like, as long as you follow the project
requirements.

Of course, you will update `lib/cli.py` with prompts that are appropriate for
your application, and you will update `lib/helpers.py` to replace `helper_1()`
with a useful function based on the specific problem domain you decide to
implement, along with adding other helper functions to the module.

In the `lib/models` folder, you should rename `model_1.py` with the name of a
data model class from your specific problem domain, and add other classes to the
folder as needed. The file `lib/models/__init__.py` has been initialized to
create the necessary database constants. You need to add import statements to
the various data model classes in order to use the database constants.

You are also welcome to implement a different module and directory structure.
However, your project should be well organized, modular, and follow the design
principal of separation of concerns, which means you should separate code
related to:

- User interface
- Data persistence
- Problem domain rules and logic
- **Python**: The core programming language for logic and CLI interaction.
- **CLI**: Command Line Interface for interaction with the system.
- **SQL**: Database management to store customer profiles, drink menus, and order data.

---

## Updating README.md
## 💾 Starting the Program 💾

`README.md` is a Markdown file that should describe your project. You will
replace the contents of this `README.md` file with a description of **your**
actual project.
To get started, first clone the repository:

Markdown is not a language that we cover in Flatiron's Software Engineering
curriculum, but it's not a particularly difficult language to learn (if you've
ever left a comment on Reddit, you might already know the basics). Refer to the
cheat sheet in this assignments's resources for a basic guide to Markdown.
- git clone [email protected]:Ketchuso/python-phase3-project.git
- cd python-phase3-project

### What Goes into a README?
Make sure you have Python installed (version 3.7 or above).

This README serves as a template. Replace the contents of this file to describe
the important files in your project and describe what they do. Each Python file
that you edit should get at least a paragraph, and each function should be
described with a sentence or two.
Before starting the application to access Colorama:

Describe your actual CLI script first, and with a good level of detail. The rest
should be ordered by importance to the user. (Probably functions next, then
models.)
- pipenv install colorama

Screenshots and links to resources that you used throughout are also useful to
users and collaborators, but a little more syntactically complicated. Only add
these in if you're feeling comfortable with Markdown.
To start the application, open your terminal and run the following command:

---

## Conclusion
- python lib/cli.py

A lot of work goes into a good CLI, but it all relies on concepts that you've
practiced quite a bit by now. Hopefully this template and guide will get you off
to a good start with your Phase 3 Project.
## 🙏 Acknowledgments 🙏

Happy coding!

---
A huge thank you to the talented developers who contributed to this project:
Jay, Victoria, and Kerissa

## Resources
## 📜 License 📜

- [Markdown Cheat Sheet](https://www.markdownguide.org/cheat-sheet/)
This project is licensed under the MIT License.
52 changes: 52 additions & 0 deletions bar.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<mxfile host="65bd71144e">
<diagram id="j-BLMZNdsH3atIXuTxNO" name="Page-1">
<mxGraphModel dx="615" dy="508" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="2" value="Drinks" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="180" y="20" width="140" height="120" as="geometry"/>
</mxCell>
<mxCell id="3" value="id INT PRIMARY KEY" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="2">
<mxGeometry y="30" width="140" height="30" as="geometry"/>
</mxCell>
<mxCell id="4" value="name TEXT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="2">
<mxGeometry y="60" width="140" height="30" as="geometry"/>
</mxCell>
<mxCell id="5" value="age_requirement INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="2">
<mxGeometry y="90" width="140" height="30" as="geometry"/>
</mxCell>
<mxCell id="6" value="Drink Orders" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="180" y="210" width="140" height="90" as="geometry"/>
</mxCell>
<mxCell id="7" value="customer_id" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="6">
<mxGeometry y="30" width="140" height="30" as="geometry"/>
</mxCell>
<mxCell id="8" value="drink_id" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="6">
<mxGeometry y="60" width="140" height="30" as="geometry"/>
</mxCell>
<mxCell id="10" value="Customers" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="180" y="370" width="140" height="120" as="geometry"/>
</mxCell>
<mxCell id="11" value="id INT PRIMARY KEY" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="10">
<mxGeometry y="30" width="140" height="30" as="geometry"/>
</mxCell>
<mxCell id="12" value="name TEXT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="10">
<mxGeometry y="60" width="140" height="30" as="geometry"/>
</mxCell>
<mxCell id="13" value="age_requirement INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="10">
<mxGeometry y="90" width="140" height="30" as="geometry"/>
</mxCell>
<mxCell id="14" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=0.872;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="249.17" y="140.00000000000009" as="sourcePoint"/>
<mxPoint x="249.17" y="213.84" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="16" style="edgeStyle=none;html=1;entryX=0.5;entryY=1.333;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="10" target="8">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
Loading