# allredlib
Allredlib
# local dev
## Reset DB
migrate migrate-down --files <git dir path>/allredlib/migrations --connection '<path to db>/.allredlib.db'
migrate migrate-up --files <git dir path>/allredlib/migrations --connection '<path to db>/.allredlib.db'
UPDATE schema_migrations set dirty=false;
## Run application server
```sh
pushd webapp
bun i
bun run build-static
popd
go run cmd/server/main.go cmd/server/static.go
```
## Create user
curl -X POST -d '{"username": "nn", "password": "password"}' http://localhost:8080/api/v1/user/signup
curl -X POST -d '{"username": "nn", "password": "password"}' http://localhost:8080/api/v1/user/login
curl --cookie "$ALLREDLIB_COOKIE" http://localhost:8080/api/v1/user/whoami
### Promote user to admin (assuming roles are the same as in the migrations)
```bash
sqlite3 ~/.allredlib.db "INSERT INTO users_role (users_id, role_id, grantor_id) VALUES (1, (SELECT id FROM role WHERE role='SERVER_ADMIN'), 1);"
```
## Create a GUI admin through the application server
TBD
## Update graphql schema
go run github.com/99designs/gqlgen generate