Skip to content

PythonGram is a REST API application implemented using the FastAPI framework. It allows users to upload, manage, and share photos, as well as interact through comments and ratings.

License

Notifications You must be signed in to change notification settings

GodVov4/PythonGram

Repository files navigation

PythonGram

PythonGram


PythonGram is a REST API application implemented using the FastAPI framework. It allows users to upload, manage, and share photos, as well as interact through comments and ratings.


Documentation Status Deploy Status

Table of Contents

Technologies

Module Description
FastAPI Framework
Pydantic Validation library
SQLAlchemy ORM
Alembic Migration tool
PostgreSQL Database
Cloudinary Image hosting
FastAPI-limiter Rate limiting
Passlib Password hashing
Qrcode QR code generator
Pillow Image processing

Basic functionality

Authentication

Endpoints:

POST /api/auth/signup
POST /api/auth/login
POST /api/auth/logout
POST /api/auth/refresh_token

The names speak for themselves

The application uses JWT tokens for authentication. Users have three roles: regular user, moderator, and administrator.

To implement different access levels (regular user, moderator, and administrator), FastAPI decorators are used to check the token and user role.

Working with photos

Users can perform various operations related to photos:

  • Upload photos with descriptions.

    POST /api/images/upload_picture
    
  • Delete photos.

    DELETE /api/images/{picture_id}
    
  • Edit photo descriptions.

    PATCH /api/images/{picture_id}
    
  • Retrieve a photo by a unique link.

    GET /api/images/{picture_id}
    
  • Add up to 5 tags per photo.

  • Apply basic photo transformations using Cloudinary services.

    POST /api/transform/create_transform/{original_picture_id}
    
  • Generate links to transformed images for viewing as URL and QR-code. Links are stored on the server.

With the help of FastAPI decorators, described above, administrators can perform all CRUD operations with user photos.

Comments

Under each photo, there is a comment section. Users can:

  • Add and read comments to each other's photos.
    POST /api/comments/{picture_id}
    
    GET /api/comments/all/{picture_id}
    
  • Open and edit comment.
    GET /api/comments/{comment_id}
    
    PATCH /api/comments/{comment_id}
    
  • Administrators and moderators if you have the role can delete comments.
    DELETE /api/comments/{comment_id}
    

Profile

Endpoints for user profile:

  • See your profile.

    GET /api/users/me
    
  • Edit your profile, or change your avatar.

    PATCH /api/users/me
    
    PATCH /api/users/avatar
    
  • See another user's profile.

    GET /api/users/{username}
    
  • Ban users, if you have the administrator role.

    PATCH /api/users/{username}
    
  • Create a route for a user profile based on their unique username. It returns all user information, including name, registration date, and the number of uploaded photos.

  • Users can edit their own information and view it.

  • Administrators can deactivate users (ban them). Inactive users cannot log in.

Ratings

soon...

Search

soon...

Usage

Installation

  • Clone the repository.
  git clone https://github.com/GodVov4/PythonGram.git
  • Install dependencies.
  pip install -r requirements.txt

or with poetry

  poetry install
  • Setup the ".env" file.
  cp .env.example .env

and fill in the information you need

  • Run the application.
  uvicorn main:app --reload
  • Enjoy!

Additional information

License

This project is licensed under the MIT License.

Authors

Feel free to provide feedback, report issues, or contribute to the project!

About

PythonGram is a REST API application implemented using the FastAPI framework. It allows users to upload, manage, and share photos, as well as interact through comments and ratings.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  

Languages