Skip to content

itk-dev/dokk1gh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dokk1-gæstehåndtering

Installation

docker compose up -d
docker compose exec phpfpm composer install

Set up database:

docker compose exec phpfpm bin/console doctrine:migrations:migrate --no-interaction

Create super administrator:

docker compose exec phpfpm bin/console user:create super-admin@example.com
docker compose exec phpfpm bin/console user:promote super-admin@example.com ROLE_SUPER_ADMIN
docker compose exec phpfpm bin/console user:set-password super-admin@example.com

Create administrator:

docker compose exec phpfpm bin/console user:create admin@example.com
docker compose exec phpfpm bin/console user:promote admin@example.com ROLE_ADMIN

Create user:

docker compose exec phpfpm bin/console user:create user user@example.com

Open the site:

open "http://$(docker compose port nginx 8080)"

Build assets

docker compose run --rm node yarn install
docker compose run --rm node yarn build

During development, use

docker-compose run node yarn watch

to watch for changes.

Cron jobs

The app:aeos:code-cleanup console command can be used to delete expires codes:

bin/console app:aeos:code-cleanup --help

A couple of commands can clean up guest and apps

bin/console app:expire-guests
bin/console app:expire-inactive-apps --app-sent-before='-24 hours'

Set up a cron job to have expired codes deleted daily at 02:00 (adjust paths to match your actual setup):

0 2 * * * /usr/bin/php /home/www/dokk1gh/htdocs/bin/console --env=prod app:aeos:code-cleanup

API

API documentation:

open "http://$(docker compose port nginx 8080)/api/doc"

Using an apikey, users can get a list of available templates:

curl "http://$(docker compose port nginx 8080)/api/templates?apikey=apikey"

Get list of codes created by user:

curl "http://$(docker compose port nginx 8080)/api/codes?apikey=apikey"

An administrator can get all codes by adding all=1:

curl "http://$(docker compose port nginx 8080)/api/codes?apikey=apikey&all=1"

Create a code:

curl --silent "http://$(docker compose port nginx 8080)/api/codes?apikey=apikey" --header "content-type: application/json" --data @- <<'JSON'
{
    "template": 1,
    "startTime": "2017-08-14T08:00:00+02:00",
    "endTime": "2017-08-14T16:00:00+02:00"
}
JSON

On success the result will look like this:

{
   "status" : "ok",
   "code" : "21347994",
   "endTime" : "2017-08-14T16:00:00+0200",
   "startTime" : "2017-08-14T08:00:00+0200",
   "template" : {
      "name" : "G<E6>st ITK",
      "id" : 1
   }
}

Test and debugging

Emails

Debug email sent to user when created:

bin/console app:debug notify-user-created [user email]

e.g.

bin/console app:debug notify-user-created user@example.com

Mocks

bin/console doctrine:schema:update --em=mocks --force

Mock AEOS web service

parameters.yml:

aoes_location: 'http://nginx/mock/aeosws'
aoes_username: null
aoes_password: null

Mock SMS gateway

sms_gateway_location: 'http://nginx/mock/sms
sms_gateway_username: null
sms_gateway_password: null

Acceptance tests

Clear out the acceptance test cache and set up the database:

SYMFONY_ENV=acceptance bin/console cache:clear --no-warmup
SYMFONY_ENV=acceptance bin/console cache:warmup
SYMFONY_ENV=acceptance bin/console doctrine:database:create

Run API tests:

./vendor/bin/behat

Coding standards

PHP

Check code:

docker compose exec phpfpm composer coding-standards-check

Apply coding standards:

docker compose exec phpfpm composer coding-standards-apply

Twig (experimental)

docker compose exec phpfpm composer coding-standards-check/twigcs

Markdown

docker compose run --rm node yarn coding-standards-check

Git hooks

Run

docker compose exec phpfpm composer install-git-hooks

to install a Git pre-commit hook that check coding standards before a commit.