1. API
1.1. Self.Dokumentation
Documentation switches to: https://github.com/BLUE-SAFETY/common-docu
Domain: https://docs.bluesafety.dev
1.1.1. Scribe
1.1.2. Scramble
1.1.3. Scalar
https://github.com/scalar/scalar
https://github.com/scalar/laravel
1.1.4. Postman
1.2. Laravel Guzzle (http-request)
https://laravel.com/docs/master/eloquent-resources -> js: https://axios-http.com/docs/api_intro
https://api.laravel.com/docs/master
1.3. OData
https://github.com/saintsystems/odata-client-php/wiki/Example-Calls#usage-examples
1.4. cURL
1.4.1. get Token
To log in with the registered user:
curl -X POST https://common.api/api/v1/login \
-H 'Content-Type: application/json' \
-d '{
"email": "johndoe@example.com",
"password": "password"
}'
This will return another access token:
{
"access_token": "1|eyJ...your_new_access_token_here",
"token_type": "Bearer"
}
1.4.2. use Token for request
curl -X POST https://common.api/api/v1/logout \
-H 'Authorization: Bearer <your_access_token_here>'
2. TODOs
2.1. API
make Resources
php artisan make:resource ProductResource
and Controllers
php artisan make:controller ProductsController -r
is Done for MFR
2.2. mfr
- make other Controller from CompanyController
change edit() after weclapp-Sync is done
public function edit(Companies $company, $mfrData)
{
if (($mfrData->DateModified > $company->updated_at)) {
$this->update(new Request($mfrData->toArray()), $company);
/**TODO
* Update Call to Weclapp-Client()
*/
dd(
'Company::',
$mfrData->DateOfCreation,$mfrData->DateModified,
$company->created_at,$company->updated_at,
$company, $mfrData
);
}elseif(($company->updated_at != $company->created_at) && ($mfrData->DateModified < $company->updated_at)){
/**DONE
* Update Call to MFR-Client()
*/
$result = $this->guzzle->mfr->put($this->entity.'('.$company->MfrId.'L)', $body);
dd(
'mfrData::',
$company->created_at,$company->updated_at,
$mfrData, $company,
$result
);
}else{
dd('else / default');
}
}
2.2.1. abgleich über serviceRequest erstellen
- Steps
- Items
- Reports
-
- CC
2.3. weclapp
- make weclapp Service for Builder
- overthink weclapp-models for data in common-db
- weclapp-sync
- read Data from weclapp
- write Date into weclapp
- make merge with common-db
- make sync with mfr
- write weclapp listeners for better event-handle
2.3.1. add softDelete ?
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Companies extends Model
{
use SoftDeletes;
}
Schema::table('mfr_companies', function (Blueprint $table) {
$table->softDeletes();
});
Schema::table('mfr_companies', function (Blueprint $table) {
$table->dropSoftDeletes();
});
$company->delete();
$company->trashed();
$company->restore();
$company->forceDelete();