diff --git a/hwe/sammo/API/Vote/NewVote.php b/hwe/sammo/API/Vote/NewVote.php index 519dd078..507b759e 100644 --- a/hwe/sammo/API/Vote/NewVote.php +++ b/hwe/sammo/API/Vote/NewVote.php @@ -7,6 +7,7 @@ use sammo\DB; use sammo\DTO\VoteInfo; use sammo\Enums\APIRecoveryType; use sammo\KVStorage; +use sammo\RootDB; use sammo\Session; use sammo\TimeUtil; use sammo\Util; @@ -93,6 +94,8 @@ class NewVote extends \sammo\BaseAPI } } + $userName = $session->userName; + $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); @@ -108,9 +111,11 @@ class NewVote extends \sammo\BaseAPI $multipleOptions = Util::valueFit($multipleOptions, 0, count($options)); + $voteInfo = new VoteInfo( id: $voteID, title: $title, + opener: $userName ?? '[SYSTEM]', multipleOptions: $multipleOptions, startDate: $now, endDate: $endDate, diff --git a/hwe/sammo/DTO/VoteInfo.php b/hwe/sammo/DTO/VoteInfo.php index 9e8e3b74..e6f817ab 100644 --- a/hwe/sammo/DTO/VoteInfo.php +++ b/hwe/sammo/DTO/VoteInfo.php @@ -8,6 +8,7 @@ class VoteInfo extends \LDTO\DTO public int $id, public string $title, public int $multipleOptions, + public ?string $opener, public string $startDate, public ?string $endDate,