Skip to content

Flask-based API service for managing users in CMS articles website

License

Notifications You must be signed in to change notification settings

WojciechKubak/CMS-SERVER-USERS

Repository files navigation

🌐 CMS-SERVER-USERS

CMS-SERVER-USERS is a microservice that is part of a larger Content Management System (CMS). It is specifically designed to manage users and their interactions with comments. The goal of this service is to centralize and simplify the user management and comment interaction process within the CMS.

📚 Table of Contents

📝 General Information

This service is built using Flask, a lightweight web application framework, and SQLAlchemy, a SQL toolkit and Object-Relational Mapping (ORM) system for Python. It provides a RESTful API for managing users and comments, including CRUD operations and others.

💻 Technologies Used

  • Flask: The web framework used for building the application.
  • Flask-SQLAlchemy: It simplifies the management of the database, and provides useful defaults and extra helpers that make it easier to accomplish common tasks.
  • Flask-Migrate: A Flask extension that handles SQLAlchemy database migrations, used for managing changes to the database schema.
  • Flask-Mail: A Flask extension for sending emails, used for user-related notifications.

🌟 Features

  • User Management: Provides comprehensive user management features including the ability to change a user's role and username, delete a user, retrieve a user by username, email, or ID, get all users, activate a user, verify user credentials, and register a new user.
  • Comment Management: Offers robust comment management capabilities such as adding a comment, updating a comment's content, deleting a comment, retrieving a comment by ID, and getting all comments associated with a specific user or article.

🚀 Setup

The project dependencies are listed in the Pipfile.lock file located in the root directory of the project. This file is generated by Pipenv and ensures that the project's dependencies are locked to specific versions for reliable and repeatable builds.

  1. Clone the repository:

    git clone https://github.com/WojciechKubak/CMS-SERVER-USERS
  2. Navigate to the project directory:

    cd CMS-SERVER-USERS
  3. Install dependencies:

    pipenv install
  4. Start the Docker containers:

    docker-compose up --build
  5. Enter the Docker container:

    docker exec -it <container_id> bash
  6. Make migrations:

    pipenv run flask --app main.py db upgrade

The application should now be running at localhost:8001. Please replace the placeholders with the actual values (like your username, repository name, etc.).

🛠️ Usage

Once the application is up and running, you can interact with it through its API endpoints. A Postman collection is provided in the repository which contains examples of all the API endpoints.

🧪 Tests

This project uses pytest for testing. Test coverage is provided by the coverage library, and factory-boy is used for creating test data. flake8 is used for linting to ensure code quality.

Run the tests:

pipenv run pytest

Generate a coverage report:

pipenv run coverage run -m pytest
pipenv run coverage report

Check code quality with flake8:

pipenv run flake8

About

Flask-based API service for managing users in CMS articles website

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages