feat: BaseAPI의 launch()에 타입 지정
- APIRecoveryType이 명시
This commit is contained in:
@@ -5,6 +5,7 @@ namespace sammo\API\Vote;
|
||||
use DateTimeInterface;
|
||||
use sammo\DB;
|
||||
use sammo\DTO\VoteComment;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\General;
|
||||
use sammo\Session;
|
||||
use sammo\TimeUtil;
|
||||
@@ -33,7 +34,7 @@ class AddComment extends \sammo\BaseAPI
|
||||
return null;
|
||||
}
|
||||
|
||||
function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||
function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
||||
{
|
||||
$voteID = $this->args['voteID'];
|
||||
$text = mb_substr($this->args['text'], 0, 200);
|
||||
|
||||
@@ -7,6 +7,7 @@ use DateTimeInterface;
|
||||
use sammo\DB;
|
||||
use sammo\DTO\VoteComment;
|
||||
use sammo\DTO\VoteInfo;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\Json;
|
||||
use sammo\KVStorage;
|
||||
use sammo\Validator;
|
||||
@@ -30,7 +31,7 @@ class GetVoteDetail extends \sammo\BaseAPI
|
||||
return static::REQ_LOGIN | static::REQ_READ_ONLY;
|
||||
}
|
||||
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
||||
{
|
||||
$voteID = $this->args['voteID'];
|
||||
$db = DB::db();
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace sammo\API\Vote;
|
||||
use DateTimeInterface;
|
||||
use sammo\DB;
|
||||
use sammo\DTO\VoteInfo;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\KVStorage;
|
||||
use sammo\Session;
|
||||
|
||||
@@ -21,7 +22,7 @@ class GetVoteList extends \sammo\BaseAPI
|
||||
return static::REQ_LOGIN | static::REQ_READ_ONLY;
|
||||
}
|
||||
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
||||
{
|
||||
$db = DB::db();
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace sammo\API\Vote;
|
||||
use DateTimeInterface;
|
||||
use sammo\DB;
|
||||
use sammo\DTO\VoteInfo;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\KVStorage;
|
||||
use sammo\Session;
|
||||
use sammo\TimeUtil;
|
||||
@@ -52,7 +53,7 @@ class NewVote extends \sammo\BaseAPI
|
||||
$voteStor->setValue("vote_{$voteID}", $lastVoteInfo->toArray());
|
||||
}
|
||||
|
||||
function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||
function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
||||
{
|
||||
$isVoteAdmin = in_array('vote', $session->acl[DB::prefix()] ?? []);
|
||||
$isVoteAdmin = $isVoteAdmin || $session->userGrade >= 5;
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace sammo\API\Vote;
|
||||
use DateTimeInterface;
|
||||
use sammo\DB;
|
||||
use sammo\DTO\VoteInfo;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\General;
|
||||
use sammo\Json;
|
||||
use sammo\KVStorage;
|
||||
@@ -42,7 +43,7 @@ class Vote extends \sammo\BaseAPI
|
||||
return null;
|
||||
}
|
||||
|
||||
function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||
function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
||||
{
|
||||
|
||||
$voteID = $this->args['voteID'];
|
||||
|
||||
Reference in New Issue
Block a user