Giter Site home page Giter Site logo

rezamosavi8740 / behshtifoodbackend Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 272 KB

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

PowerShell 93.63% Batchfile 5.92% Python 0.45%
api backend database fastapi python webapp webapplication

behshtifoodbackend's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.