Доработка апи

pull/3/head
Rustem 2025-03-01 13:21:14 +05:00
parent bd6e96d132
commit 90320c5b61
3 changed files with 9 additions and 1 deletions

View File

@ -54,6 +54,7 @@ class Sync1cApiController extends Controller
'code' => $value['Код'],
],
[
'guid' => $value['СсылкаGUID'],
'name' => $value['Наименование'],
'type_id' => UniModel::model('pipi_auto_types', $segment->connector)
->firstOrCreate(['name' => $value['Тип']])->id,

View File

@ -6,7 +6,7 @@ enum AutoStatusEnums: string
{
case Free = 'free';
case Rent = 'Арендован';
case Service = 'Сервис';
case Service = 'В ремонте';
case Blocked = 'Забронирован';
case Waiting = 'waiting';
}

View File

@ -42,6 +42,7 @@ return new class extends \A7kz\Platform\Commands\InstallScript {
foreach ($data as $value) {
if ($value['ПометкаУдаления'] == 'Нет') {
$car = UniModel::model('pipi_auto', $segment->connector);
$car->guid = $value['СсылкаGUID'];
$car->code = $value['Код'];
$car->name = $value['Наименование'];
$car->type_id = UniModel::model('pipi_auto_types', $segment->connector)
@ -132,6 +133,12 @@ return new class extends \A7kz\Platform\Commands\InstallScript {
$table->foreign('owner_id')->references('id')->on('pipi_owners');
});
}
if (!Schema::connection($segment->connector)->hasColumn('pipi_auto', 'guid')) {
Schema::connection($segment->connector)->table('pipi_auto', static function (Blueprint $table) {
$table->string('guid')->unique()->nullable();
});
}
}
}