an authenticated user, should be able able to archive, unarchive and delete an existing user
an authenticated user, should not be able to archive/unarchive/delete himself
the api should return the users which are archived/unarchived based on a filter parameter
we do want to keep track when these operations happened and which user did it
after archive/unarchive/delete of a user we want to inform that user via email, push notifications and/or webhooks
conform to the https://jsonapi.org/ specs
bunlde install
rails s
This is our Lekker Rails-API 🚀
$ docker-compose up
Building api
Step 1/10 : FROM ruby:2.6.6-alpine
...
server --help` for more startup options
api_1 | Puma starting in single mode...
api_1 | * Puma version: 5.2.0 (ruby 2.6.6-p146) ("Fettisdagsbulle")
api_1 | * Min threads: 5
api_1 | * Max threads: 5
api_1 | * Environment: development
api_1 | * PID: 1
api_1 | * Listening on http://0.0.0.0:3189
api_1 | Use Ctrl-C to stop
use --build api
if you changed e.g. Gemfile
$ docker-compose up --build api
$ open http://localhost:3189
# or
$ curl http://localhost:3189
$ tail -f log/development.log
# or for specs:
$ tail -f log/test.log
$ docker-compose run api bundle exec rake db:prepare
Creating staffomatic_user_management_api_run ... done
Created database 'staffomatic_user_management_development'
Created database 'staffomatic_user_management_test'
$ docker-compose run api bundle exec rspec
if you see a migration error, you might need to run:
$ docker-compose run -e RAILS_ENV=test api bundle exec rake db:prepare
Stop the container(s):
$ docker-compose down
Delete all containers:
$ docker rm -f $(docker ps -a -q)
Delete all volumes:
$ docker volume rm staffomatic_user_management_db_data
# OR remove all
$ docker volume rm $(docker volume ls -q)
$ curl --request POST --header "Content-Type: application/json" \
http://localhost:3189/signup --data \
'{"data": {"attributes": {"email": "[email protected]", "password": "welcome", "password_confirmation": "welcome"}}}'
$ curl --request POST --header "Content-Type: application/json" \
http://localhost:3189/authentications --data \
'{"authentication": {"email": "[email protected]", "password": "welcome"}}'
$ curl --header \
"Authentication: Bearer JWT_TOKEN" \
--header "Content-Type: application/json" \
http://localhost:3189/users