add Telegram bot tokens table and API methods

This commit is contained in:
iIronside
2023-10-24 13:34:23 +03:00
parent 3c9204f61a
commit da08bcf1b2
7 changed files with 417 additions and 1 deletions

View File

@ -0,0 +1,69 @@
<?php
namespace frontend\modules\api\models;
use frontend\modules\api\models\profile\User;
use yii\db\ActiveQuery;
/**
*
* @OA\Schema(
* schema="UserTgBotToken",
* @OA\Property(
* property="token",
* type="string",
* example= "HDAS7J",
* description="Токен ТГ бота"
* ),
* @OA\Property(
* property="expired_at",
* type="dateTime",
* example="2023-10-24 10:05:54",
* description="Время истечения активности токена"
* ),
*)
*
*
* @OA\Schema(
* schema="UserTgBotTokenExample",
* @OA\Property(
* property="token",
* type="string",
* example="HDAS7J"
* ),
* @OA\Property(
* property="expired_at",
* type="dateTime",
* example="2023-10-24 10:05:54"
* ),
*)
*
* @property User $user
*/
class UserTgBotToken extends \common\models\UserTgBotToken
{
public function fields(): array
{
return [
'token',
'expired_at',
];
}
/**
* @return string[]
*/
public function extraFields(): array
{
return [];
}
/**
* @return ActiveQuery
*/
public function getUser()
{
return $this->hasOne(User::class, ['id' => 'user_id']);
}
}