mirror of
https://github.com/Karaka-Management/oms-Comments.git
synced 2026-02-14 16:28:42 +00:00
Automated formatting changes
This commit is contained in:
parent
aadb600397
commit
8cf249716a
|
|
@ -18,12 +18,12 @@ namespace Modules\Comments\Controller;
|
||||||
|
|
||||||
use Modules\Admin\Models\NullAccount;
|
use Modules\Admin\Models\NullAccount;
|
||||||
use Modules\Comments\Models\Comment;
|
use Modules\Comments\Models\Comment;
|
||||||
use Modules\Comments\Models\CommentVote;
|
|
||||||
use Modules\Comments\Models\NullCommentVote;
|
|
||||||
use Modules\Comments\Models\CommentVoteMapper;
|
|
||||||
use Modules\Comments\Models\CommentList;
|
use Modules\Comments\Models\CommentList;
|
||||||
use Modules\Comments\Models\CommentListMapper;
|
use Modules\Comments\Models\CommentListMapper;
|
||||||
use Modules\Comments\Models\CommentMapper;
|
use Modules\Comments\Models\CommentMapper;
|
||||||
|
use Modules\Comments\Models\CommentVote;
|
||||||
|
use Modules\Comments\Models\CommentVoteMapper;
|
||||||
|
use Modules\Comments\Models\NullCommentVote;
|
||||||
use phpOMS\Message\Http\RequestStatusCode;
|
use phpOMS\Message\Http\RequestStatusCode;
|
||||||
use phpOMS\Message\NotificationLevel;
|
use phpOMS\Message\NotificationLevel;
|
||||||
use phpOMS\Message\RequestAbstract;
|
use phpOMS\Message\RequestAbstract;
|
||||||
|
|
@ -290,14 +290,14 @@ final class ApiController extends Controller
|
||||||
$vote = CommentVoteMapper::findVote((int) $reqeust->getData('id'), $request->header->account);
|
$vote = CommentVoteMapper::findVote((int) $reqeust->getData('id'), $request->header->account);
|
||||||
|
|
||||||
if ($vote instanceof NullCommentVote) {
|
if ($vote instanceof NullCommentVote) {
|
||||||
$new = new CommentVote();
|
$new = new CommentVote();
|
||||||
$new->score = (int) $request->getData('type');
|
$new->score = (int) $request->getData('type');
|
||||||
$new->createdBy = $request->header->account;
|
$new->createdBy = $request->header->account;
|
||||||
|
|
||||||
$this->createModel($request->header->account, $new, CommentVoteMapper::class, 'comment_vote', $request->getOrigin());
|
$this->createModel($request->header->account, $new, CommentVoteMapper::class, 'comment_vote', $request->getOrigin());
|
||||||
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Vote', 'Sucessfully voted.', $new);
|
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Vote', 'Sucessfully voted.', $new);
|
||||||
} else {
|
} else {
|
||||||
$new = clone $vote;
|
$new = clone $vote;
|
||||||
$new->score = (int) $request->getData('type');
|
$new->score = (int) $request->getData('type');
|
||||||
|
|
||||||
$this->updateModel($request->header->account, $vote, $new, CommentVoteMapper::class, 'comment_vote', $request->getOrigin());
|
$this->updateModel($request->header->account, $vote, $new, CommentVoteMapper::class, 'comment_vote', $request->getOrigin());
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ final class CommentVoteMapper extends DataMapperAbstract
|
||||||
*/
|
*/
|
||||||
protected static array $columns = [
|
protected static array $columns = [
|
||||||
'comments_comment_vote_id' => ['name' => 'comments_comment_vote_id', 'type' => 'int', 'internal' => 'id'],
|
'comments_comment_vote_id' => ['name' => 'comments_comment_vote_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'comments_comment_vote_score' => ['name' => 'comments_comment_vote_score', 'type' => 'int', 'internal' => 'score'],
|
'comments_comment_vote_score' => ['name' => 'comments_comment_vote_score', 'type' => 'int', 'internal' => 'score'],
|
||||||
'comments_comment_vote_comment' => ['name' => 'comments_comment_vote_comment', 'type' => 'int', 'internal' => 'comment', 'readonly' => true],
|
'comments_comment_vote_comment' => ['name' => 'comments_comment_vote_comment', 'type' => 'int', 'internal' => 'comment', 'readonly' => true],
|
||||||
'comments_comment_vote_created_by' => ['name' => 'comments_comment_vote_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
'comments_comment_vote_created_by' => ['name' => 'comments_comment_vote_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
|
||||||
'comments_comment_vote_created_at' => ['name' => 'comments_comment_vote_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
'comments_comment_vote_created_at' => ['name' => 'comments_comment_vote_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user