https://github.com/ushurbakiyevdavlat/todoyii-optimistick-locking-app
Optimistic locking solution on YII2
https://github.com/ushurbakiyevdavlat/todoyii-optimistick-locking-app
docker docker-compose optimistic-locking php yii2
Last synced: 4 months ago
JSON representation
Optimistic locking solution on YII2
- Host: GitHub
- URL: https://github.com/ushurbakiyevdavlat/todoyii-optimistick-locking-app
- Owner: UshurbakiyevDavlat
- License: bsd-3-clause
- Created: 2023-04-02T03:31:16.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-02T14:55:44.000Z (about 2 years ago)
- Last Synced: 2024-11-23T03:15:12.296Z (6 months ago)
- Topics: docker, docker-compose, optimistic-locking, php, yii2
- Language: PHP
- Homepage:
- Size: 78.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
DIRECTORY STRUCTURE
-------------------assets/ contains assets definition
commands/ contains console commands (controllers)
config/ contains application configurations
controllers/ contains Web controller classes
services/ contains Service layer classes
mail/ contains view files for e-mails
models/ contains model classes
runtime/ contains files generated during runtime
tests/ contains various tests for the basic application
vendor/ contains dependent 3rd-party packages
views/ contains view files for the Web application
web/ contains the entry script and Web resourcesREQUIREMENTS
------------
The minimum requirements for this application that you have Docker and docker-composeINSTALLATION
------------
~~~
### Install with DockerIf you do not have vendor folder, run docker exec {container of application name} ` composer install` to install all dependencies.
Start the containerdocker-compose up -d
You can then access the application through the following URL:http://127.0.0.1:8000 or http://localhost:8000
**NOTES:**
- Minimum required Docker engine version `17.04` for development (see [Performance tuning for volume mounts](https://docs.docker.com/docker-for-mac/osxfs-caching/))
- The default configuration uses a host-volume in your home directory `.docker-composer` for composer caches
~~~
CONFIGURATION
-------------### Database
Edit the file `config/db.php` with real data, for example:
```php
return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=db;dbname=todo',
'username' => 'davlat',
'password' => 'qwe1234',
'charset' => 'utf8',
];````
### Notes
~~~
- I used `Yii2` framework for this project
- I used `Docker` for this project
- I used `Docker-compose` for this project
- I used `Codeception` for this project
- I used `MySQL` for this project
- I used `Nginx` for this project
- I used `PHP 7.4` for this project
- Container of application name for my docker container is todo-app_php_1, yours you can check with docker ps command
~~~TESTING
-------
- `unit`Tests can be executed by running
```
docker exec {container of application name} vendor/bin/codecept run unit```
The command above will execute unit tests.
Unit tests are testing the system components# Endpoints
~~~
- http://localhost:8000/todo/create - Create todo
- http://localhost:8000/todo - For getting all todo items
- http://localhost:8000/todo/{id}/update - for updating todo item
- http://localhost:8000/todo/5 - for getting todo item by id
- PUT http://localhost:8000/todo-item/{id}/done - For marking todo item as done
- Content-type should be : application/json
- Body should be : {"done": true} or {"done": false}
~~~

В эндпоинте, нужно обязательно указать в хедерах X-CSRF-TOKEN, взять его можно из сессии в браузере или отправив гет запрос и взять из ответа.
