Code Monkey home page Code Monkey logo

fileuploading-api's Introduction

Secure File Sharing System

This project is a secure file-sharing system implemented using Django REST Framework and MySQL. The system allows two types of users: Ops User and Client User, to perform specific actions.

Features

Ops User

  • Login: Allows Ops User to log into the system.
  • Upload File: Ops User can upload files of type pptx, docx, and xlsx.

Client User

  • Sign Up: Allows Client User to sign up and returns an encrypted URL.
  • Email Verify: Sends a verification email to the registered email of the Client User.
  • Login: Allows Client User to log into the system.
  • Download File: Allows Client User to download files using a secure encrypted URL.
  • List All Uploaded Files: Lists all files uploaded by Ops Users.

Common

  • Register: Allows any user to register.

Important Information

  • Only Ops Users are allowed to upload files.
  • Files must be of type pptx, docx, and xlsx.
  • Download URLs are encrypted and can only be accessed by Client Users.
  • If any other user tries to access the URL, access is denied.

Technology Stack

  • Framework: Django REST Framework
  • Database: MySQL
  • Testing Tool: Postman

Installation

  1. Clone the repository

    git clone https://github.com/Shubham6914/FileUploading-APi.git
    cd FileUploading-APi
  2. Create and activate a virtual environment

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  3. Install the required packages

    pip install -r requirements.txt
  4. Set up the MySQL database

    • Create a database in MySQL.
    • Update the DATABASES settings in settings.py with your database credentials.
  5. Run migrations

    python manage.py migrate
  6. Create a superuser

    python manage.py createsuperuser
  7. Run the development server

    python manage.py runserver

Usage

  • Use Postman to test the APIs. The following endpoints are available:
  • All API endpoints start with http://127.0.0.1:8000/user/.

Common Endpoints

  • Register
    • POST /user/register/
    • Request Body: { "username": "new_user", "email": "[email protected]", "password": "password" }

Ops User Endpoints

  • Login

    • POST /user/ops/login/
    • Request Body: { "username": "ops_user", "password": "password" }
  • Upload File

    • POST /user/ops/upload/
    • Request Body: { "file": <file> }
    • Headers: Authorization: Token <ops_user_token>

Client User Endpoints

  • Sign Up

    • POST /user/client/signup/
    • Request Body: { "username": "client_user", "email": "[email protected]", "password": "password" }
  • Email Verify

    • GET /user/client/verify-email/<verification_token>/
  • Login

    • POST /user/client/login/
    • Request Body: { "username": "client_user", "password": "password" }
  • Download File

    • GET /user/client/download/<file_id>/
    • Headers: Authorization: Token <client_user_token>
  • List All Uploaded Files

    • GET /user/client/files/
    • Headers: Authorization: Token <client_user_token>

Postman Collection

  • A Postman collection for testing the APIs is included in the repository.

License

This project is licensed under the MIT License.

Contact

For any inquiries, please contact [[email protected]].

fileuploading-api's People

Contributors

shubham6914 avatar

Watchers

 avatar

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.