#!/usr/bin/env just --justfile

[group('help')]
[private]
default:
    @ just --list --list-heading $'justfile manual page:\n'

# show help
[group('help')]
help: default

# runs service
[group('run')]
run:
    @ uv run python manage.py runserver

style:
    just format
    just lint
    just mypy

check:
    just style
    just test
    just test-coverage

# lints codebase using golangci-lint
[group('lint')]
lint:
    @ uv run ruff check .

# lints and fixes codebase using ruff
[group('lint')]
fix:
    @ uv run ruff check . --fix

# formats codebase using ruff
[group('lint')]
format:
    @ uv run ruff format .

alias fmt := format

# lints codebase using mypy
[group('lint')]
mypy:
    @ uv run mypy .

# run tests
[group('test')]
test:
    @ uv run python manage.py test

# run tests with coverage report
[group('test')]
test-coverage:
    @ uv run coverage run --source="." manage.py test

# generates migrations
[group('generate')]
generate-migrations:
    @ uv run python manage.py makemigrations

# applies migrations
[group('generate')]
apply-migrations:
    @ uv run python manage.py migrate

alias m := apply-migrations
