Skip to content

matthaioum/Task-Management-API-Software-Technology

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Software Technology - Exemption Assignment

Task Management API

  • Student: Marinos Matthaiou
  • Registration Number: inf2023004
  • Course: Software Technology
  • Semester: 5th

Project Structure

├── app.py
├── tasks.json
├── test_app.py
├── Dockerfile
├── README.md
└── .github/
    └── workflows/
        └── ci.yml

Project Description

This project is a simple Task Management API implemented in Python using the Flask framework. The application allows creating, retrieving, and deleting tasks, which are stored in a JSON file (tasks.json).

Task Data Model

Each task contains the following fields:

  • id
  • username
  • title
  • description
  • deadline

Each task's id is unique and auto-incrementing, even if a task is deleted.

Supported Endpoints

Method Endpoint Description
GET /tasks Returns all tasks
GET /tasks/ Returns the task with the given id
POST /tasks Creates a new task
DELETE /tasks/ Deletes the task with the given id

Tasks are displayed sorted by id.

Unit Tests

Unit tests using pytest were used to verify the correct functioning of the application.

Coverage:

  • Task creation (POST)
  • Retrieving all tasks (GET)
  • Retrieving a task by id
  • Task deletion (DELETE)
  • Task sorting check
  • Uniqueness and auto-increment check of id after deletion

Tests are implemented in the test_app.py file.

Running the Application (Local)

  1. Install required packages:
pip install flask pytest
  1. Start the Flask API:
python app.py
  1. The application runs at:
http://localhost:5000/tasks
  1. Run the unit tests:
python -m pytest -v test_app.py

Dockerfile

A Dockerfile is provided to build and run the application via Docker.

  1. Build the image:
docker build -t task_api .
  1. Run the container:
docker run -d -p 5000:5000 task_api
  1. Check the container ID:
docker ps
  1. Open the API in your browser:
http://localhost:5000/tasks

GitHub Actions

  • A GitHub Actions workflow (.github/workflows/ci.yml) has been implemented, which:
    • Runs automatically on push and pull request
    • Installs Python & dependencies
    • Runs the unit tests with pytest

Successful test execution can be verified in the Actions tab on GitHub.

About

Simple Task Management API with Flask and JSON storage

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors