api
This commit is contained in:
parent
17df2ce6a9
commit
fc1da2c238
9
backend/modules/api/views/categoty/index.php
Normal file
9
backend/modules/api/views/categoty/index.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
/** @var yii\web\View $this */
|
||||
?>
|
||||
<h1>category/index</h1>
|
||||
|
||||
<p>
|
||||
You may change the content of this page by modifying
|
||||
the file <code><?= __FILE__; ?></code>.
|
||||
</p>
|
22
common/behaviors/GsCors.php
Executable file
22
common/behaviors/GsCors.php
Executable file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace common\behaviors;
|
||||
|
||||
|
||||
use yii\filters\Cors;
|
||||
|
||||
class GsCors extends Cors
|
||||
{
|
||||
|
||||
public function prepareHeaders($requestHeaders){
|
||||
$responseHeaders = parent::prepareHeaders($requestHeaders);
|
||||
|
||||
if (isset($this->cors['Access-Control-Allow-Headers'])) {
|
||||
$responseHeaders['Access-Control-Allow-Headers'] = implode(', ', $this->cors['Access-Control-Allow-Headers']);
|
||||
}
|
||||
|
||||
return $responseHeaders;
|
||||
}
|
||||
|
||||
}
|
@ -15,6 +15,7 @@ use function Symfony\Component\String\s;
|
||||
* @property int|null $type
|
||||
* @property int|null $price
|
||||
* @property int|null $status
|
||||
* @property int $product_category_id
|
||||
*
|
||||
* @property Company $company
|
||||
*/
|
||||
@ -51,7 +52,7 @@ class Product extends \yii\db\ActiveRecord
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function tableName()
|
||||
public static function tableName(): string
|
||||
{
|
||||
return 'product';
|
||||
}
|
||||
@ -59,11 +60,11 @@ class Product extends \yii\db\ActiveRecord
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
[['title', 'article', 'company_id'], 'required'],
|
||||
[['company_id', 'type', 'price', 'status'], 'integer'],
|
||||
[['title', 'article', 'company_id', 'product_category_id'], 'required'],
|
||||
[['company_id', 'type', 'price', 'status', 'product_category_id'], 'integer'],
|
||||
[['title', 'article'], 'string', 'max' => 255],
|
||||
[['company_id'], 'exist', 'skipOnError' => true, 'targetClass' => Company::class, 'targetAttribute' => ['company_id' => 'id']],
|
||||
];
|
||||
@ -72,7 +73,7 @@ class Product extends \yii\db\ActiveRecord
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function attributeLabels()
|
||||
public function attributeLabels(): array
|
||||
{
|
||||
return [
|
||||
'id' => 'ID',
|
||||
@ -82,6 +83,7 @@ class Product extends \yii\db\ActiveRecord
|
||||
'type' => 'Тип',
|
||||
'price' => 'Цена',
|
||||
'status' => 'Статус',
|
||||
'product_category_id' => 'Категория',
|
||||
];
|
||||
}
|
||||
|
||||
@ -90,8 +92,16 @@ class Product extends \yii\db\ActiveRecord
|
||||
*
|
||||
* @return \yii\db\ActiveQuery
|
||||
*/
|
||||
public function getCompany()
|
||||
public function getCompany(): \yii\db\ActiveQuery
|
||||
{
|
||||
return $this->hasOne(Company::class, ['id' => 'company_id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \yii\db\ActiveQuery
|
||||
*/
|
||||
public function getProductCategory(): \yii\db\ActiveQuery
|
||||
{
|
||||
return $this->hasOne(ProductCategory::class, ['id' => 'product_category_id']);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace common\services;
|
||||
|
||||
use common\models\Company;
|
||||
use common\models\ProductCategory;
|
||||
use Yii;
|
||||
use yii\helpers\ArrayHelper;
|
||||
|
||||
@ -61,4 +62,14 @@ class CompanyService
|
||||
return ArrayHelper::map($this->getAddressesByUser($id), 'id', 'address');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function getCategoryByCompanyId(int $id): array
|
||||
{
|
||||
return ProductCategory::find()->where(['company_id' => $id])->all();
|
||||
}
|
||||
|
||||
|
||||
}
|
30
common/services/ProductService.php
Normal file
30
common/services/ProductService.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace common\services;
|
||||
|
||||
use common\models\Product;
|
||||
|
||||
class ProductService
|
||||
{
|
||||
|
||||
public Product $model;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new Product();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $company_id
|
||||
* @param int|null $category_id
|
||||
* @return array
|
||||
*/
|
||||
public function findBy(int $company_id, int $category_id = null): array
|
||||
{
|
||||
return $this->model->find()->where(['company_id' => $company_id])
|
||||
->andWhere(['status' => Product::STATUS_ACTIVE])
|
||||
->andFilterWhere(['product_category_id' => $category_id])
|
||||
->all();
|
||||
}
|
||||
|
||||
}
|
@ -18,7 +18,9 @@
|
||||
"yiisoft/yii2": "~2.0.45",
|
||||
"yiisoft/yii2-bootstrap5": "~2.0.2",
|
||||
"yiisoft/yii2-symfonymailer": "~2.0.3",
|
||||
"hail812/yii2-adminlte3": "~1.1"
|
||||
"hail812/yii2-adminlte3": "~1.1",
|
||||
"zircote/swagger-php": "^4.9",
|
||||
"doctrine/annotations": "^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"yiisoft/yii2-debug": "~2.1.0",
|
||||
|
644
composer.lock
generated
644
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "825cc56cf0c423874be51a9d82a526fe",
|
||||
"content-hash": "ee2265371cea7b99aa6147cb7830ae18",
|
||||
"packages": [
|
||||
{
|
||||
"name": "almasaeed2010/adminlte",
|
||||
@ -203,6 +203,82 @@
|
||||
},
|
||||
"time": "2018-03-26T11:24:36+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/annotations",
|
||||
"version": "2.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/annotations.git",
|
||||
"reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/annotations/zipball/e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f",
|
||||
"reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/lexer": "^2 || ^3",
|
||||
"ext-tokenizer": "*",
|
||||
"php": "^7.2 || ^8.0",
|
||||
"psr/cache": "^1 || ^2 || ^3"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/cache": "^2.0",
|
||||
"doctrine/coding-standard": "^10",
|
||||
"phpstan/phpstan": "^1.8.0",
|
||||
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
|
||||
"symfony/cache": "^5.4 || ^6",
|
||||
"vimeo/psalm": "^4.10"
|
||||
},
|
||||
"suggest": {
|
||||
"php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Guilherme Blanco",
|
||||
"email": "guilhermeblanco@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Roman Borschel",
|
||||
"email": "roman@code-factory.org"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Eberlei",
|
||||
"email": "kontakt@beberlei.de"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Wage",
|
||||
"email": "jonwage@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Johannes Schmitt",
|
||||
"email": "schmittjoh@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Docblock Annotations Parser",
|
||||
"homepage": "https://www.doctrine-project.org/projects/annotations.html",
|
||||
"keywords": [
|
||||
"annotations",
|
||||
"docblock",
|
||||
"parser"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/doctrine/annotations/issues",
|
||||
"source": "https://github.com/doctrine/annotations/tree/2.0.1"
|
||||
},
|
||||
"time": "2023-02-02T22:02:53+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/lexer",
|
||||
"version": "3.0.0",
|
||||
@ -564,6 +640,55 @@
|
||||
},
|
||||
"time": "2020-10-15T08:29:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/cache",
|
||||
"version": "3.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/cache.git",
|
||||
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
|
||||
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.0.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Cache\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "https://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for caching libraries",
|
||||
"keywords": [
|
||||
"cache",
|
||||
"psr",
|
||||
"psr-6"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/php-fig/cache/tree/3.0.0"
|
||||
},
|
||||
"time": "2021-02-03T23:26:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
"version": "2.0.2",
|
||||
@ -940,6 +1065,70 @@
|
||||
],
|
||||
"time": "2023-05-23T14:45:45+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
"version": "v6.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/finder.git",
|
||||
"reference": "11d736e97f116ac375a81f96e662911a34cd50ce"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/11d736e97f116ac375a81f96e662911a34cd50ce",
|
||||
"reference": "11d736e97f116ac375a81f96e662911a34cd50ce",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/filesystem": "^6.0|^7.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Finder\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Finds files and directories via an intuitive fluent interface",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/finder/tree/v6.4.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-10-31T17:30:12+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/mailer",
|
||||
"version": "v6.4.0",
|
||||
@ -1104,6 +1293,88 @@
|
||||
],
|
||||
"time": "2023-10-17T11:49:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.28.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb",
|
||||
"reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1"
|
||||
},
|
||||
"provide": {
|
||||
"ext-ctype": "*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-ctype": "For best performance"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.28-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Ctype\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Gert de Pagter",
|
||||
"email": "BackEndTea@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for ctype functions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"ctype",
|
||||
"polyfill",
|
||||
"portable"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-01-26T09:26:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-idn",
|
||||
"version": "v1.28.0",
|
||||
@ -1516,6 +1787,78 @@
|
||||
],
|
||||
"time": "2023-07-30T20:28:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v6.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/yaml.git",
|
||||
"reference": "4f9237a1bb42455d609e6687d2613dde5b41a587"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/4f9237a1bb42455d609e6687d2613dde5b41a587",
|
||||
"reference": "4f9237a1bb42455d609e6687d2613dde5b41a587",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"symfony/deprecation-contracts": "^2.5|^3",
|
||||
"symfony/polyfill-ctype": "^1.8"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/console": "<5.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/console": "^5.4|^6.0|^7.0"
|
||||
},
|
||||
"bin": [
|
||||
"Resources/bin/yaml-lint"
|
||||
],
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Yaml\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Loads and dumps YAML files",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/yaml/tree/v6.4.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-11-06T11:00:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "yiisoft/yii2",
|
||||
"version": "2.0.49.3",
|
||||
@ -1969,6 +2312,87 @@
|
||||
}
|
||||
],
|
||||
"time": "2022-09-04T10:48:21+00:00"
|
||||
},
|
||||
{
|
||||
"name": "zircote/swagger-php",
|
||||
"version": "4.9.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zircote/swagger-php.git",
|
||||
"reference": "256d42cb07ba1c2206d66bc7516ee3d3e3e9f0b2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zircote/swagger-php/zipball/256d42cb07ba1c2206d66bc7516ee3d3e3e9f0b2",
|
||||
"reference": "256d42cb07ba1c2206d66bc7516ee3d3e3e9f0b2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"php": ">=7.2",
|
||||
"psr/log": "^1.1 || ^2.0 || ^3.0",
|
||||
"symfony/deprecation-contracts": "^2 || ^3",
|
||||
"symfony/finder": ">=2.2",
|
||||
"symfony/yaml": ">=3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/package-versions-deprecated": "^1.11",
|
||||
"doctrine/annotations": "^1.7 || ^2.0",
|
||||
"friendsofphp/php-cs-fixer": "^2.17 || ^3.47.1",
|
||||
"phpstan/phpstan": "^1.6",
|
||||
"phpunit/phpunit": ">=8",
|
||||
"vimeo/psalm": "^4.23"
|
||||
},
|
||||
"suggest": {
|
||||
"doctrine/annotations": "^1.7 || ^2.0"
|
||||
},
|
||||
"bin": [
|
||||
"bin/openapi"
|
||||
],
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"OpenApi\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"Apache-2.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Robert Allen",
|
||||
"email": "zircote@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Bob Fanger",
|
||||
"email": "bfanger@gmail.com",
|
||||
"homepage": "https://bfanger.nl"
|
||||
},
|
||||
{
|
||||
"name": "Martin Rademacher",
|
||||
"email": "mano@radebatz.net",
|
||||
"homepage": "https://radebatz.net"
|
||||
}
|
||||
],
|
||||
"description": "swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations",
|
||||
"homepage": "https://github.com/zircote/swagger-php/",
|
||||
"keywords": [
|
||||
"api",
|
||||
"json",
|
||||
"rest",
|
||||
"service discovery"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/zircote/swagger-php/issues",
|
||||
"source": "https://github.com/zircote/swagger-php/tree/4.9.2"
|
||||
},
|
||||
"time": "2024-05-02T21:36:00+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
@ -5074,152 +5498,6 @@
|
||||
],
|
||||
"time": "2023-11-20T16:41:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
"version": "v6.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/finder.git",
|
||||
"reference": "11d736e97f116ac375a81f96e662911a34cd50ce"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/11d736e97f116ac375a81f96e662911a34cd50ce",
|
||||
"reference": "11d736e97f116ac375a81f96e662911a34cd50ce",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/filesystem": "^6.0|^7.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Finder\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Finds files and directories via an intuitive fluent interface",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/finder/tree/v6.4.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-10-31T17:30:12+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.28.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb",
|
||||
"reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1"
|
||||
},
|
||||
"provide": {
|
||||
"ext-ctype": "*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-ctype": "For best performance"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.28-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Ctype\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Gert de Pagter",
|
||||
"email": "BackEndTea@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for ctype functions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"ctype",
|
||||
"polyfill",
|
||||
"portable"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-01-26T09:26:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-grapheme",
|
||||
"version": "v1.28.0",
|
||||
@ -5472,78 +5750,6 @@
|
||||
],
|
||||
"time": "2023-11-09T08:28:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v6.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/yaml.git",
|
||||
"reference": "4f9237a1bb42455d609e6687d2613dde5b41a587"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/4f9237a1bb42455d609e6687d2613dde5b41a587",
|
||||
"reference": "4f9237a1bb42455d609e6687d2613dde5b41a587",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"symfony/deprecation-contracts": "^2.5|^3",
|
||||
"symfony/polyfill-ctype": "^1.8"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/console": "<5.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/console": "^5.4|^6.0|^7.0"
|
||||
},
|
||||
"bin": [
|
||||
"Resources/bin/yaml-lint"
|
||||
],
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Yaml\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Loads and dumps YAML files",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/yaml/tree/v6.4.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-11-06T11:00:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "theseer/tokenizer",
|
||||
"version": "1.2.2",
|
||||
|
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;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Class m240507_141733_add_category_id_column_at_product_table
|
||||
*/
|
||||
class m240507_141733_add_category_id_column_at_product_table extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->addColumn('product', 'product_category_id', $this->integer(11)->defaultValue(0)->notNull());
|
||||
|
||||
$this->createIndex('idx-product-product_category_id', 'product', 'product_category_id');
|
||||
|
||||
$this->addForeignKey(
|
||||
'fk-product-product_category_id',
|
||||
'product',
|
||||
'product_category_id',
|
||||
'product_category',
|
||||
'id',
|
||||
'CASCADE'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->dropForeignKey(
|
||||
'fk-product-product_category_id',
|
||||
'product'
|
||||
);
|
||||
|
||||
// drops index for column `author_id`
|
||||
$this->dropIndex(
|
||||
'idx-product-product_category_id',
|
||||
'product'
|
||||
);
|
||||
|
||||
$this->dropColumn('product', 'product_category_id');
|
||||
}
|
||||
|
||||
/*
|
||||
// Use up()/down() to run migration code without a transaction.
|
||||
public function up()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m240507_141733_add_category_id_column_at_product_table cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
}
|
@ -15,6 +15,7 @@ class AppAsset extends AssetBundle
|
||||
'css/site.css',
|
||||
];
|
||||
public $js = [
|
||||
'js/company_select.js'
|
||||
];
|
||||
public $depends = [
|
||||
'yii\web\YiiAsset',
|
||||
|
16
frontend/assets/MainAsset.php
Normal file
16
frontend/assets/MainAsset.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\assets;
|
||||
|
||||
class MainAsset extends \yii\web\AssetBundle
|
||||
{
|
||||
|
||||
public $basePath = '@webroot';
|
||||
public $baseUrl = '@web';
|
||||
public $css = [];
|
||||
public $js = [
|
||||
'js/company_select.js'
|
||||
];
|
||||
public $depends = [];
|
||||
|
||||
}
|
@ -27,6 +27,9 @@ return [
|
||||
'product_category' => [
|
||||
'class' => 'frontend\modules\product_category\ProductCategory',
|
||||
],
|
||||
'api' => [
|
||||
'class' => 'frontend\modules\api\Api',
|
||||
],
|
||||
],
|
||||
'components' => [
|
||||
'request' => [
|
||||
|
24
frontend/modules/api/Api.php
Normal file
24
frontend/modules/api/Api.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\modules\api;
|
||||
|
||||
/**
|
||||
* api module definition class
|
||||
*/
|
||||
class Api extends \yii\base\Module
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $controllerNamespace = 'frontend\modules\api\controllers';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
// custom initialization code goes here
|
||||
}
|
||||
}
|
80
frontend/modules/api/controllers/ApiController.php
Normal file
80
frontend/modules/api/controllers/ApiController.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\modules\api\controllers;
|
||||
|
||||
use common\behaviors\GsCors;
|
||||
use yii\filters\auth\CompositeAuth;
|
||||
use yii\filters\auth\HttpBearerAuth;
|
||||
use yii\filters\ContentNegotiator;
|
||||
use yii\rest\Controller;
|
||||
use yii\web\Response;
|
||||
|
||||
|
||||
/**
|
||||
* @OA\Info(
|
||||
* version="1.0.0",
|
||||
* title="Документация Сервис для создания чеков",
|
||||
* description="Документация для работы с API",
|
||||
*
|
||||
* ),
|
||||
* @OA\PathItem(
|
||||
* path="/api"
|
||||
* ),
|
||||
* @OA\Server(
|
||||
* url="https://check.itguild.info/api",
|
||||
* description="Основной сервер",
|
||||
* ),
|
||||
*
|
||||
* @OA\Server(
|
||||
* url="http://check-back.loc/api",
|
||||
* description="Локальный сервер",
|
||||
* ),
|
||||
*
|
||||
* @OA\SecurityScheme(
|
||||
* securityScheme="bearerAuth",
|
||||
* in="header",
|
||||
* name="Authorization",
|
||||
* type="http",
|
||||
* scheme="bearer",
|
||||
* bearerFormat="JWT",
|
||||
* ),
|
||||
*/
|
||||
class ApiController extends Controller
|
||||
{
|
||||
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
'corsFilter' => [
|
||||
'class' => GsCors::class,
|
||||
'cors' => [
|
||||
'Origin' => ['*'],
|
||||
//'Access-Control-Allow-Credentials' => true,
|
||||
'Access-Control-Allow-Headers' => [
|
||||
'Access-Control-Allow-Origin',
|
||||
'Access-Control-Allow-Methods',
|
||||
'Content-Type',
|
||||
'Access-Control-Allow-Headers',
|
||||
'Authorization',
|
||||
'X-Requested-With'
|
||||
],
|
||||
'Access-Control-Allow-Methods' => ['POST', 'GET', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'],
|
||||
'Access-Control-Request-Method' => ['POST', 'GET', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'],
|
||||
]
|
||||
],
|
||||
'authenticator' => [
|
||||
'class' => CompositeAuth::class,
|
||||
'authMethods' => [
|
||||
HttpBearerAuth::class,
|
||||
],
|
||||
],
|
||||
[
|
||||
'class' => ContentNegotiator::className(),
|
||||
'formats' => [
|
||||
'application/json' => Response::FORMAT_JSON,
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
82
frontend/modules/api/controllers/CategoryController.php
Normal file
82
frontend/modules/api/controllers/CategoryController.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\modules\api\controllers;
|
||||
|
||||
use common\classes\Debug;
|
||||
use common\services\CompanyService;
|
||||
|
||||
class CategoryController extends ApiController
|
||||
{
|
||||
public CompanyService $companyService;
|
||||
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
$this->companyService = new CompanyService();
|
||||
}
|
||||
|
||||
public function behaviors(): array
|
||||
{
|
||||
$behaviors = parent::behaviors();
|
||||
unset($behaviors['authenticator']);
|
||||
return $behaviors;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @OA\Get(path="/category",
|
||||
* summary="Список категорий компании",
|
||||
* description="Получить список всех категорий компании",
|
||||
* tags={"Category"},
|
||||
* @OA\Parameter(
|
||||
* name="company_id",
|
||||
* in="query",
|
||||
* required=true,
|
||||
* @OA\Schema(
|
||||
* type="integer",
|
||||
* default=null
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="Возвращает массив",
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* @OA\Property(
|
||||
* property="id",
|
||||
* type="integer",
|
||||
* example="1",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="title",
|
||||
* type="string",
|
||||
* example="Кальянный клуб LA",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="parent_id",
|
||||
* type="integer",
|
||||
* example="33",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="company_id",
|
||||
* type="integer",
|
||||
* example="23",
|
||||
* ),
|
||||
* )
|
||||
* ),
|
||||
* ),
|
||||
*
|
||||
* ),
|
||||
* )
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function actionIndex(int $company_id): array
|
||||
{
|
||||
return $this->companyService->getCategoryByCompanyId($company_id);
|
||||
}
|
||||
|
||||
}
|
20
frontend/modules/api/controllers/DefaultController.php
Normal file
20
frontend/modules/api/controllers/DefaultController.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\modules\api\controllers;
|
||||
|
||||
use yii\web\Controller;
|
||||
|
||||
/**
|
||||
* Default controller for the `api` module
|
||||
*/
|
||||
class DefaultController extends Controller
|
||||
{
|
||||
/**
|
||||
* Renders the index view for the module
|
||||
* @return string
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
return $this->render('index');
|
||||
}
|
||||
}
|
114
frontend/modules/api/controllers/ProductController.php
Normal file
114
frontend/modules/api/controllers/ProductController.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\modules\api\controllers;
|
||||
|
||||
use common\services\CompanyService;
|
||||
use common\services\ProductService;
|
||||
|
||||
class ProductController extends ApiController
|
||||
{
|
||||
|
||||
public CompanyService $companyService;
|
||||
public ProductService $productService;
|
||||
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
$this->companyService = new CompanyService();
|
||||
$this->productService = new ProductService();
|
||||
}
|
||||
|
||||
public function behaviors(): array
|
||||
{
|
||||
$behaviors = parent::behaviors();
|
||||
unset($behaviors['authenticator']);
|
||||
return $behaviors;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @OA\Get(path="/product",
|
||||
* summary="Список товаров компании",
|
||||
* description="Получить список всех товаров компании",
|
||||
* tags={"Product"},
|
||||
* @OA\Parameter(
|
||||
* name="company_id",
|
||||
* in="query",
|
||||
* required=true,
|
||||
* @OA\Schema(
|
||||
* type="integer",
|
||||
* default=null
|
||||
* )
|
||||
* ),
|
||||
* @OA\Parameter(
|
||||
* name="category_id",
|
||||
* in="query",
|
||||
* required=false,
|
||||
* @OA\Schema(
|
||||
* type="integer",
|
||||
* default=null
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="Возвращает массив",
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* @OA\Property(
|
||||
* property="id",
|
||||
* type="integer",
|
||||
* example="1",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="title",
|
||||
* type="string",
|
||||
* example="Кальянный клуб LA",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="article",
|
||||
* type="string",
|
||||
* example="005",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="type",
|
||||
* type="integer",
|
||||
* example="1",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="price",
|
||||
* type="integer",
|
||||
* example="250",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="status",
|
||||
* type="integer",
|
||||
* example="1",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="product_category_id",
|
||||
* type="integer",
|
||||
* example="5",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="company_id",
|
||||
* type="integer",
|
||||
* example="23",
|
||||
* ),
|
||||
* )
|
||||
* ),
|
||||
* ),
|
||||
*
|
||||
* ),
|
||||
* )
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function actionIndex(int $company_id, int $category_id = null): array
|
||||
{
|
||||
return $this->productService->findBy($company_id, $category_id);
|
||||
}
|
||||
|
||||
}
|
12
frontend/modules/api/views/default/index.php
Normal file
12
frontend/modules/api/views/default/index.php
Normal file
@ -0,0 +1,12 @@
|
||||
<div class="api-default-index">
|
||||
<h1><?= $this->context->action->uniqueId ?></h1>
|
||||
<p>
|
||||
This is the view content for action "<?= $this->context->action->id ?>".
|
||||
The action belongs to the controller "<?= get_class($this->context) ?>"
|
||||
in the "<?= $this->context->module->id ?>" module.
|
||||
</p>
|
||||
<p>
|
||||
You may customize this page by editing the following file:<br>
|
||||
<code><?= __FILE__ ?></code>
|
||||
</p>
|
||||
</div>
|
@ -14,10 +14,10 @@ class ProductSearch extends Product
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules()
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
[['id', 'company_id', 'type', 'price', 'status'], 'integer'],
|
||||
[['id', 'company_id', 'type', 'price', 'status', 'product_category_id'], 'integer'],
|
||||
[['title', 'article'], 'safe'],
|
||||
];
|
||||
}
|
||||
|
@ -17,7 +17,9 @@ use yii\bootstrap4\ActiveForm;
|
||||
|
||||
<?= $form->field($model, 'article')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'company_id')->dropDownList($companies) ?>
|
||||
<?= $form->field($model, 'company_id')->dropDownList($companies, ['id' => 'company_select']) ?>
|
||||
|
||||
<div class="form-group" id="category_select_container"></div>
|
||||
|
||||
<?= $form->field($model, 'type')->dropDownList(\common\models\Product::getType()) ?>
|
||||
|
||||
|
@ -40,6 +40,10 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'attribute' => 'company_id',
|
||||
'value' => $companyService->getCompany($model->company_id)->name ?? null
|
||||
],
|
||||
[
|
||||
'attribute' => 'product_category_id',
|
||||
'value' => $model->getProductCategory()->one()->title ?? null
|
||||
],
|
||||
[
|
||||
'attribute' => 'type',
|
||||
'value' => \common\models\Product::getType()[$model->type]
|
||||
|
@ -4,6 +4,7 @@ namespace frontend\modules\product_category\controllers;
|
||||
|
||||
use common\classes\Debug;
|
||||
use common\models\User;
|
||||
use common\services\CompanyService;
|
||||
use Yii;
|
||||
use frontend\modules\product_category\models\ProductCategory;
|
||||
use frontend\modules\product_category\models\ProductCategorySearch;
|
||||
@ -17,6 +18,14 @@ use yii\filters\VerbFilter;
|
||||
*/
|
||||
class ProductCategoryController extends Controller
|
||||
{
|
||||
public CompanyService $companyService;
|
||||
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
$this->companyService = new CompanyService();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@ -114,6 +123,16 @@ class ProductCategoryController extends Controller
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $company_id
|
||||
* @return string
|
||||
*/
|
||||
public function actionGetCategorySelectByCompanyId($company_id): string
|
||||
{
|
||||
$category = $this->companyService->getCategoryByCompanyId($company_id);
|
||||
return $this->renderAjax('_category_select', ['category' => $category]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the ProductCategory model based on its primary key value.
|
||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @var array $category
|
||||
*/
|
||||
echo \yii\helpers\Html::label("Категории", "product_category");
|
||||
echo \yii\helpers\Html::dropDownList(
|
||||
'Product[product_category_id]',
|
||||
null,
|
||||
\yii\helpers\ArrayHelper::map($category, 'id', 'title'),
|
||||
[
|
||||
'class' => 'form-control',
|
||||
'id' => 'product_category',
|
||||
]
|
||||
);
|
@ -18,8 +18,9 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<p>
|
||||
<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
|
||||
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'confirm' => 'Are you sure you want to delete this item?',
|
||||
|
@ -7,6 +7,7 @@ use yii\helpers\Html;
|
||||
|
||||
\hail812\adminlte3\assets\FontAwesomeAsset::register($this);
|
||||
\hail812\adminlte3\assets\AdminLteAsset::register($this);
|
||||
\frontend\assets\MainAsset::register($this);
|
||||
$this->registerCssFile('https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback');
|
||||
|
||||
$assetDir = Yii::$app->assetManager->getPublishedUrl('@vendor/almasaeed2010/adminlte/dist');
|
||||
|
1
frontend/web/api-doc/.agignore
Normal file
1
frontend/web/api-doc/.agignore
Normal file
@ -0,0 +1 @@
|
||||
dist/
|
25
frontend/web/api-doc/.commitlintrc.json
Normal file
25
frontend/web/api-doc/.commitlintrc.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"extends": [
|
||||
"@commitlint/config-conventional"
|
||||
],
|
||||
"rules": {
|
||||
"header-max-length": [
|
||||
2,
|
||||
"always",
|
||||
69
|
||||
],
|
||||
"scope-case": [
|
||||
2,
|
||||
"always",
|
||||
[
|
||||
"camel-case",
|
||||
"kebab-case",
|
||||
"upper-case"
|
||||
]
|
||||
],
|
||||
"subject-case": [
|
||||
0,
|
||||
"always"
|
||||
]
|
||||
}
|
||||
}
|
8
frontend/web/api-doc/.dockerignore
Normal file
8
frontend/web/api-doc/.dockerignore
Normal file
@ -0,0 +1,8 @@
|
||||
/.git
|
||||
/.github
|
||||
/dev-helpers
|
||||
/docs
|
||||
/src
|
||||
/swagger-ui-dist-package
|
||||
/test
|
||||
/node_modules
|
10
frontend/web/api-doc/.editorconfig
Normal file
10
frontend/web/api-doc/.editorconfig
Normal file
@ -0,0 +1,10 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
2
frontend/web/api-doc/.eslintignore
Normal file
2
frontend/web/api-doc/.eslintignore
Normal file
@ -0,0 +1,2 @@
|
||||
dist/
|
||||
node_modules/
|
40
frontend/web/api-doc/.eslintrc
Normal file
40
frontend/web/api-doc/.eslintrc
Normal file
@ -0,0 +1,40 @@
|
||||
parser: "@babel/eslint-parser"
|
||||
env:
|
||||
browser: true
|
||||
node: true
|
||||
es6: true
|
||||
jest: true
|
||||
jest/globals: true
|
||||
parserOptions:
|
||||
ecmaFeatures:
|
||||
jsx: true
|
||||
extends:
|
||||
- eslint:recommended
|
||||
- plugin:react/recommended
|
||||
plugins:
|
||||
- react
|
||||
- mocha
|
||||
- import
|
||||
- jest
|
||||
settings:
|
||||
react:
|
||||
pragma: React
|
||||
version: '15.0'
|
||||
rules:
|
||||
semi: [2, never]
|
||||
strict: 0
|
||||
quotes: [2, double, { allowTemplateLiterals: true }]
|
||||
no-unused-vars: 2
|
||||
no-multi-spaces: 1
|
||||
camelcase: 1
|
||||
no-use-before-define: [2, nofunc]
|
||||
no-underscore-dangle: 0
|
||||
no-unused-expressions: 1
|
||||
comma-dangle: 0
|
||||
no-console: [2, { allow: [warn, error] }]
|
||||
react/jsx-no-bind: 1
|
||||
react/jsx-no-target-blank: 2
|
||||
react/display-name: 0
|
||||
mocha/no-exclusive-tests: 2
|
||||
import/no-extraneous-dependencies: 2
|
||||
react/jsx-filename-extension: 2
|
1
frontend/web/api-doc/.gitattributes
vendored
Normal file
1
frontend/web/api-doc/.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
||||
docker-run.sh text eol=lf
|
73
frontend/web/api-doc/.github/ISSUE_TEMPLATE/Bug_report.md
vendored
Normal file
73
frontend/web/api-doc/.github/ISSUE_TEMPLATE/Bug_report.md
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Report an issue you're experiencing
|
||||
|
||||
---
|
||||
|
||||
<!---
|
||||
Thanks for filing a bug report! 😄
|
||||
|
||||
Before you submit, please read the following:
|
||||
|
||||
If you're here to report a security issue, please STOP writing an issue and
|
||||
contact us at security@swagger.io instead!
|
||||
|
||||
Search open/closed issues before submitting!
|
||||
|
||||
Issues on GitHub are only related to problems of Swagger-UI itself. We'll try
|
||||
to offer support here for your use case, but we can't offer help with projects
|
||||
that use Swagger-UI indirectly, like Springfox or swagger-node.
|
||||
|
||||
Likewise, we can't accept bugs in the Swagger/OpenAPI specifications
|
||||
themselves, or anything that violates the specifications.
|
||||
-->
|
||||
|
||||
### Q&A (please complete the following information)
|
||||
- OS: [e.g. macOS]
|
||||
- Browser: [e.g. chrome, safari]
|
||||
- Version: [e.g. 22]
|
||||
- Method of installation: [e.g. npm, dist assets]
|
||||
- Swagger-UI version: [e.g. 3.10.0]
|
||||
- Swagger/OpenAPI version: [e.g. Swagger 2.0, OpenAPI 3.0]
|
||||
|
||||
### Content & configuration
|
||||
<!--
|
||||
Provide us with a way to see what you're seeing,
|
||||
so that we can fix your issue.
|
||||
-->
|
||||
|
||||
Example Swagger/OpenAPI definition:
|
||||
```yaml
|
||||
# your YAML here
|
||||
```
|
||||
|
||||
Swagger-UI configuration options:
|
||||
```js
|
||||
SwaggerUI({
|
||||
// your config options here
|
||||
})
|
||||
```
|
||||
|
||||
```
|
||||
?yourQueryStringConfig
|
||||
```
|
||||
|
||||
### Describe the bug you're encountering
|
||||
<!-- A clear and concise description of what the bug is. -->
|
||||
|
||||
### To reproduce...
|
||||
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
### Expected behavior
|
||||
<!-- A clear and concise description of what you expected to happen. -->
|
||||
|
||||
### Screenshots
|
||||
<!-- If applicable, add screenshots to help explain your problem. -->
|
||||
|
||||
### Additional context or thoughts
|
||||
<!-- Add any other context about the problem here. -->
|
42
frontend/web/api-doc/.github/ISSUE_TEMPLATE/Feature_request.md
vendored
Normal file
42
frontend/web/api-doc/.github/ISSUE_TEMPLATE/Feature_request.md
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest a new feature or enhancement for this project
|
||||
|
||||
---
|
||||
|
||||
### Content & configuration
|
||||
|
||||
Swagger/OpenAPI definition:
|
||||
```yaml
|
||||
# your YAML here
|
||||
```
|
||||
|
||||
Swagger-UI configuration options:
|
||||
```js
|
||||
SwaggerUI({
|
||||
// your config options here
|
||||
})
|
||||
```
|
||||
|
||||
```
|
||||
?yourQueryStringConfig
|
||||
```
|
||||
|
||||
|
||||
### Is your feature request related to a problem?
|
||||
<!--
|
||||
Please provide a clear and concise description of what the problem is.
|
||||
"I'm always frustrated when..."
|
||||
-->
|
||||
|
||||
### Describe the solution you'd like
|
||||
<!-- A clear and concise description of what you want to happen. -->
|
||||
|
||||
### Describe alternatives you've considered
|
||||
<!--
|
||||
A clear and concise description of any alternative solutions or features
|
||||
you've considered.
|
||||
-->
|
||||
|
||||
### Additional context
|
||||
<!-- Add any other context or screenshots about the feature request here. -->
|
46
frontend/web/api-doc/.github/ISSUE_TEMPLATE/Support.md
vendored
Normal file
46
frontend/web/api-doc/.github/ISSUE_TEMPLATE/Support.md
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
---
|
||||
name: Support
|
||||
about: Ask a question or request help with your implementation.
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
We can only offer support for Swagger-UI itself.
|
||||
|
||||
If you're having a problem with a library that uses Swagger-UI
|
||||
(for example, Springfox or swagger-node), please open an issue
|
||||
in that project's repository instead.
|
||||
-->
|
||||
|
||||
### Q&A (please complete the following information)
|
||||
- OS: [e.g. macOS]
|
||||
- Browser: [e.g. chrome, safari]
|
||||
- Version: [e.g. 22]
|
||||
- Method of installation: [e.g. npm, dist assets]
|
||||
- Swagger-UI version: [e.g. 3.10.0]
|
||||
- Swagger/OpenAPI version: [e.g. Swagger 2.0, OpenAPI 3.0]
|
||||
|
||||
### Content & configuration
|
||||
<!-- Provide us with a way to see what you're seeing, so that we can help. -->
|
||||
|
||||
Swagger/OpenAPI definition:
|
||||
```yaml
|
||||
# your YAML here
|
||||
```
|
||||
|
||||
Swagger-UI configuration options:
|
||||
```js
|
||||
SwaggerUI({
|
||||
// your config options here
|
||||
})
|
||||
```
|
||||
|
||||
```
|
||||
?yourQueryStringConfig
|
||||
```
|
||||
|
||||
### Screenshots
|
||||
<!-- If applicable, add screenshots to help give context to your problem. -->
|
||||
|
||||
### How can we help?
|
||||
<!-- Your question or problem goes here! -->
|
23
frontend/web/api-doc/.github/dependabot.yaml
vendored
Normal file
23
frontend/web/api-doc/.github/dependabot.yaml
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: npm
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
commit-message:
|
||||
prefix: "chore"
|
||||
include: "scope"
|
||||
open-pull-requests-limit: 3
|
||||
ignore:
|
||||
# node-fetch must be synced manually
|
||||
- dependency-name: "node-fetch"
|
||||
- dependency-name: "release-it"
|
||||
- dependency-name: "@release-it/conventional-changelog"
|
||||
|
||||
- package-ecosystem: "docker"
|
||||
# Look for a `Dockerfile` in the `root` directory
|
||||
directory: "/"
|
||||
# Check for updates once a week
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
|
15
frontend/web/api-doc/.github/lock.yml
vendored
Normal file
15
frontend/web/api-doc/.github/lock.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
daysUntilLock: 365
|
||||
skipCreatedBefore: 2017-03-29 # initial release of Swagger UI 3.0.0
|
||||
exemptLabels: []
|
||||
lockLabel: "locked-by: lock-bot"
|
||||
setLockReason: false
|
||||
only: issues
|
||||
lockComment: false
|
||||
# lockComment: |
|
||||
# Locking due to inactivity.
|
||||
|
||||
# This is done to avoid resurrecting old issues and bumping long threads with new, possibly unrelated content.
|
||||
|
||||
# If you think you're experiencing something similar to what you've found here: please [open a new issue](https://github.com/swagger-api/swagger-ui/issues/new/choose), follow the template, and reference this issue in your report.
|
||||
|
||||
# Thanks!
|
55
frontend/web/api-doc/.github/pull_request_template.md
vendored
Normal file
55
frontend/web/api-doc/.github/pull_request_template.md
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
<!--- Provide a general summary of your changes in the Title above -->
|
||||
|
||||
### Description
|
||||
<!--- Describe your changes in detail -->
|
||||
|
||||
|
||||
|
||||
### Motivation and Context
|
||||
<!--- Why is this change required? What problem does it solve? -->
|
||||
<!--- If it fixes an open issue, please link to the issue here. -->
|
||||
<!--- Use the magic "Fixes #1234" format, so the issues are -->
|
||||
<!--- automatically closed when this PR is merged. -->
|
||||
|
||||
|
||||
|
||||
### How Has This Been Tested?
|
||||
<!--- Please describe in detail how you manually tested your changes. -->
|
||||
<!--- Include details of your testing environment, and the tests you ran to -->
|
||||
<!--- see how your change affects other areas of the code, etc. -->
|
||||
|
||||
|
||||
|
||||
### Screenshots (if appropriate):
|
||||
|
||||
|
||||
|
||||
## Checklist
|
||||
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
|
||||
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
|
||||
|
||||
### My PR contains...
|
||||
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
|
||||
- [ ] No code changes (`src/` is unmodified: changes to documentation, CI, metadata, etc.)
|
||||
- [ ] Dependency changes (any modification to dependencies in `package.json`)
|
||||
- [ ] Bug fixes (non-breaking change which fixes an issue)
|
||||
- [ ] Improvements (misc. changes to existing features)
|
||||
- [ ] Features (non-breaking change which adds functionality)
|
||||
|
||||
### My changes...
|
||||
- [ ] are breaking changes to a public API (config options, System API, major UI change, etc).
|
||||
- [ ] are breaking changes to a private API (Redux, component props, utility functions, etc.).
|
||||
- [ ] are breaking changes to a developer API (npm script behavior changes, new dev system dependencies, etc).
|
||||
- [ ] are not breaking changes.
|
||||
|
||||
### Documentation
|
||||
- [ ] My changes do not require a change to the project documentation.
|
||||
- [ ] My changes require a change to the project documentation.
|
||||
- [ ] If yes to above: I have updated the documentation accordingly.
|
||||
|
||||
### Automated tests
|
||||
- [ ] My changes can not or do not need to be tested.
|
||||
- [ ] My changes can and should be tested by unit and/or integration tests.
|
||||
- [ ] If yes to above: I have added tests to cover my changes.
|
||||
- [ ] If yes to above: I have taken care to cover edge cases in my tests.
|
||||
- [ ] All new and existing tests passed.
|
37
frontend/web/api-doc/.github/workflows/dependabot-merge.yml
vendored
Normal file
37
frontend/web/api-doc/.github/workflows/dependabot-merge.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
name: Merge me!
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
branches: [ master, next ]
|
||||
|
||||
jobs:
|
||||
merge-me:
|
||||
name: Merge me!
|
||||
if: github.actor == 'dependabot[bot]'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# This first step will fail if there's no metadata and so the approval
|
||||
# will not occur.
|
||||
- name: Dependabot metadata
|
||||
id: dependabot-metadata
|
||||
uses: dependabot/fetch-metadata@v1.1.1
|
||||
with:
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
# Here the PR gets approved.
|
||||
- name: Approve a PR
|
||||
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
|
||||
run: gh pr review --approve "$PR_URL"
|
||||
env:
|
||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
||||
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
|
||||
# Finally, tell dependabot to merge the PR if all checks are successful
|
||||
- name: Instruct dependabot to squash & merge
|
||||
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
|
||||
uses: mshick/add-pr-comment@v2
|
||||
with:
|
||||
repo-token: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
|
||||
allow-repeats: true
|
||||
message: |
|
||||
@dependabot squash and merge
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
|
20
frontend/web/api-doc/.github/workflows/docker-image-check.yml
vendored
Normal file
20
frontend/web/api-doc/.github/workflows/docker-image-check.yml
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
name: Security scan for docker image
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '30 4 * * *'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Run Trivy vulnerability scanner
|
||||
uses: aquasecurity/trivy-action@master
|
||||
with:
|
||||
image-ref: 'docker.io/swaggerapi/swagger-ui:unstable'
|
||||
format: 'table'
|
||||
exit-code: '1'
|
||||
ignore-unfixed: true
|
||||
vuln-type: 'os,library'
|
||||
severity: 'CRITICAL,HIGH'
|
83
frontend/web/api-doc/.github/workflows/nodejs.yml
vendored
Normal file
83
frontend/web/api-doc/.github/workflows/nodejs.yml
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
name: Node.js CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, next ]
|
||||
pull_request:
|
||||
branches: [ master, next ]
|
||||
|
||||
env:
|
||||
CYPRESS_CACHE_FOLDER: cypress/cache
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Use Node.js 16.x
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Cache Node Modules and Cypress binary
|
||||
uses: actions/cache@v3
|
||||
id: cache-primes
|
||||
with:
|
||||
path: |
|
||||
node_modules
|
||||
${{ env.CYPRESS_CACHE_FOLDER }}
|
||||
key: ${{ runner.os }}-node-and-cypress-${{ hashFiles('package-lock.json') }}
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.cache-primes.outputs.cache-hit != 'true'
|
||||
run: npm ci
|
||||
|
||||
- name: Lint code for errors only
|
||||
run: npm run lint-errors
|
||||
|
||||
- name: Run all tests
|
||||
run: npm run just-test-in-node && npm run test:unit-jest
|
||||
env:
|
||||
CI: true
|
||||
|
||||
- name: Build SwaggerUI
|
||||
run: npm run build
|
||||
|
||||
- name: Test build artifacts
|
||||
run: npm run test:artifact
|
||||
|
||||
e2e-tests:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
containers: ['+(a11y|security|bugs)/**/*.js', 'features/**/+(o|d)*.js', 'features/**/m*.js', 'features/**/!(o|d|m)*.js']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Use Node.js 16.x
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Cache Node Modules and Cypress binary
|
||||
uses: actions/cache@v3
|
||||
id: cache-primes
|
||||
with:
|
||||
path: |
|
||||
node_modules
|
||||
${{ env.CYPRESS_CACHE_FOLDER }}
|
||||
key: ${{ runner.os }}-node-and-cypress-${{ hashFiles('package-lock.json') }}
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.cache-primes.outputs.cache-hit != 'true'
|
||||
run: npm ci
|
||||
|
||||
- name: Cypress Test
|
||||
run: npx start-server-and-test cy:start http://localhost:3204 'npm run cy:run -- --spec "test/e2e-cypress/tests/${{ matrix.containers }}"'
|
79
frontend/web/api-doc/.github/workflows/release-swagger-ui-react.yml
vendored
Normal file
79
frontend/web/api-doc/.github/workflows/release-swagger-ui-react.yml
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
name: Build & Release SwaggerUI-React@next
|
||||
|
||||
# single-stage
|
||||
on:
|
||||
workflow_dispatch:
|
||||
branches:
|
||||
- next
|
||||
|
||||
# multi-stage automation
|
||||
# on:
|
||||
# workflow_run:
|
||||
# workflows: ["Release SwaggerUI@next"]
|
||||
# types:
|
||||
# - completed
|
||||
# branches: [next]
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: flavors/swagger-ui-react/release
|
||||
jobs:
|
||||
release-swagger-ui-react:
|
||||
name: Release SwaggerUI React
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
ref: next
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Prepare SwaggerUI dist
|
||||
run: |
|
||||
cd ../../../
|
||||
npm ci
|
||||
npm run build
|
||||
|
||||
- name: Install dependencies (to create package manifest)
|
||||
run: npm ci
|
||||
|
||||
- name: MKDIR `dist` working directory
|
||||
run: mkdir -p ../dist
|
||||
|
||||
- name: Copy SwaggerUI dist files to MKDIR
|
||||
run: |
|
||||
ls ../dist
|
||||
cp ../../../dist/swagger-ui-es-bundle-core.js ../dist
|
||||
cp ../../../dist/swagger-ui-es-bundle-core.js.map ../dist
|
||||
cp ../../../dist/swagger-ui.css ../dist
|
||||
cp ../../../dist/swagger-ui.css.map ../dist
|
||||
|
||||
- name: Create a releasable package manifest
|
||||
run: node create-manifest.js > ../dist/package.json
|
||||
|
||||
- name: Transpile our top-level React Component
|
||||
run: |
|
||||
../../../node_modules/.bin/cross-env BABEL_ENV=commonjs ../../../node_modules/.bin/babel --config-file ../../../babel.config.js ../index.jsx > ../dist/commonjs.js
|
||||
../../../node_modules/.bin/cross-env BABEL_ENV=es ../../../node_modules/.bin/babel --config-file ../../../babel.config.js ../index.jsx > ../dist/index.js
|
||||
|
||||
- name: Copy our README into the dist folder for npm
|
||||
run: cp ../README.md ../dist
|
||||
|
||||
- name: Copy LICENSE & NOTICE into the dist folder for npm
|
||||
run: |
|
||||
cp ../../../LICENSE ../dist
|
||||
cp ../../../NOTICE ../dist
|
||||
|
||||
- name: Run the release from the dist folder
|
||||
run: |
|
||||
cd ../dist
|
||||
pwd
|
||||
npm pack . --tag alpha
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
73
frontend/web/api-doc/.github/workflows/release-swagger-ui.yml
vendored
Normal file
73
frontend/web/api-doc/.github/workflows/release-swagger-ui.yml
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
name: Release SwaggerUI@next
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
branches:
|
||||
- next
|
||||
|
||||
jobs:
|
||||
release-swagger-ui:
|
||||
name: Release SwaggerUI
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
ref: next
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Determine the next release version
|
||||
uses: cycjimmy/semantic-release-action@v3
|
||||
with:
|
||||
dry_run: true
|
||||
extra_plugins: |
|
||||
@semantic-release/git
|
||||
@semantic-release/exec
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Nothing to release
|
||||
if: ${{ env.NEXT_RELEASE_VERSION == '' }}
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('Nothing to release')
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Prepare release
|
||||
run: |
|
||||
npm run build
|
||||
|
||||
- name: Semantic Release
|
||||
id: semantic
|
||||
uses: cycjimmy/semantic-release-action@v3
|
||||
with:
|
||||
dry_run: false
|
||||
extra_plugins: |
|
||||
@semantic-release/git
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Release failed
|
||||
if: steps.semantic.outputs.new_release_published == 'false'
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('Release failed')
|
||||
|
||||
- name: Release published
|
||||
run: |
|
||||
echo ${{ steps.semantic.outputs.new_release_version }}
|
||||
echo ${{ steps.semantic.outputs.new_release_major_version }}
|
||||
echo ${{ steps.semantic.outputs.new_release_minor_version }}
|
||||
echo ${{ steps.semantic.outputs.new_release_patch_version }}
|
28
frontend/web/api-doc/.gitignore
vendored
Normal file
28
frontend/web/api-doc/.gitignore
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
node_modules
|
||||
.idea
|
||||
.vscode
|
||||
.deps_check
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.nyc_output
|
||||
npm-debug.log*
|
||||
.eslintcache
|
||||
*.iml
|
||||
selenium-debug.log
|
||||
chromedriver.log
|
||||
test/e2e/db.json
|
||||
docs/_book
|
||||
dev-helpers/examples
|
||||
|
||||
# dist
|
||||
flavors/**/dist/*
|
||||
/lib
|
||||
/es
|
||||
dist/log*
|
||||
|
||||
# Cypress
|
||||
test/e2e-cypress/screenshots
|
||||
test/e2e-cypress/videos
|
4
frontend/web/api-doc/.husky/commit-msg
Executable file
4
frontend/web/api-doc/.husky/commit-msg
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npx commitlint -e
|
4
frontend/web/api-doc/.husky/pre-commit
Executable file
4
frontend/web/api-doc/.husky/pre-commit
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npx lint-staged
|
3
frontend/web/api-doc/.lintstagedrc
Normal file
3
frontend/web/api-doc/.lintstagedrc
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"*.js": "eslint"
|
||||
}
|
2
frontend/web/api-doc/.mocharc.yaml
Normal file
2
frontend/web/api-doc/.mocharc.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
recursive: true
|
||||
require: ['esm','@babel/register','source-map-support', 'test/mocha/setup.js']
|
16
frontend/web/api-doc/.npmignore
Normal file
16
frontend/web/api-doc/.npmignore
Normal file
@ -0,0 +1,16 @@
|
||||
*
|
||||
*/
|
||||
!README.md
|
||||
!NOTICE
|
||||
!package.json
|
||||
!dist/swagger-ui.js
|
||||
!dist/swagger-ui.js.map
|
||||
!dist/swagger-ui-standalone-preset.js
|
||||
!dist/swagger-ui-standalone-preset.js.map
|
||||
!dist/swagger-ui-es-bundle.js
|
||||
!dist/swagger-ui-es-bundle.js.map
|
||||
!dist/swagger-ui-es-bundle-core.js
|
||||
!dist/swagger-ui-es-bundle-core.js.map
|
||||
!dist/swagger-ui.css
|
||||
!dist/swagger-ui.css.map
|
||||
!dist/oauth2-redirect.html
|
1
frontend/web/api-doc/.npmrc
Normal file
1
frontend/web/api-doc/.npmrc
Normal file
@ -0,0 +1 @@
|
||||
save-prefix="="
|
1
frontend/web/api-doc/.nvmrc
Normal file
1
frontend/web/api-doc/.nvmrc
Normal file
@ -0,0 +1 @@
|
||||
16.13.2
|
5
frontend/web/api-doc/.prettierrc.yaml
Normal file
5
frontend/web/api-doc/.prettierrc.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
semi: false
|
||||
trailingComma: es5
|
||||
endOfLine: lf
|
||||
requirePragma: true
|
||||
insertPragma: true
|
35
frontend/web/api-doc/.releaserc
Normal file
35
frontend/web/api-doc/.releaserc
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"branches": [
|
||||
{
|
||||
"name": "master"
|
||||
},
|
||||
{
|
||||
"name": "next",
|
||||
"channel": "alpha",
|
||||
"prerelease": "alpha"
|
||||
}
|
||||
],
|
||||
"tagFormat": "v${version}",
|
||||
"plugins": [
|
||||
"@semantic-release/commit-analyzer",
|
||||
[
|
||||
"@semantic-release/exec",
|
||||
{
|
||||
"verifyReleaseCmd": "echo \"NEXT_RELEASE_VERSION=${nextRelease.version}\" >> $GITHUB_ENV"
|
||||
}
|
||||
],
|
||||
"@semantic-release/release-notes-generator",
|
||||
"@semantic-release/npm",
|
||||
"@semantic-release/github",
|
||||
[
|
||||
"@semantic-release/git",
|
||||
{
|
||||
"assets": [
|
||||
"package.json",
|
||||
"package-lock.json"
|
||||
],
|
||||
"message": "chore(release): cut the ${nextRelease.version} release\n\n${nextRelease.notes}"
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
26
frontend/web/api-doc/Dockerfile
Normal file
26
frontend/web/api-doc/Dockerfile
Normal file
@ -0,0 +1,26 @@
|
||||
# Looking for information on environment variables?
|
||||
# We don't declare them here — take a look at our docs.
|
||||
# https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md
|
||||
|
||||
FROM nginx:1.23.4-alpine
|
||||
|
||||
RUN apk update && apk add --no-cache "nodejs>=18.14.1-r0 "
|
||||
|
||||
LABEL maintainer="fehguy"
|
||||
|
||||
ENV API_KEY "**None**"
|
||||
ENV SWAGGER_JSON "/app/swagger.json"
|
||||
ENV PORT 8080
|
||||
ENV BASE_URL ""
|
||||
ENV SWAGGER_JSON_URL ""
|
||||
|
||||
COPY --chown=nginx:nginx --chmod=0666 ./docker/nginx.conf ./docker/cors.conf /etc/nginx/
|
||||
|
||||
# copy swagger files to the `/js` folder
|
||||
COPY --chmod=0666 ./dist/* /usr/share/nginx/html/
|
||||
COPY --chmod=0555 ./docker/docker-entrypoint.d/ /docker-entrypoint.d/
|
||||
COPY --chmod=0666 ./docker/configurator /usr/share/nginx/configurator
|
||||
|
||||
RUN chmod 777 /usr/share/nginx/html/ /etc/nginx/ /var/cache/nginx/ /var/run/
|
||||
|
||||
EXPOSE 8080
|
202
frontend/web/api-doc/LICENSE
Normal file
202
frontend/web/api-doc/LICENSE
Normal file
@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
2
frontend/web/api-doc/NOTICE
Normal file
2
frontend/web/api-doc/NOTICE
Normal file
@ -0,0 +1,2 @@
|
||||
swagger-ui
|
||||
Copyright 2020-2021 SmartBear Software Inc.
|
98
frontend/web/api-doc/README.md
Normal file
98
frontend/web/api-doc/README.md
Normal file
@ -0,0 +1,98 @@
|
||||
# <img src="https://raw.githubusercontent.com/swagger-api/swagger.io/wordpress/images/assets/SWU-logo-clr.png" width="300">
|
||||
|
||||
[![NPM version](https://badge.fury.io/js/swagger-ui.svg)](http://badge.fury.io/js/swagger-ui)
|
||||
[![Build Status](https://jenkins.swagger.io/view/OSS%20-%20JavaScript/job/oss-swagger-ui-master/badge/icon?subject=jenkins%20build)](https://jenkins.swagger.io/view/OSS%20-%20JavaScript/job/oss-swagger-ui-master/)
|
||||
[![npm audit](https://jenkins.swagger.io/buildStatus/icon?job=oss-swagger-ui-security-audit&subject=npm%20audit)](https://jenkins.swagger.io/job/oss-swagger-ui-security-audit/lastBuild/console)
|
||||
![total GitHub contributors](https://img.shields.io/github/contributors-anon/swagger-api/swagger-ui.svg)
|
||||
|
||||
![monthly npm installs](https://img.shields.io/npm/dm/swagger-ui.svg?label=npm%20downloads)
|
||||
![total docker pulls](https://img.shields.io/docker/pulls/swaggerapi/swagger-ui.svg)
|
||||
![monthly packagist installs](https://img.shields.io/packagist/dm/swagger-api/swagger-ui.svg?label=packagist%20installs)
|
||||
![gzip size](https://img.shields.io/bundlephobia/minzip/swagger-ui.svg?label=gzip%20size)
|
||||
|
||||
## Introduction
|
||||
[Swagger UI](https://swagger.io/tools/swagger-ui/) allows anyone — be it your development team or your end consumers — to visualize and interact with the API’s resources without having any of the implementation logic in place. It’s automatically generated from your OpenAPI (formerly known as Swagger) Specification, with the visual documentation making it easy for back end implementation and client side consumption.
|
||||
|
||||
## General
|
||||
**👉🏼 Want to score an easy open-source contribution?** Check out our [Good first issue](https://github.com/swagger-api/swagger-ui/issues?q=is%3Aissue+is%3Aopen+label%3A%22Good+first+issue%22) label.
|
||||
|
||||
**🕰️ Looking for the older version of Swagger UI?** Refer to the [*2.x* branch](https://github.com/swagger-api/swagger-ui/tree/2.x).
|
||||
|
||||
|
||||
This repository publishes three different NPM modules:
|
||||
|
||||
* [swagger-ui](https://www.npmjs.com/package/swagger-ui) is a traditional npm module intended for use in single-page applications that are capable of resolving dependencies (via Webpack, Browserify, etc).
|
||||
* [swagger-ui-dist](https://www.npmjs.com/package/swagger-ui-dist) is a dependency-free module that includes everything you need to serve Swagger UI in a server-side project, or a single-page application that can't resolve npm module dependencies.
|
||||
* [swagger-ui-react](https://www.npmjs.com/package/swagger-ui-react) is Swagger UI packaged as a React component for use in React applications.
|
||||
|
||||
We strongly suggest that you use `swagger-ui` instead of `swagger-ui-dist` if you're building a single-page application, since `swagger-ui-dist` is significantly larger.
|
||||
|
||||
If you are looking for plain ol' HTML/JS/CSS, [download the latest release](https://github.com/swagger-api/swagger-ui/releases/latest) and copy the contents of the `/dist` folder to your server.
|
||||
|
||||
|
||||
## Compatibility
|
||||
The OpenAPI Specification has undergone 5 revisions since initial creation in 2010. Compatibility between Swagger UI and the OpenAPI Specification is as follows:
|
||||
|
||||
Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes
|
||||
------------------ | ------------ | -------------------------- | -----
|
||||
4.0.0 | 2021-11-03 | 2.0, 3.0 | [tag v4.0.0](https://github.com/swagger-api/swagger-ui/tree/v4.0.0)
|
||||
3.18.3 | 2018-08-03 | 2.0, 3.0 | [tag v3.18.3](https://github.com/swagger-api/swagger-ui/tree/v3.18.3)
|
||||
3.0.21 | 2017-07-26 | 2.0 | [tag v3.0.21](https://github.com/swagger-api/swagger-ui/tree/v3.0.21)
|
||||
2.2.10 | 2017-01-04 | 1.1, 1.2, 2.0 | [tag v2.2.10](https://github.com/swagger-api/swagger-ui/tree/v2.2.10)
|
||||
2.1.5 | 2016-07-20 | 1.1, 1.2, 2.0 | [tag v2.1.5](https://github.com/swagger-api/swagger-ui/tree/v2.1.5)
|
||||
2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24)
|
||||
1.0.13 | 2013-03-08 | 1.1, 1.2 | [tag v1.0.13](https://github.com/swagger-api/swagger-ui/tree/v1.0.13)
|
||||
1.0.1 | 2011-10-11 | 1.0, 1.1 | [tag v1.0.1](https://github.com/swagger-api/swagger-ui/tree/v1.0.1)
|
||||
|
||||
## Documentation
|
||||
|
||||
#### Usage
|
||||
- [Installation](docs/usage/installation.md)
|
||||
- [Configuration](docs/usage/configuration.md)
|
||||
- [CORS](docs/usage/cors.md)
|
||||
- [OAuth2](docs/usage/oauth2.md)
|
||||
- [Deep Linking](docs/usage/deep-linking.md)
|
||||
- [Limitations](docs/usage/limitations.md)
|
||||
- [Version detection](docs/usage/version-detection.md)
|
||||
|
||||
#### Customization
|
||||
- [Overview](docs/customization/overview.md)
|
||||
- [Plugin API](docs/customization/plugin-api.md)
|
||||
- [Custom layout](docs/customization/custom-layout.md)
|
||||
|
||||
#### Development
|
||||
- [Setting up](docs/development/setting-up.md)
|
||||
- [Scripts](docs/development/scripts.md)
|
||||
|
||||
#### Contributing
|
||||
- [Contributing](https://github.com/swagger-api/.github/blob/master/CONTRIBUTING.md)
|
||||
|
||||
##### Integration Tests
|
||||
|
||||
You will need JDK of version 7 or higher as instructed here
|
||||
https://nightwatchjs.org/guide/getting-started/installation.html#install-selenium-server
|
||||
|
||||
Integration tests can be run locally with `npm run e2e` - be sure you aren't running a dev server when testing!
|
||||
|
||||
### Browser support
|
||||
Swagger UI works in the latest versions of Chrome, Safari, Firefox, and Edge.
|
||||
|
||||
### Known Issues
|
||||
|
||||
To help with the migration, here are the currently known issues with 3.X. This list will update regularly, and will not include features that were not implemented in previous versions.
|
||||
|
||||
- Only part of the parameters previously supported are available.
|
||||
- The JSON Form Editor is not implemented.
|
||||
- Support for `collectionFormat` is partial.
|
||||
- l10n (translations) is not implemented.
|
||||
- Relative path support for external files is not implemented.
|
||||
|
||||
## Security contact
|
||||
|
||||
Please disclose any security-related issues or vulnerabilities by emailing [security@swagger.io](mailto:security@swagger.io), instead of using the public issue tracker.
|
||||
|
||||
## License
|
||||
|
||||
SwaggerUI is licensed under [Apache 2.0 license](https://github.com/swagger-api/swagger-ui/blob/master/LICENSE).
|
||||
SwaggerUI comes with an explicit [NOTICE](https://github.com/swagger-api/swagger-ui/blob/master/NOTICE) file
|
||||
containing additional legal notices and information.
|
22
frontend/web/api-doc/SECURITY.md
Normal file
22
frontend/web/api-doc/SECURITY.md
Normal file
@ -0,0 +1,22 @@
|
||||
# Security Policy
|
||||
|
||||
If you believe you've found an exploitable security issue in Swagger UI,
|
||||
**please don't create a public issue**.
|
||||
|
||||
|
||||
## Supported versions
|
||||
|
||||
This is the list of versions of `swagger-ui` which are
|
||||
currently being supported with security updates.
|
||||
|
||||
| Version | Supported | Notes |
|
||||
| -------- | ------------------ | ---------------------- |
|
||||
| 4.x | :white_check_mark: | |
|
||||
| 3.x | :x: | End-of-life as of November 2021 |
|
||||
| 2.x | :x: | End-of-life as of 2017 |
|
||||
|
||||
## Reporting a vulnerability
|
||||
|
||||
To report a vulnerability please send an email with the details to [security@swagger.io](mailto:security@swagger.io).
|
||||
|
||||
We'll acknowledge receipt of your report ASAP, and set expectations on how we plan to handle it.
|
167
frontend/web/api-doc/babel.config.js
Normal file
167
frontend/web/api-doc/babel.config.js
Normal file
@ -0,0 +1,167 @@
|
||||
module.exports = {
|
||||
"env": {
|
||||
"commonjs": {
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"debug": false,
|
||||
"modules": "commonjs",
|
||||
"targets": {
|
||||
"node": "8"
|
||||
},
|
||||
"forceAllTransforms": false,
|
||||
"ignoreBrowserslistConfig": true
|
||||
}
|
||||
],
|
||||
"@babel/preset-react",
|
||||
],
|
||||
"plugins": [
|
||||
[
|
||||
"@babel/plugin-transform-modules-commonjs",
|
||||
{
|
||||
"loose": true
|
||||
}
|
||||
],
|
||||
"@babel/proposal-class-properties",
|
||||
"@babel/proposal-object-rest-spread",
|
||||
"@babel/plugin-proposal-optional-chaining",
|
||||
]
|
||||
},
|
||||
"es": {
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"debug": false,
|
||||
"modules": false
|
||||
}
|
||||
],
|
||||
"@babel/preset-react",
|
||||
],
|
||||
"plugins": [
|
||||
[
|
||||
"@babel/plugin-transform-runtime",
|
||||
{
|
||||
"absoluteRuntime": false,
|
||||
"corejs": 3,
|
||||
"version": "^7.11.2"
|
||||
}
|
||||
],
|
||||
"@babel/proposal-class-properties",
|
||||
"@babel/proposal-object-rest-spread",
|
||||
"@babel/plugin-proposal-optional-chaining",
|
||||
]
|
||||
},
|
||||
"development": {
|
||||
"presets": [
|
||||
[
|
||||
"@babel/env",
|
||||
{
|
||||
"targets": {
|
||||
"browsers": [
|
||||
/* benefit of C/S/FF/Edge only? */
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"Firefox ESR",
|
||||
"not dead"
|
||||
]
|
||||
},
|
||||
"useBuiltIns": false,
|
||||
"corejs": { version: 3 },
|
||||
"include": [
|
||||
"@babel/plugin-proposal-logical-assignment-operators"
|
||||
]
|
||||
}
|
||||
],
|
||||
"@babel/preset-react"
|
||||
],
|
||||
"plugins": [
|
||||
[
|
||||
"@babel/plugin-transform-runtime",
|
||||
{
|
||||
"corejs": 3,
|
||||
"absoluteRuntime": false,
|
||||
"version": "^7.11.2"
|
||||
}
|
||||
],
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
"@babel/plugin-proposal-optional-chaining",
|
||||
[
|
||||
"transform-react-remove-prop-types",
|
||||
{
|
||||
"additionalLibraries": [
|
||||
"react-immutable-proptypes"
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
"babel-plugin-module-resolver",
|
||||
{
|
||||
"alias": {
|
||||
"root": ".",
|
||||
"components": "./src/core/components",
|
||||
"containers": "./src/core/containers",
|
||||
"core": "./src/core",
|
||||
"plugins": "./src/plugins",
|
||||
"img": "./src/img",
|
||||
"corePlugins": "./src/core/plugins",
|
||||
"less": "./src/less"
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"test": {
|
||||
"presets": [
|
||||
[
|
||||
"@babel/env",
|
||||
{
|
||||
"targets": {
|
||||
"node": "10"
|
||||
},
|
||||
"useBuiltIns": false,
|
||||
"corejs": { version: 3 }
|
||||
}
|
||||
],
|
||||
"@babel/preset-react"
|
||||
],
|
||||
"plugins": [
|
||||
[
|
||||
"@babel/plugin-transform-runtime",
|
||||
{
|
||||
"corejs": 3,
|
||||
"absoluteRuntime": false,
|
||||
"version": "^7.11.2"
|
||||
}
|
||||
],
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
"@babel/plugin-proposal-optional-chaining",
|
||||
[
|
||||
"transform-react-remove-prop-types",
|
||||
{
|
||||
"additionalLibraries": [
|
||||
"react-immutable-proptypes"
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
"babel-plugin-module-resolver",
|
||||
{
|
||||
"alias": {
|
||||
"root": ".",
|
||||
"components": "./src/core/components",
|
||||
"containers": "./src/core/containers",
|
||||
"core": "./src/core",
|
||||
"plugins": "./src/plugins",
|
||||
"img": "./src/img",
|
||||
"corePlugins": "./src/core/plugins",
|
||||
"less": "./src/less"
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
40
frontend/web/api-doc/composer.json
Normal file
40
frontend/web/api-doc/composer.json
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "swagger-api/swagger-ui",
|
||||
"description": " Swagger UI is a collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.",
|
||||
"keywords": [
|
||||
"Swagger",
|
||||
"OpenAPI",
|
||||
"specification",
|
||||
"documentation",
|
||||
"API",
|
||||
"UI"
|
||||
],
|
||||
"homepage": "http://swagger.io",
|
||||
"license": "Apache-2.0",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Anna Bodnia",
|
||||
"email": "anna.bodnia@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Buu Nguyen",
|
||||
"email": "buunguyen@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Josh Ponelat",
|
||||
"email": "jponelat@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Kyle Shockey",
|
||||
"email": "kyleshockey1@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Robert Barnwell",
|
||||
"email": "robert@robertismy.name"
|
||||
},
|
||||
{
|
||||
"name": "Sahar Jafari",
|
||||
"email": "shr.jafari@gmail.com"
|
||||
}
|
||||
]
|
||||
}
|
8
frontend/web/api-doc/config/.eslintrc
Normal file
8
frontend/web/api-doc/config/.eslintrc
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"rules": {
|
||||
"import/no-unresolved": 0,
|
||||
"import/extensions": 0,
|
||||
"quotes": ["error", "single"],
|
||||
"semi": ["error", "always"]
|
||||
}
|
||||
}
|
8
frontend/web/api-doc/config/jest/jest.artifact.config.js
Normal file
8
frontend/web/api-doc/config/jest/jest.artifact.config.js
Normal file
@ -0,0 +1,8 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
rootDir: path.join(__dirname, '..', '..'),
|
||||
testEnvironment: 'jsdom',
|
||||
testMatch: ['**/test/build-artifacts/**/*.js'],
|
||||
transformIgnorePatterns: ['/node_modules/(?!(swagger-client|react-syntax-highlighter)/)'],
|
||||
};
|
23
frontend/web/api-doc/config/jest/jest.unit.config.js
Normal file
23
frontend/web/api-doc/config/jest/jest.unit.config.js
Normal file
@ -0,0 +1,23 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
rootDir: path.join(__dirname, '..', '..'),
|
||||
testEnvironment: 'jest-environment-jsdom',
|
||||
testMatch: [
|
||||
'**/test/unit/*.js?(x)',
|
||||
'**/test/unit/**/*.js?(x)',
|
||||
],
|
||||
setupFiles: ['<rootDir>/test/unit/jest-shim.js'],
|
||||
setupFilesAfterEnv: ['<rootDir>/test/unit/setup.js'],
|
||||
testPathIgnorePatterns: [
|
||||
'<rootDir>/node_modules/',
|
||||
'<rootDir>/test/build-artifacts/',
|
||||
'<rootDir>/test/mocha',
|
||||
'<rootDir>/test/unit/jest-shim.js',
|
||||
'<rootDir>/test/unit/setup.js',
|
||||
'<rootDir>/test/unit/xss/anchor-target-rel/online-validator-badge.jsx',
|
||||
'<rootDir>/test/unit/components/online-validator-badge.jsx',
|
||||
'<rootDir>/test/unit/components/live-response.jsx',
|
||||
],
|
||||
silent: true, // set to `false` to allow console.* calls to be printed
|
||||
};
|
11
frontend/web/api-doc/cypress.json
Normal file
11
frontend/web/api-doc/cypress.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"fileServerFolder": "test/e2e-cypress/static",
|
||||
"fixturesFolder": "test/e2e-cypress/fixtures",
|
||||
"integrationFolder": "test/e2e-cypress/tests",
|
||||
"pluginsFile": "test/e2e-cypress/plugins/index.js",
|
||||
"screenshotsFolder": "test/e2e-cypress/screenshots",
|
||||
"supportFile": "test/e2e-cypress/support/index.js",
|
||||
"videosFolder": "test/e2e-cypress/videos",
|
||||
"baseUrl": "http://localhost:3230/",
|
||||
"video": false
|
||||
}
|
33
frontend/web/api-doc/dev-helpers/dev-helper-initializer.js
Normal file
33
frontend/web/api-doc/dev-helpers/dev-helper-initializer.js
Normal file
@ -0,0 +1,33 @@
|
||||
/* eslint-disable no-undef */
|
||||
window.onload = function() {
|
||||
window["SwaggerUIBundle"] = window["swagger-ui-bundle"]
|
||||
window["SwaggerUIStandalonePreset"] = window["swagger-ui-standalone-preset"]
|
||||
// Build a system
|
||||
const ui = SwaggerUIBundle({
|
||||
url: "https://petstore.swagger.io/v2/swagger.json",
|
||||
dom_id: "#swagger-ui",
|
||||
presets: [
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIStandalonePreset
|
||||
],
|
||||
plugins: [
|
||||
SwaggerUIBundle.plugins.DownloadUrl
|
||||
],
|
||||
// requestSnippetsEnabled: true,
|
||||
layout: "StandaloneLayout"
|
||||
})
|
||||
|
||||
window.ui = ui
|
||||
|
||||
ui.initOAuth({
|
||||
clientId: "your-client-id",
|
||||
clientSecret: "your-client-secret-if-required",
|
||||
realm: "your-realms",
|
||||
appName: "your-app-name",
|
||||
scopeSeparator: " ",
|
||||
scopes: "openid profile email phone address",
|
||||
additionalQueryStringParams: {},
|
||||
useBasicAuthenticationWithAccessCodeGrant: false,
|
||||
usePkceWithAuthorizationCodeGrant: false
|
||||
})
|
||||
}
|
21
frontend/web/api-doc/dev-helpers/index.html
Normal file
21
frontend/web/api-doc/dev-helpers/index.html
Normal file
@ -0,0 +1,21 @@
|
||||
<!-- HTML for dev server -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Swagger UI</title>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<style>
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="swagger-ui"></div>
|
||||
|
||||
<script src="dev-helper-initializer.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
76
frontend/web/api-doc/dev-helpers/oauth2-redirect.html
Normal file
76
frontend/web/api-doc/dev-helpers/oauth2-redirect.html
Normal file
@ -0,0 +1,76 @@
|
||||
<!doctype html>
|
||||
<html lang="en-US">
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
<script>
|
||||
'use strict';
|
||||
function run () {
|
||||
var oauth2 = window.opener.swaggerUIRedirectOauth2;
|
||||
var sentState = oauth2.state;
|
||||
var redirectUrl = oauth2.redirectUrl;
|
||||
var isValid, qp, arr;
|
||||
|
||||
if (/code|token|error/.test(window.location.hash)) {
|
||||
qp = window.location.hash.substring(1).replace('?', '&');
|
||||
} else {
|
||||
qp = location.search.substring(1);
|
||||
}
|
||||
|
||||
arr = qp.split("&")
|
||||
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';})
|
||||
qp = qp ? JSON.parse('{' + arr.join() + '}',
|
||||
function (key, value) {
|
||||
return key === "" ? value : decodeURIComponent(value)
|
||||
}
|
||||
) : {}
|
||||
|
||||
isValid = qp.state === sentState
|
||||
|
||||
if ((
|
||||
oauth2.auth.schema.get("flow") === "accessCode" ||
|
||||
oauth2.auth.schema.get("flow") === "authorizationCode" ||
|
||||
oauth2.auth.schema.get("flow") === "authorization_code"
|
||||
) && !oauth2.auth.code) {
|
||||
if (!isValid) {
|
||||
oauth2.errCb({
|
||||
authId: oauth2.auth.name,
|
||||
source: "auth",
|
||||
level: "warning",
|
||||
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
|
||||
});
|
||||
}
|
||||
|
||||
if (qp.code) {
|
||||
delete oauth2.state;
|
||||
oauth2.auth.code = qp.code;
|
||||
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
||||
} else {
|
||||
let oauthErrorMsg
|
||||
if (qp.error) {
|
||||
oauthErrorMsg = "["+qp.error+"]: " +
|
||||
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
|
||||
(qp.error_uri ? "More info: "+qp.error_uri : "");
|
||||
}
|
||||
|
||||
oauth2.errCb({
|
||||
authId: oauth2.auth.name,
|
||||
source: "auth",
|
||||
level: "error",
|
||||
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
|
||||
});
|
||||
}
|
||||
} else {
|
||||
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
|
||||
}
|
||||
window.close();
|
||||
}
|
||||
|
||||
if( document.readyState !== 'loading' ) {
|
||||
run();
|
||||
} else {
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
run();
|
||||
});
|
||||
}
|
||||
</script>
|
19
frontend/web/api-doc/dev-helpers/style.css
Normal file
19
frontend/web/api-doc/dev-helpers/style.css
Normal file
@ -0,0 +1,19 @@
|
||||
html
|
||||
{
|
||||
box-sizing: border-box;
|
||||
overflow: -moz-scrollbars-vertical;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
*,
|
||||
*:before,
|
||||
*:after
|
||||
{
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
body
|
||||
{
|
||||
margin:0;
|
||||
background: #fafafa;
|
||||
}
|
16
frontend/web/api-doc/dist/definitions/request.json
vendored
Normal file
16
frontend/web/api-doc/dist/definitions/request.json
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
"components": {
|
||||
"schemas": {
|
||||
"user": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
frontend/web/api-doc/dist/favicon-16x16.png
vendored
Normal file
BIN
frontend/web/api-doc/dist/favicon-16x16.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 665 B |
BIN
frontend/web/api-doc/dist/favicon-32x32.png
vendored
Normal file
BIN
frontend/web/api-doc/dist/favicon-32x32.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 628 B |
16
frontend/web/api-doc/dist/index.css
vendored
Normal file
16
frontend/web/api-doc/dist/index.css
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
html {
|
||||
box-sizing: border-box;
|
||||
overflow: -moz-scrollbars-vertical;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
*,
|
||||
*:before,
|
||||
*:after {
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
background: #fafafa;
|
||||
}
|
19
frontend/web/api-doc/dist/index.html
vendored
Normal file
19
frontend/web/api-doc/dist/index.html
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
<!-- HTML for static distribution bundle build -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Swagger UI</title>
|
||||
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
|
||||
<link rel="stylesheet" type="text/css" href="index.css" />
|
||||
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
|
||||
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="swagger-ui"></div>
|
||||
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
|
||||
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
|
||||
<script src="./swagger-initializer.js" charset="UTF-8"> </script>
|
||||
</body>
|
||||
</html>
|
79
frontend/web/api-doc/dist/oauth2-redirect.html
vendored
Normal file
79
frontend/web/api-doc/dist/oauth2-redirect.html
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
<!doctype html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<title>Swagger UI: OAuth2 Redirect</title>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
'use strict';
|
||||
function run () {
|
||||
var oauth2 = window.opener.swaggerUIRedirectOauth2;
|
||||
var sentState = oauth2.state;
|
||||
var redirectUrl = oauth2.redirectUrl;
|
||||
var isValid, qp, arr;
|
||||
|
||||
if (/code|token|error/.test(window.location.hash)) {
|
||||
qp = window.location.hash.substring(1).replace('?', '&');
|
||||
} else {
|
||||
qp = location.search.substring(1);
|
||||
}
|
||||
|
||||
arr = qp.split("&");
|
||||
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
|
||||
qp = qp ? JSON.parse('{' + arr.join() + '}',
|
||||
function (key, value) {
|
||||
return key === "" ? value : decodeURIComponent(value);
|
||||
}
|
||||
) : {};
|
||||
|
||||
isValid = qp.state === sentState;
|
||||
|
||||
if ((
|
||||
oauth2.auth.schema.get("flow") === "accessCode" ||
|
||||
oauth2.auth.schema.get("flow") === "authorizationCode" ||
|
||||
oauth2.auth.schema.get("flow") === "authorization_code"
|
||||
) && !oauth2.auth.code) {
|
||||
if (!isValid) {
|
||||
oauth2.errCb({
|
||||
authId: oauth2.auth.name,
|
||||
source: "auth",
|
||||
level: "warning",
|
||||
message: "Authorization may be unsafe, passed state was changed in server. The passed state wasn't returned from auth server."
|
||||
});
|
||||
}
|
||||
|
||||
if (qp.code) {
|
||||
delete oauth2.state;
|
||||
oauth2.auth.code = qp.code;
|
||||
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
||||
} else {
|
||||
let oauthErrorMsg;
|
||||
if (qp.error) {
|
||||
oauthErrorMsg = "["+qp.error+"]: " +
|
||||
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
|
||||
(qp.error_uri ? "More info: "+qp.error_uri : "");
|
||||
}
|
||||
|
||||
oauth2.errCb({
|
||||
authId: oauth2.auth.name,
|
||||
source: "auth",
|
||||
level: "error",
|
||||
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server."
|
||||
});
|
||||
}
|
||||
} else {
|
||||
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
|
||||
}
|
||||
window.close();
|
||||
}
|
||||
|
||||
if (document.readyState !== 'loading') {
|
||||
run();
|
||||
} else {
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
run();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
4
frontend/web/api-doc/dist/swagger-config.yaml
vendored
Normal file
4
frontend/web/api-doc/dist/swagger-config.yaml
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
url: "swagger.yaml"
|
||||
dom_id: "#swagger-ui"
|
||||
validatorUrl: "https://validator.swagger.io/validator"
|
20
frontend/web/api-doc/dist/swagger-initializer.js
vendored
Normal file
20
frontend/web/api-doc/dist/swagger-initializer.js
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
window.onload = function() {
|
||||
//<editor-fold desc="Changeable Configuration Block">
|
||||
|
||||
// the following lines will be replaced by docker/configurator, when it runs in a docker-container
|
||||
window.ui = SwaggerUIBundle({
|
||||
url: "swagger.yaml",
|
||||
dom_id: '#swagger-ui',
|
||||
deepLinking: true,
|
||||
presets: [
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIStandalonePreset
|
||||
],
|
||||
plugins: [
|
||||
SwaggerUIBundle.plugins.DownloadUrl
|
||||
],
|
||||
layout: "StandaloneLayout"
|
||||
});
|
||||
|
||||
//</editor-fold>
|
||||
};
|
3
frontend/web/api-doc/dist/swagger-ui-bundle.js
vendored
Normal file
3
frontend/web/api-doc/dist/swagger-ui-bundle.js
vendored
Normal file
File diff suppressed because one or more lines are too long
144
frontend/web/api-doc/dist/swagger-ui-bundle.js.LICENSE.txt
vendored
Normal file
144
frontend/web/api-doc/dist/swagger-ui-bundle.js.LICENSE.txt
vendored
Normal file
@ -0,0 +1,144 @@
|
||||
/*
|
||||
object-assign
|
||||
(c) Sindre Sorhus
|
||||
@license MIT
|
||||
*/
|
||||
|
||||
/*!
|
||||
Copyright (c) 2018 Jed Watson.
|
||||
Licensed under the MIT License (MIT), see
|
||||
http://jedwatson.github.io/classnames
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @description Recursive object extending
|
||||
* @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
|
||||
* @license MIT
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013-2018 Viacheslav Lotsmanov
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* The buffer module from node.js, for the browser.
|
||||
*
|
||||
* @author Feross Aboukhadijeh <https://feross.org>
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/*!
|
||||
* cookie
|
||||
* Copyright(c) 2012-2014 Roman Shtylman
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* https://github.com/Starcounter-Jack/JSON-Patch
|
||||
* (c) 2017-2021 Joachim Wester
|
||||
* MIT license
|
||||
*/
|
||||
|
||||
/*!
|
||||
* https://github.com/Starcounter-Jack/JSON-Patch
|
||||
* (c) 2017-2022 Joachim Wester
|
||||
* MIT licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
||||
*
|
||||
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* repeat-string <https://github.com/jonschlinkert/repeat-string>
|
||||
*
|
||||
* Copyright (c) 2014-2015, Jon Schlinkert.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
/*! @license DOMPurify 3.0.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.1/LICENSE */
|
||||
|
||||
/*! https://mths.be/punycode v1.3.2 by @mathias */
|
||||
|
||||
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
|
||||
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
|
||||
|
||||
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* use-sync-external-store-shim.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* use-sync-external-store-shim/with-selector.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v0.20.2
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v17.0.2
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v17.0.2
|
||||
* react-is.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v17.0.2
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
1
frontend/web/api-doc/dist/swagger-ui-bundle.js.map
vendored
Normal file
1
frontend/web/api-doc/dist/swagger-ui-bundle.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
3
frontend/web/api-doc/dist/swagger-ui-es-bundle-core.js
vendored
Normal file
3
frontend/web/api-doc/dist/swagger-ui-es-bundle-core.js
vendored
Normal file
File diff suppressed because one or more lines are too long
35
frontend/web/api-doc/dist/swagger-ui-es-bundle-core.js.LICENSE.txt
vendored
Normal file
35
frontend/web/api-doc/dist/swagger-ui-es-bundle-core.js.LICENSE.txt
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
/*!
|
||||
* @description Recursive object extending
|
||||
* @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
|
||||
* @license MIT
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013-2018 Viacheslav Lotsmanov
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* The buffer module from node.js, for the browser.
|
||||
*
|
||||
* @author Feross Aboukhadijeh <https://feross.org>
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
1
frontend/web/api-doc/dist/swagger-ui-es-bundle-core.js.map
vendored
Normal file
1
frontend/web/api-doc/dist/swagger-ui-es-bundle-core.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
3
frontend/web/api-doc/dist/swagger-ui-es-bundle.js
vendored
Normal file
3
frontend/web/api-doc/dist/swagger-ui-es-bundle.js
vendored
Normal file
File diff suppressed because one or more lines are too long
144
frontend/web/api-doc/dist/swagger-ui-es-bundle.js.LICENSE.txt
vendored
Normal file
144
frontend/web/api-doc/dist/swagger-ui-es-bundle.js.LICENSE.txt
vendored
Normal file
@ -0,0 +1,144 @@
|
||||
/*
|
||||
object-assign
|
||||
(c) Sindre Sorhus
|
||||
@license MIT
|
||||
*/
|
||||
|
||||
/*!
|
||||
Copyright (c) 2018 Jed Watson.
|
||||
Licensed under the MIT License (MIT), see
|
||||
http://jedwatson.github.io/classnames
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @description Recursive object extending
|
||||
* @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
|
||||
* @license MIT
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013-2018 Viacheslav Lotsmanov
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* The buffer module from node.js, for the browser.
|
||||
*
|
||||
* @author Feross Aboukhadijeh <https://feross.org>
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/*!
|
||||
* cookie
|
||||
* Copyright(c) 2012-2014 Roman Shtylman
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* https://github.com/Starcounter-Jack/JSON-Patch
|
||||
* (c) 2017-2021 Joachim Wester
|
||||
* MIT license
|
||||
*/
|
||||
|
||||
/*!
|
||||
* https://github.com/Starcounter-Jack/JSON-Patch
|
||||
* (c) 2017-2022 Joachim Wester
|
||||
* MIT licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
||||
*
|
||||
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* repeat-string <https://github.com/jonschlinkert/repeat-string>
|
||||
*
|
||||
* Copyright (c) 2014-2015, Jon Schlinkert.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
/*! @license DOMPurify 3.0.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.1/LICENSE */
|
||||
|
||||
/*! https://mths.be/punycode v1.3.2 by @mathias */
|
||||
|
||||
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
|
||||
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
|
||||
|
||||
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* use-sync-external-store-shim.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* use-sync-external-store-shim/with-selector.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v0.20.2
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v17.0.2
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v17.0.2
|
||||
* react-is.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v17.0.2
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
1
frontend/web/api-doc/dist/swagger-ui-es-bundle.js.map
vendored
Normal file
1
frontend/web/api-doc/dist/swagger-ui-es-bundle.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
3
frontend/web/api-doc/dist/swagger-ui-standalone-preset.js
vendored
Normal file
3
frontend/web/api-doc/dist/swagger-ui-standalone-preset.js
vendored
Normal file
File diff suppressed because one or more lines are too long
27
frontend/web/api-doc/dist/swagger-ui-standalone-preset.js.LICENSE.txt
vendored
Normal file
27
frontend/web/api-doc/dist/swagger-ui-standalone-preset.js.LICENSE.txt
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
object-assign
|
||||
(c) Sindre Sorhus
|
||||
@license MIT
|
||||
*/
|
||||
|
||||
/*!
|
||||
* The buffer module from node.js, for the browser.
|
||||
*
|
||||
* @author Feross Aboukhadijeh <https://feross.org>
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
|
||||
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
|
||||
|
||||
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
|
||||
/** @license React v17.0.2
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
1
frontend/web/api-doc/dist/swagger-ui-standalone-preset.js.map
vendored
Normal file
1
frontend/web/api-doc/dist/swagger-ui-standalone-preset.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
3
frontend/web/api-doc/dist/swagger-ui.css
vendored
Normal file
3
frontend/web/api-doc/dist/swagger-ui.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
frontend/web/api-doc/dist/swagger-ui.css.map
vendored
Normal file
1
frontend/web/api-doc/dist/swagger-ui.css.map
vendored
Normal file
File diff suppressed because one or more lines are too long
2
frontend/web/api-doc/dist/swagger-ui.js
vendored
Normal file
2
frontend/web/api-doc/dist/swagger-ui.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
frontend/web/api-doc/dist/swagger-ui.js.map
vendored
Normal file
1
frontend/web/api-doc/dist/swagger-ui.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
79
frontend/web/api-doc/dist/swagger.yaml
vendored
Normal file
79
frontend/web/api-doc/dist/swagger.yaml
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
title: 'Документация Сервис для создания чеков'
|
||||
description: 'Документация для работы с API'
|
||||
version: 1.0.0
|
||||
servers:
|
||||
-
|
||||
url: 'https://check.itguild.info/api'
|
||||
description: 'Основной сервер'
|
||||
-
|
||||
url: 'http://check-back.loc/api'
|
||||
description: 'Локальный сервер'
|
||||
paths:
|
||||
/api: { }
|
||||
/category:
|
||||
get:
|
||||
tags:
|
||||
- Category
|
||||
summary: 'Список категорий компании'
|
||||
description: 'Получить список всех категорий компании'
|
||||
operationId: 9c8a82027f63c2a24be62e4da7f799b8
|
||||
parameters:
|
||||
-
|
||||
name: company_id
|
||||
in: query
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
default: null
|
||||
responses:
|
||||
'200':
|
||||
description: 'Возвращает массив'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
properties: { id: { type: integer, example: '1' }, title: { type: string, example: 'Кальянный клуб LA' }, parent_id: { type: integer, example: '33' }, company_id: { type: integer, example: '23' } }
|
||||
type: object
|
||||
/product:
|
||||
get:
|
||||
tags:
|
||||
- Product
|
||||
summary: 'Список товаров компании'
|
||||
description: 'Получить список всех товаров компании'
|
||||
operationId: fec9052ccf16f32898ba42d5cf697ae5
|
||||
parameters:
|
||||
-
|
||||
name: company_id
|
||||
in: query
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
default: null
|
||||
-
|
||||
name: category_id
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: integer
|
||||
default: null
|
||||
responses:
|
||||
'200':
|
||||
description: 'Возвращает массив'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
properties: { id: { type: integer, example: '1' }, title: { type: string, example: 'Кальянный клуб LA' }, article: { type: string, example: '005' }, type: { type: integer, example: '1' }, price: { type: integer, example: '250' }, status: { type: integer, example: '1' }, product_category_id: { type: integer, example: '5' }, company_id: { type: integer, example: '23' } }
|
||||
type: object
|
||||
components:
|
||||
securitySchemes:
|
||||
bearerAuth:
|
||||
type: http
|
||||
name: Authorization
|
||||
in: header
|
||||
bearerFormat: JWT
|
||||
scheme: bearer
|
13
frontend/web/api-doc/docker/configurator/helpers.js
Normal file
13
frontend/web/api-doc/docker/configurator/helpers.js
Normal file
@ -0,0 +1,13 @@
|
||||
module.exports.indent = function indent(str, len, fromLine = 0) {
|
||||
|
||||
return str
|
||||
.split("\n")
|
||||
.map((line, i) => {
|
||||
if (i + 1 >= fromLine) {
|
||||
return `${Array(len + 1).join(" ")}${line}`
|
||||
} else {
|
||||
return line
|
||||
}
|
||||
})
|
||||
.join("\n")
|
||||
}
|
52
frontend/web/api-doc/docker/configurator/index.js
Executable file
52
frontend/web/api-doc/docker/configurator/index.js
Executable file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Replace static code with configured data based on environment-variables.
|
||||
* This code should be called BEFORE the webserver serve the api-documentation.
|
||||
*/
|
||||
const fs = require("fs")
|
||||
const path = require("path")
|
||||
|
||||
const translator = require("./translator")
|
||||
const oauthBlockBuilder = require("./oauth")
|
||||
const indent = require("./helpers").indent
|
||||
|
||||
const START_MARKER = "//<editor-fold desc=\"Changeable Configuration Block\">"
|
||||
const END_MARKER = "//</editor-fold>"
|
||||
|
||||
const targetPath = path.normalize(process.cwd() + "/" + process.argv[2])
|
||||
|
||||
const originalHtmlContent = fs.readFileSync(targetPath, "utf8")
|
||||
|
||||
const startMarkerIndex = originalHtmlContent.indexOf(START_MARKER)
|
||||
const endMarkerIndex = originalHtmlContent.indexOf(END_MARKER)
|
||||
|
||||
const beforeStartMarkerContent = originalHtmlContent.slice(0, startMarkerIndex)
|
||||
const afterEndMarkerContent = originalHtmlContent.slice(
|
||||
endMarkerIndex + END_MARKER.length
|
||||
)
|
||||
|
||||
if (startMarkerIndex < 0 || endMarkerIndex < 0) {
|
||||
console.error("ERROR: Swagger UI was unable to inject Docker configuration data!")
|
||||
console.error("! This can happen when you provide custom HTML/JavaScript to Swagger UI.")
|
||||
console.error("! ")
|
||||
console.error(`! In order to solve this, add the "${START_MARKER}"`)
|
||||
console.error(`! and "${END_MARKER}" markers to your JavaScript.`)
|
||||
console.error("! See the repository for an example:")
|
||||
console.error("! https://github.com/swagger-api/swagger-ui/blob/8c946a02e73ef877d73b7635de27924418ba50f3/dist/swagger-initializer.js#L2-L19")
|
||||
console.error("! ")
|
||||
console.error("! If you're seeing this message and aren't using custom HTML,")
|
||||
console.error("! this message may be a bug. Please file an issue:")
|
||||
console.error("! https://github.com/swagger-api/swagger-ui/issues/new/choose")
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
fs.writeFileSync(
|
||||
targetPath,
|
||||
`${beforeStartMarkerContent}
|
||||
${START_MARKER}
|
||||
window.ui = SwaggerUIBundle({
|
||||
${indent(translator(process.env, {injectBaseConfig: true}), 8, 2)}
|
||||
})
|
||||
${indent(oauthBlockBuilder(process.env), 6, 2)}
|
||||
${END_MARKER}
|
||||
${afterEndMarkerContent}`
|
||||
)
|
55
frontend/web/api-doc/docker/configurator/oauth.js
Normal file
55
frontend/web/api-doc/docker/configurator/oauth.js
Normal file
@ -0,0 +1,55 @@
|
||||
const translator = require("./translator")
|
||||
const indent = require("./helpers").indent
|
||||
|
||||
const oauthBlockSchema = {
|
||||
OAUTH_CLIENT_ID: {
|
||||
type: "string",
|
||||
name: "clientId"
|
||||
},
|
||||
OAUTH_CLIENT_SECRET: {
|
||||
type: "string",
|
||||
name: "clientSecret",
|
||||
onFound: () => console.warn("Swagger UI warning: don't use `OAUTH_CLIENT_SECRET` in production!")
|
||||
},
|
||||
OAUTH_REALM: {
|
||||
type: "string",
|
||||
name: "realm"
|
||||
},
|
||||
OAUTH_APP_NAME: {
|
||||
type: "string",
|
||||
name: "appName"
|
||||
},
|
||||
OAUTH_SCOPE_SEPARATOR: {
|
||||
type: "string",
|
||||
name: "scopeSeparator"
|
||||
},
|
||||
OAUTH_SCOPES: {
|
||||
type: "string",
|
||||
name: "scopes"
|
||||
},
|
||||
OAUTH_ADDITIONAL_PARAMS: {
|
||||
type: "object",
|
||||
name: "additionalQueryStringParams"
|
||||
},
|
||||
OAUTH_USE_BASIC_AUTH: {
|
||||
type: "boolean",
|
||||
name: "useBasicAuthenticationWithAccessCodeGrant"
|
||||
},
|
||||
OAUTH_USE_PKCE: {
|
||||
type: "boolean",
|
||||
name: "usePkceWithAuthorizationCodeGrant"
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function oauthBlockBuilder(env) {
|
||||
const translatorResult = translator(env, { schema: oauthBlockSchema })
|
||||
|
||||
if(translatorResult) {
|
||||
return (
|
||||
`ui.initOAuth({
|
||||
${indent(translatorResult, 2)}
|
||||
})`)
|
||||
}
|
||||
|
||||
return ``
|
||||
}
|
111
frontend/web/api-doc/docker/configurator/translator.js
Normal file
111
frontend/web/api-doc/docker/configurator/translator.js
Normal file
@ -0,0 +1,111 @@
|
||||
// Converts an object of environment variables into a Swagger UI config object
|
||||
const configSchema = require("./variables")
|
||||
|
||||
const defaultBaseConfig = {
|
||||
url: {
|
||||
value: "https://petstore.swagger.io/v2/swagger.json",
|
||||
schema: {
|
||||
type: "string",
|
||||
base: true
|
||||
}
|
||||
},
|
||||
dom_id: {
|
||||
value: "#swagger-ui",
|
||||
schema: {
|
||||
type: "string",
|
||||
base: true
|
||||
}
|
||||
},
|
||||
deepLinking: {
|
||||
value: "true",
|
||||
schema: {
|
||||
type: "boolean",
|
||||
base: true
|
||||
}
|
||||
},
|
||||
presets: {
|
||||
value: `[\n SwaggerUIBundle.presets.apis,\n SwaggerUIStandalonePreset\n]`,
|
||||
schema: {
|
||||
type: "array",
|
||||
base: true
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
value: `[\n SwaggerUIBundle.plugins.DownloadUrl\n]`,
|
||||
schema: {
|
||||
type: "array",
|
||||
base: true
|
||||
}
|
||||
},
|
||||
layout: {
|
||||
value: "StandaloneLayout",
|
||||
schema: {
|
||||
type: "string",
|
||||
base: true
|
||||
}
|
||||
},
|
||||
queryConfigEnabled: {
|
||||
value: "false",
|
||||
schema: {
|
||||
type: "boolean",
|
||||
base: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function objectToKeyValueString(env, { injectBaseConfig = false, schema = configSchema, baseConfig = defaultBaseConfig } = {}) {
|
||||
let valueStorage = injectBaseConfig ? Object.assign({}, baseConfig) : {}
|
||||
const keys = Object.keys(env)
|
||||
|
||||
// Compute an intermediate representation that holds candidate values and schemas.
|
||||
//
|
||||
// This is useful for deduping between multiple env keys that set the same
|
||||
// config variable.
|
||||
|
||||
keys.forEach(key => {
|
||||
const varSchema = schema[key]
|
||||
const value = env[key]
|
||||
|
||||
if(!varSchema) return
|
||||
|
||||
if(varSchema.onFound) {
|
||||
varSchema.onFound()
|
||||
}
|
||||
|
||||
const storageContents = valueStorage[varSchema.name]
|
||||
|
||||
if(storageContents) {
|
||||
if (varSchema.legacy === true && !storageContents.schema.base) {
|
||||
// If we're looking at a legacy var, it should lose out to any already-set value
|
||||
// except for base values
|
||||
return
|
||||
}
|
||||
delete valueStorage[varSchema.name]
|
||||
}
|
||||
|
||||
valueStorage[varSchema.name] = {
|
||||
value,
|
||||
schema: varSchema
|
||||
}
|
||||
})
|
||||
|
||||
// Compute a key:value string based on valueStorage's contents.
|
||||
|
||||
let result = ""
|
||||
|
||||
Object.keys(valueStorage).forEach(key => {
|
||||
const value = valueStorage[key]
|
||||
|
||||
const escapedName = /[^a-zA-Z0-9]/.test(key) ? `"${key}"` : key
|
||||
|
||||
if (value.schema.type === "string") {
|
||||
result += `${escapedName}: "${value.value}",\n`
|
||||
} else {
|
||||
result += `${escapedName}: ${value.value === "" ? `undefined` : value.value},\n`
|
||||
}
|
||||
})
|
||||
|
||||
return result.trim()
|
||||
}
|
||||
|
||||
module.exports = objectToKeyValueString
|
125
frontend/web/api-doc/docker/configurator/variables.js
Normal file
125
frontend/web/api-doc/docker/configurator/variables.js
Normal file
@ -0,0 +1,125 @@
|
||||
const standardVariables = {
|
||||
CONFIG_URL: {
|
||||
type: "string",
|
||||
name: "configUrl"
|
||||
},
|
||||
DOM_ID: {
|
||||
type: "string",
|
||||
name: "dom_id"
|
||||
},
|
||||
SPEC: {
|
||||
type: "object",
|
||||
name: "spec"
|
||||
},
|
||||
URL: {
|
||||
type: "string",
|
||||
name: "url"
|
||||
},
|
||||
URLS: {
|
||||
type: "array",
|
||||
name: "urls"
|
||||
},
|
||||
URLS_PRIMARY_NAME: {
|
||||
type: "string",
|
||||
name: "urls.primaryName"
|
||||
},
|
||||
QUERY_CONFIG_ENABLED: {
|
||||
type: "boolean",
|
||||
name: "queryConfigEnabled"
|
||||
},
|
||||
LAYOUT: {
|
||||
type: "string",
|
||||
name: "layout"
|
||||
},
|
||||
DEEP_LINKING: {
|
||||
type: "boolean",
|
||||
name: "deepLinking"
|
||||
},
|
||||
DISPLAY_OPERATION_ID: {
|
||||
type: "boolean",
|
||||
name: "displayOperationId"
|
||||
},
|
||||
DEFAULT_MODELS_EXPAND_DEPTH: {
|
||||
type: "number",
|
||||
name: "defaultModelsExpandDepth"
|
||||
},
|
||||
DEFAULT_MODEL_EXPAND_DEPTH: {
|
||||
type: "number",
|
||||
name: "defaultModelExpandDepth"
|
||||
},
|
||||
DEFAULT_MODEL_RENDERING: {
|
||||
type: "string",
|
||||
name: "defaultModelRendering"
|
||||
},
|
||||
DISPLAY_REQUEST_DURATION: {
|
||||
type: "boolean",
|
||||
name: "displayRequestDuration"
|
||||
},
|
||||
DOC_EXPANSION: {
|
||||
type: "string",
|
||||
name: "docExpansion"
|
||||
},
|
||||
FILTER: {
|
||||
type: "string",
|
||||
name: "filter"
|
||||
},
|
||||
MAX_DISPLAYED_TAGS: {
|
||||
type: "number",
|
||||
name: "maxDisplayedTags"
|
||||
},
|
||||
SHOW_EXTENSIONS: {
|
||||
type: "boolean",
|
||||
name: "showExtensions"
|
||||
},
|
||||
SHOW_COMMON_EXTENSIONS: {
|
||||
type: "boolean",
|
||||
name: "showCommonExtensions"
|
||||
},
|
||||
USE_UNSAFE_MARKDOWN: {
|
||||
type: "boolean",
|
||||
name: "useUnsafeMarkdown"
|
||||
},
|
||||
OAUTH2_REDIRECT_URL: {
|
||||
type: "string",
|
||||
name: "oauth2RedirectUrl"
|
||||
},
|
||||
PERSIST_AUTHORIZATION: {
|
||||
type: "boolean",
|
||||
name: "persistAuthorization"
|
||||
},
|
||||
SHOW_MUTATED_REQUEST: {
|
||||
type: "boolean",
|
||||
name: "showMutatedRequest"
|
||||
},
|
||||
SUPPORTED_SUBMIT_METHODS: {
|
||||
type: "array",
|
||||
name: "supportedSubmitMethods"
|
||||
},
|
||||
TRY_IT_OUT_ENABLED: {
|
||||
type: "boolean",
|
||||
name: "tryItOutEnabled"
|
||||
},
|
||||
VALIDATOR_URL: {
|
||||
type: "string",
|
||||
name: "validatorUrl"
|
||||
},
|
||||
WITH_CREDENTIALS: {
|
||||
type: "boolean",
|
||||
name: "withCredentials",
|
||||
}
|
||||
}
|
||||
|
||||
const legacyVariables = {
|
||||
API_URL: {
|
||||
type: "string",
|
||||
name: "url",
|
||||
legacy: true
|
||||
},
|
||||
API_URLS: {
|
||||
type: "array",
|
||||
name: "urls",
|
||||
legacy: true
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Object.assign({}, standardVariables, legacyVariables)
|
14
frontend/web/api-doc/docker/cors.conf
Normal file
14
frontend/web/api-doc/docker/cors.conf
Normal file
@ -0,0 +1,14 @@
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
||||
#
|
||||
# Custom headers and headers various browsers *should* be OK with but aren't
|
||||
#
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type' always;
|
||||
#
|
||||
# Tell client that this pre-flight info is valid for 20 days
|
||||
#
|
||||
add_header 'Access-Control-Max-Age' $access_control_max_age always;
|
||||
|
||||
if ($request_method = OPTIONS) {
|
||||
return 204;
|
||||
}
|
52
frontend/web/api-doc/docker/docker-entrypoint.d/40-swagger-ui.sh
Executable file
52
frontend/web/api-doc/docker/docker-entrypoint.d/40-swagger-ui.sh
Executable file
@ -0,0 +1,52 @@
|
||||
#! /bin/sh
|
||||
|
||||
set -e
|
||||
BASE_URL=${BASE_URL:-/}
|
||||
NGINX_ROOT=/usr/share/nginx/html
|
||||
INITIALIZER_SCRIPT=$NGINX_ROOT/swagger-initializer.js
|
||||
NGINX_CONF=/etc/nginx/nginx.conf
|
||||
|
||||
node /usr/share/nginx/configurator $INITIALIZER_SCRIPT
|
||||
|
||||
|
||||
if [[ "${BASE_URL}" != "/" ]]; then
|
||||
sed -i "s|location / {|location $BASE_URL {|g" $NGINX_CONF
|
||||
fi
|
||||
|
||||
if [ "$SWAGGER_JSON_URL" ]; then
|
||||
sed -i "s|https://petstore.swagger.io/v2/swagger.json|$SWAGGER_JSON_URL|g" $INITIALIZER_SCRIPT
|
||||
sed -i "s|http://example.com/api|$SWAGGER_JSON_URL|g" $INITIALIZER_SCRIPT
|
||||
fi
|
||||
|
||||
if [[ -f "$SWAGGER_JSON" ]]; then
|
||||
cp -s "$SWAGGER_JSON" "$NGINX_ROOT"
|
||||
REL_PATH="./$(basename $SWAGGER_JSON)"
|
||||
|
||||
if [[ -z "$SWAGGER_ROOT" ]]; then
|
||||
SWAGGER_ROOT="$(dirname $SWAGGER_JSON)"
|
||||
fi
|
||||
|
||||
if [[ "$BASE_URL" != "/" ]]
|
||||
then
|
||||
BASE_URL=$(echo $BASE_URL | sed 's/\/$//')
|
||||
sed -i \
|
||||
"s|#SWAGGER_ROOT|rewrite ^$BASE_URL(/.*)$ \$1 break;\n #SWAGGER_ROOT|" \
|
||||
$NGINX_CONF
|
||||
fi
|
||||
sed -i "s|#SWAGGER_ROOT|root $SWAGGER_ROOT/;|g" $NGINX_CONF
|
||||
|
||||
sed -i "s|https://petstore.swagger.io/v2/swagger.json|$REL_PATH|g" $INITIALIZER_SCRIPT
|
||||
sed -i "s|http://example.com/api|$REL_PATH|g" $INITIALIZER_SCRIPT
|
||||
fi
|
||||
|
||||
# enable/disable the address and port for IPv6 addresses that nginx listens on
|
||||
if [[ -n "${PORT_IPV6}" ]]; then
|
||||
sed -i "s|8080;|8080;\n listen [::]:${PORT_IPV6};|g" $NGINX_CONF
|
||||
fi
|
||||
|
||||
# replace the PORT that nginx listens on if PORT is supplied
|
||||
if [[ -n "${PORT}" ]]; then
|
||||
sed -i "s|8080|${PORT}|g" $NGINX_CONF
|
||||
fi
|
||||
|
||||
find $NGINX_ROOT -type f -regex ".*\.\(html\|js\|css\)" -exec sh -c "gzip < {} > {}.gz" \;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user