swagger project list

This commit is contained in:
2023-04-19 01:22:57 +03:00
parent 5ea572e698
commit ea7c781d06
3 changed files with 153 additions and 5 deletions

View File

@ -2,6 +2,52 @@
namespace frontend\modules\api\models;
/**
*
* @OA\Schema(
* schema="Company",
* @OA\Property(
* property="id",
* type="int",
* example=1,
* description="Идентификатор компании"
* ),
* @OA\Property(
* property="name",
* type="string",
* example="OhDesign",
* description="Название компании"
* ),
* @OA\Property(
* property="description",
* type="string",
* example="Компания разрабатывает сайт для дизайнеров",
* description="Описание компании"
* ),
*)
*
* @OA\Schema(
* schema="CompanyExample",
* type="array",
* example={{"id": 1, "name": "GoDesigner", "description": "Сайт для дизайнеров"}, {"id": 2, "name": "PR Holding", "description": "Сайт для маркетологов"}},
* @OA\Items(
* type="object",
* @OA\Property(
* property="id",
* type="integer",
* ),
* @OA\Property(
* property="name",
* type="string",
* ),
* @OA\Property(
* property="description",
* type="string",
* ),
* ),
*)
*
*/
class Company extends \common\models\Company
{
public function fields()

View File

@ -7,14 +7,81 @@ use yii\helpers\Url;
use yii\web\Link;
use yii\web\Linkable;
class Project extends \common\models\Project implements Linkable
/**
*
* @OA\Schema(
* schema="Project",
* @OA\Property(
* property="id",
* type="int",
* example=1,
* description="Идентификатор проекта"
* ),
* @OA\Property(
* property="name",
* type="string",
* example="PHP",
* description="Название проекта"
* ),
* @OA\Property(
* property="status",
* type="int",
* example="10",
* description="Статус проекта"
* ),
* @OA\Property(
* property="hh_id",
* type="int",
* example="234",
* description="Идентификатор проекта на hh.ru"
* ),
* @OA\Property(
* property="company",
* ref="#/components/schemas/Company",
* ),
*)
*
* @OA\Schema(
* schema="ProjectExample",
* type="array",
* @OA\Items(
* type="object",
* @OA\Property(
* property="id",
* type="integer",
* example="1"
* ),
* @OA\Property(
* property="name",
* type="string",
* example="OhDesign - backend"
* ),
* @OA\Property(
* property="status",
* type="integer",
* example="10"
* ),
* @OA\Property(
* property="hh_id",
* type="integer",
* example="345343434"
* ),
* @OA\Property(
* property="company",
* ref="#/components/schemas/Company",
* ),
* ),
*)
*
*/
class Project extends \common\models\Project
{
public function fields(): array
{
return [
'id',
'name',
'budget',
//'budget',
'status',
'hh_id' => function() {
return $this->hh;