Skip to content

Muhammad-Akhlaq/Shared-Document-Store-Assignment

Repository files navigation

Shared Document Store (SDS)

Shared Document Store (SDS) is a quick prototype of a RESTful API service for managing and organizing documents. It provides functionalities for creating, updating, retrieving, and deleting documents, folders, and topics. The SDS system is built using Python 3.9, Django, and PostgreSQL.

Task Overview

The task is to develop a prototype for the SDS system with the following key aspects:

  • Use Python 3.9, Django, and PostgreSQL.
  • Design a basic document storage system with tables for "Documents," "Folders," and "Topics." Consider implementing nested folders.
  • Communicate the design with enough detail so that another developer can effectively implement it using the provided documentation.
  • Build the RESTful API service to perform operations on the resources.
  • Implement test cases to ensure the functionality and reliability of the SDS system.

Getting Started

Prerequisites

To run the SDS system locally, you need to have the following installed:

  • Python 3.9 or higher
  • Django
  • PostgreSQL

Installation Using Docker Compose

To run the SDS system using Docker Compose, follow these steps:

  1. Install Docker and Docker Compose on your system.
  2. Clone the repository:
git clone https://github.com/Muhammad-Akhlaq/Shared-Document-Store-Assignment.git
  1. Navigate to the project directory:
cd Shared-Document-Store-Assignment
  1. Build and run the Docker containers:
docker-compose up --force-recreate
  1. Access the SDS API at http://localhost:8000/.
  2. Access the SDS Swagger Docs at http://localhost:8000/swagger/.
  3. Access the SDS Redoc Docs at http://localhost:8000/redoc/.

Manual Installation

  1. Clone the repository:
git clone https://github.com/Muhammad-Akhlaq/Shared-Document-Store-Assignment.git
  1. Create a virtual environment:
cd Shared-Document-Store-Assignment
python3 -m venv venv
  1. Activate the virtual environment:
  • For Linux/Mac:

    source venv/bin/activate
  • For Windows (PowerShell):

    .\venv\Scripts\activate
  1. Install the dependencies:
pip install -r requirements.txt
  1. Set up the PostgreSQL database:
  • Create a new PostgreSQL database for the SDS system.
  • Rename sample.env to .env and update this file with your database credentials.
  1. Apply the database migrations:
python manage.py migrate
  1. to download static files for swagger and admin panel:
python manage.py collectstatic
  1. Create Super User to access admin panel:
python manage.py createsuperuser

Usage

  1. Start the development server:
python manage.py runserver
  1. Access the SDS API at http://localhost:8000/.
  2. Access the SDS Swagger Docs at http://localhost:8000/swagger/.
  • Use postman to upload file. Swagger didn't support it properly. You can find the postman
  • In Swagger don't forget to add "Bearer {token}" for authenticated routes.
  • SDS Logo
  1. Access the SDS Redoc Docs at http://localhost:8000/redoc/.
  2. Access the SDS Redoc Docs at http://localhost:8000/admin/.

Testing

To run the test cases for the SDS system, execute the following command:

  1. To run all tests:
pytest -vv -s
  1. To run particular file tests
pytest tests/docstore/test_document.py -vv -s
  1. To run particular test
pytest tests/docstore/test_document.py::TestsDocumentListCreateView::test_document_create -vv -s

I hope this meets your requirements! Thank You

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published