rezamosavi8740 / BehshtiFoodBackend

This project is related to the backend of a food ordering website and management of a restaurant website designed with fastapi.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Here's a general and simple explanation of the function of each code file:

  1. LoginAPIS.py: This file contains the API routes related to user login. It uses the FastAPI framework to define an APIRouter called "Login" and a single POST endpoint "/Login" that handles user login requests. When a user tries to log in with their phone number, the function checks the database to see if there is a corresponding user with that phone number. If a matching user is found, it returns True; otherwise, it returns False.

  2. Values.py: This file defines several Pydantic models for different data entities related to the application. It contains models for UserValues, OrderValues, FoodValues, and CategoriesValues. Pydantic models are used to define the structure and validation rules for incoming data in FastAPI.

  3. model.py: This file defines the SQLAlchemy models for database tables. It includes models for Users, Orders, Foods, and Categories, which represent the corresponding database tables. Each model maps to a table in the database, and relationships between the tables are also defined. For example, the Order model has a foreign key relationship with the Foods table, and the Foods table has a foreign key relationship with the Categories table.

  4. database.py: This file is responsible for connecting to the PostgreSQL database using SQLAlchemy. It creates a database engine and a sessionmaker to handle interactions with the database. The connectToDB function is a generator that yields a session, allowing other parts of the code to use the database session while ensuring proper cleanup after use.

  5. signUP.py: This file contains the API routes related to user signup (registration). It defines an APIRouter called "signup" and a single POST endpoint "/signup" that handles user registration requests. The function adds a new user to the database using the provided data (not shown in the provided code).

  6. main.py: This is the main application file. It creates a FastAPI app and includes the API routes defined in the "LoginAPIS.py" file using the include_router function.

In summary, this repository appears to be an application that provides API endpoints for user authentication, registration, and some CRUD operations for food-related data using FastAPI and SQLAlchemy with a PostgreSQL database. The provided code snippets show the basic structure of the application, but some functionalities like user registration logic are not shown in the code.

About

This project is related to the backend of a food ordering website and management of a restaurant website designed with fastapi.


Languages

Language:PowerShell 93.6%Language:Batchfile 5.9%Language:Python 0.5%