Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abbasfisal/interviewcode_task
code challange for interview
https://github.com/abbasfisal/interviewcode_task
api laravel mongodb repository-pattern swagger-api tdd
Last synced: about 1 month ago
JSON representation
code challange for interview
- Host: GitHub
- URL: https://github.com/abbasfisal/interviewcode_task
- Owner: abbasfisal
- Created: 2024-02-01T07:52:39.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-01T15:08:55.000Z (about 1 year ago)
- Last Synced: 2024-11-07T23:29:50.268Z (3 months ago)
- Topics: api, laravel, mongodb, repository-pattern, swagger-api, tdd
- Language: PHP
- Homepage:
- Size: 205 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Interview Coding
### you must set replicaset for mongo db to support transaction
## set replica steps
### step 1
go to :`` nano /et/mongod.conf``
### step 2
#### add this line into it:
```.apacheconf
replication:
replSetName: "rs0"
```### step 3
#### then in terminal
```
mongosh
``````
rs.initiate();
```#### then can check status by this command (must be active)
``` rs.status()```
### step 4
#### then add replica option into your laravel database.php file
````
'mongodb' => [
'driver' => 'mongodb',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', 27017),
'database' => env('DB_DATABASE', 'interviewdb'),
'username' => env('DB_USERNAME'),
'password' => env('DB_PASSWORD'),
'options' => [
'replicaSet' => 'rs0',
'database' => 'admin'
],
]
````___
## seed database
``
php artisan migrate --seed
``___
## Access to Swagger Documentation
``
http://127.0.0.1:8000/api/documentation
``
___### :توجه داشته باشید که در فرایند ویرایش سفارش
```اگر محصولی که در سفارش ثبت شده مجدد ارسال نشود
آن محصول از لیست سفارش حذف شده و تعداد موجودی آن به انبار اضافه میشود
و اگر محصول جدید در ویرایش سفارش ارسال شود آن محصول به لیست محصولات آن سفارش اضافه میشود و موجودی از انبار کسر می گردد
چنانچه یک محصول در لیست محصولات یک سفارش موجود باشد و تعداد سفارش آن بیشتر از تعداد ثبت شده باشد تعداد اضافه شده از انبار کسر می گردد و چنانچه کمتر باشد به انبار اضافه می گردد
```