guild/frontend/modules/api/controllers/ProfileController.php

39 lines
903 B
PHP
Raw Normal View History

2021-06-25 18:11:30 +03:00
<?php
namespace frontend\modules\api\controllers;
use common\services\ProfileService;
use yii\web\BadRequestHttpException;
use yii\web\ServerErrorHttpException;
2022-01-14 12:56:39 +03:00
2021-11-29 18:21:50 +03:00
class ProfileController extends ApiController
2021-06-25 18:11:30 +03:00
{
2022-03-21 14:56:21 +03:00
public function verbs(): array
2021-06-25 18:11:30 +03:00
{
2022-03-21 14:56:21 +03:00
return [
'' => ['get'],
'profile-with-report-permission' => ['post', 'patch']
2021-06-25 18:11:30 +03:00
];
}
public function actionIndex($id = null): ?array
2021-06-25 18:11:30 +03:00
{
2022-03-21 14:56:21 +03:00
return ProfileService::getProfile($id, \Yii::$app->request->get());
2021-07-03 15:15:54 +03:00
}
2022-03-21 14:56:21 +03:00
/**
* @throws BadRequestHttpException
*/
public function actionProfileWithReportPermission($id): ?array
2021-09-07 16:32:57 +03:00
{
2022-03-21 14:56:21 +03:00
return ProfileService::getProfileWithReportPermission($id);
2021-09-07 16:32:57 +03:00
}
/**
* @throws ServerErrorHttpException
*/
public function actionGetMainData($user_id): array
{
return ProfileService::getMainData($user_id);
}
2022-03-21 14:56:21 +03:00
}