Skip to content

Conversation

@Darwin939
Copy link

No description provided.


In this project, you will rewrite the existing [hot-coffee](https://github.com/alem-platform/foundation/tree/main/hot-coffee) project to work with a PostgreSQL database. The main task is to modify the current handlers in hot-coffee so that they execute SQL queries instead of working with JSON.

In addition to refactoring the existing handlers, you will add several new ones related to aggregation and reporting. Throughout this project, you will learn to perform basic SQL operations and explore aggregation tools provided by PostgreSQL.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"basic operations" they have learned it in sprint-sql, they should be learning more advanced stuff, maybe refactor this section as "basic and advanced SQL operations"


## Context

Systems become more complex and modernized over time, and the hot-coffee project is no exception. While using a JSON-based database is convenient, it is not scalable and makes maintenance difficult for other developers. Moving to a PostgreSQL database is the better solution.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is a* better solution


Your task is to rewrite the existing endpoints in the **hot-coffee** project to work with a PostgreSQL database. To do this, you may use a third-party PostgreSQL driver as part of your solution.

You need to create the following tables: `user`, `order`, `menu`, `menu_item`, `inventory`, and `ingredient`, and define the relationships between them. You are not limited to only these tables; you may create additional ones if necessary for implementing the required functionality. The design and relationships of the tables are at your discretion.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

names of tables in plural?


You need to create the following tables: `user`, `order`, `menu`, `menu_item`, `inventory`, and `ingredient`, and define the relationships between them. You are not limited to only these tables; you may create additional ones if necessary for implementing the required functionality. The design and relationships of the tables are at your discretion.

Pay special attention to designing the relationships between tables (e.g., one-to-many, one-to-one). For instance, the `menu` and `menu_item` tables will have a "one-to-many" relationship, meaning the `menu_item` table should include a column with the following constraint:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it shouldn't be necessary to add following line as it is, but rather "...table MAY include a column..."


Systems become more complex and modernized over time, and the hot-coffee project is no exception. While using a JSON-based database is convenient, it is not scalable and makes maintenance difficult for other developers. Moving to a PostgreSQL database is the better solution.

Fortunately, since the project was initially built using a layered architecture, the transition will be easier. You will need to add a new Data Access Layer (Repositories) and integrate it into the project.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not add, but change Data Access Layer, because they've already implemented it

- SQL
- PostgreSQL
- CRUD
- ERD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing about ERD in the project, I guess it should be necessary for them to make ERD diagram and submit it with the work, because it really helps in organizing tables and relationships before impelmenting them

## Learning Objectives

- SQL
- PostgreSQL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this project also needs to show the difference between SQLite and PostgeSQL as databases and to do so, it should require such things, that is featured only in PostgreSQL, like it's scalability, concurrent queries, unique data types, range of tools and etc.


- SQL
- PostgreSQL
- CRUD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, they've already learned the crud in foundation and even in sprint sql with basic crud and advanced ones at the end of the sprint and I think it would be better to make it Advanced CRUD and change requirements to have much more complicated endpoints, handling business logic and using complex queries that would require thorough planning of the tables as for example idea for one of the endpoints could the full text search:

Full-Text Search

  • Implement menu search using PostgreSQL's full-text search capabilities
  • Add endpoint GET /menu/search that allows searching by:
    • Item name
    • Ingredients
    • Description
    • Handling partial matches and typos


Your task is to rewrite the existing endpoints in the **hot-coffee** project to work with a PostgreSQL database. To do this, you may use a third-party PostgreSQL driver as part of your solution.

You need to create the following tables: `user`, `order`, `menu`, `menu_item`, `inventory`, and `ingredient`, and define the relationships between them. You are not limited to only these tables; you may create additional ones if necessary for implementing the required functionality. The design and relationships of the tables are at your discretion.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I think the number of tables are too low, even though it is correlated to the project itself. In the sprint sql they've already faced more complex schemas and this looks as a little downgrade in comparison, I think addition of several new tables as required is necessary

```
Plan your data structure carefully to ensure the project's scalability and maintainability.

Since adding a database dependency to your project makes it more challenging for auditor to run and test it, you need to containerize your service and database into separate containers and write a `docker-compose.yml` file. This will allow the project to be started with a single command:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is too hard for them to containerization for their own, considering it is their first project and that they will learn this topic much later in the course. I think they would spend much more time than intended in this section (I personally would, if it was the first time for me facing this topic)

Either one of this solution could be applied:

  1. Provide detailed guide on how to setup the project in docker-compose
  2. Do not include docker and leave the testing part as it is, considering that authors would provide mock data in init.sql that would used to quickly setup the database for testing

@@ -1 +1,283 @@
# backend

# hot-coffee-sql
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe give it more entertaining name like frappuccino or cold-coffee or hottest-coffe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants