Skip to content

This repository contains a little demonstration. It contains an api-server that handles employee working time data.

Notifications You must be signed in to change notification settings

MarcBrueck/time_tracking

Repository files navigation

Time Tracking Server

This repository contains a little demonstration. It contains an api-server that handles employee working time data. To run this you need python>=3.13

Installation

First clone the repo

git clone https://github.com/MarcBrueck/time_tracking.git

If you dont have uv installed, you can install it using pip:

pip install uv

Then create a virtual environment and install the dependencies using uv.

uv sync

Then activate the virtual environment:

source .venv/bin/activate

Create a .env file for storing the env variables outside of git

touch .env

and then add the necessary env variables, here we only need the database connection. Here I decided to use sqlite, because it is the easiest to set up, It can be easily switched to a any of the rdbms like postgres, since we are using sqlalchemy.

CONNECTION_STRING="sqlite:///time_tracking.db"

Running the application

You can run the api server using:

uvicorn time_tracking.main:app --host 127.0.0.1 --port 8000

Then you can see the swagger UI listing the api documentation here:

http://127.0.0.1:8000/docs

There you can see all the endpoints and paths for example

curl -X 'GET' \
  'http://127.0.0.1:8000/employees/' \
  -H 'accept: application/json'

to fetch all employee data

There is also a script that fills the database with some random data:

python scripts/fill_database.py

Run the application using Docker

First build the image

docker build -t time_tracking:v1 .

and then run it

docker run -p 8000:8000 -e CONNECTION_STRING="sqlite:///time_tracking.db" time_tracking:v1

Run the unittests

pytest

About

This repository contains a little demonstration. It contains an api-server that handles employee working time data.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published