requests
This commit is contained in:
26
console/controllers/SwaggerController.php
Normal file
26
console/controllers/SwaggerController.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace console\controllers;
|
||||
|
||||
use OpenApi\Annotations\OpenApi;
|
||||
use yii\console\Controller;
|
||||
use Yii;
|
||||
use yii\console\ExitCode;
|
||||
use yii\helpers\Console;
|
||||
|
||||
|
||||
class SwaggerController extends Controller
|
||||
{
|
||||
|
||||
public function actionGo()
|
||||
{
|
||||
$openApi = \OpenApi\Generator::scan([Yii::getAlias("@frontend/modules/api")]);
|
||||
$file = Yii::getAlias('@frontend/web/api-doc/dist/swagger.yaml');
|
||||
$handle = fopen($file, 'wb');
|
||||
fwrite($handle, $openApi->toYaml());
|
||||
fclose($handle);
|
||||
echo $this->ansiFormat('Created \n", Console::FG_BLUE');
|
||||
return ExitCode::OK;
|
||||
}
|
||||
|
||||
}
|
37
console/migrations/m230329_211037_create_request_table.php
Normal file
37
console/migrations/m230329_211037_create_request_table.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Handles the creation of table `{{%request}}`.
|
||||
*/
|
||||
class m230329_211037_create_request_table extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->createTable('{{%request}}', [
|
||||
'id' => $this->primaryKey(),
|
||||
'created_at' => $this->dateTime(),
|
||||
'updated_at' => $this->dateTime(),
|
||||
'user_id' => $this->integer(11)->notNull(),
|
||||
'title' => $this->string(255)->notNull(),
|
||||
'position_id' => $this->integer(11),
|
||||
'skill_ids' => $this->string(255),
|
||||
'knowledge_level_id' => $this->integer(11),
|
||||
'descr' => $this->text(),
|
||||
'specialist_count' => $this->integer(2),
|
||||
'status' => $this->integer(1)->defaultValue(0)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->dropTable('{{%request}}');
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Handles the creation of table `{{%knowledge_level}}`.
|
||||
*/
|
||||
class m230329_212545_create_knowledge_level_table extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->createTable('{{%knowledge_level}}', [
|
||||
'id' => $this->primaryKey(),
|
||||
'title' => $this->string(255)->notNull(),
|
||||
'status' => $this->integer(1)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->dropTable('{{%knowledge_level}}');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user