* [x] Adds a ServiceRequest model for all service types
* [x] Pre-define simple service requests to begin with
* [x] Django admin for admins to handle requests
* [x] Notifications for Matrix
* [x] Moved Service Access to `services` app
* [x] Auto-create default service requests for new memberships
* [x] Most simple kinds of tests added
* [x] Fix issue in generating service requests (check for service access firstly)
* [ ] Channel and bot account
## Deployment
1. Create a bot account. Get an access token with:
```
curl -XPOST \
-d '{"type":"m.login.password", "user":"<userid>", "password":"<password>"}' \
"https://data.coop/_matrix/client/r0/login"
```
2. Create an admin room for admins. Add admins + bot. Copy the room ID.
3. Add new environment variables for the setup `MATRIX_ACCESS_TOKEN` and `MATRIX_SERVICE_REQUEST_ADMIN_ROOM`
Reviewed-on: https://git.data.coop/data.coop/membersystem/pulls/59
Co-authored-by: bbb <benjamin@overtag.dk>
Co-committed-by: bbb <benjamin@overtag.dk>
|
||
|---|---|---|
| requirements | ||
| src | ||
| tests | ||
| .dockerignore | ||
| .drone.yml | ||
| .env.example | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| docker-compose.yml | ||
| Dockerfile | ||
| entrypoint.sh | ||
| Justfile | ||
| pyproject.toml | ||
| README.md | ||
| requirements.txt | ||
| uv.lock | ||
data.coop member system
Development setup
There are two ways to set up the development environment.
- Using the Docker Compose setup provided in this repository.
- Using uv in your host OS.
Using Docker Compose
Working with the Docker Compose setup is made easy with the Justfile provided in the repository.
Requirements
- Docker
- docker compose plugin
- Just CLI (https://github.com/casey/just?tab=readme-ov-file#packages)
Setup
-
Setup .env file
An example .env file is provided in the repository. You can copy it to .env file using the following command:
cp .env.example .envThe default values in the .env file are suitable for the docker-compose setup.
-
Migrate
just manage migrate -
Run the development server
just run
Building and running other things
# Build the containers
just build
# Create a superuser
just manage createsuperuser
# Create Django migrations (after this, maybe you need to change file permissions in volume)
just manage makemigrations
Using uv
Requirements
- Python 3.12 or higher
- uv
- A running PostgreSQL server
Setup
-
Setup .env file
An example .env file is provided in the repository. You can copy it to .env file using the following command:
cp .env.example .envEdit the .env file and set the values for the environment variables, especially the database variables.
-
Run migrate
uv run src/manage.py migrate -
Run the development server
uv run src/manage.py runserver
Updating requirements
We use uv. That means we have a set of loosely defined dependencies in pyproject.toml and lock dependencies in uv.lock.
To generate uv.lock run:
# Build requirements.txt etc
uv lock
# Build Docker image with new Python requirements
just build
Important notes
- This project uses django-zen-queries, which will sometimes raise a
QueriesDisabledErrorin your templates. You can find a difference of opinion about that, but you can find a difference of opinion about many things, right? - If a linting error annoys you, please feel free to strike back by adding a
noqato the line that has displeased the linter and move on with life.