Skip to content

vektorprogrammet/vektor-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vektor-backend

Set up development environment

Requirements:

Recommended:

PHP dependencies

  • php8.2-zip
  • php8.2-gd
  • php8.2-sqlite3
  • php8.2-xml
  • php8.2-mbstring
  • php8.2-intl

Setup:

Docker:

Build docker image yarn docker:build

Set up docker image yarn docker:setup

Run commands in docker image: yarn docker:run <CMD>

UNIX:

yarn setup

Start server on http://localhost:8000

yarn start

Alternatively

symfony serve -port 8000 (requires Symfony CLI)

Start server on Docker

yarn docker:run

Build static files

When adding new images or other non-code files, you can run:

yarn build

so that the files are put in the correct places. (this is automatically done when doing yarn start)

Users

Position Username Password Role
Assistent assistent 1234 ROLE_USER
Teammedlem teammember 1234 ROLE_TEAM_MEMBER
Teamleder teamleader 1234 ROLE_TEAM_LEADER
Admin admin 1234 ROLE_ADMIN

Database

Add new entities to the database and reload fixtures

yarn db:update

Dev:

Load db-schema: php bin/console doctrine:schema:update --force --complete

Load fixtures: php bin/console doctrine:fixtures:load

Code Style: PHP-CS-Fixer

Install:

mkdir -p tools/php-cs-fixer
composer require --working-dir=tools/php-cs-fixer friendsofphp/php-cs-fixer --dev

Then Run: tools/php-cs-fixer/vendor/bin/php-cs-fixer fix src

Tests

Run all tests:
php bin/phpunit

Run individual test:
php bin/phpunit "path/to/test/TestName.php"

API

To generate SSL keys:
php bin/console lexik:jwt:generate-keypair

To get JWT token:
curl -X POST -H "Content-Type: application/json" http://localhost:8000/api/login -d '{"username":"<username>","password":"<password>"}'

Pass the token in subsequent api calls. Example shown using Postman: image

Api docs:

https://localhost:8000/api/doc.json