-
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from HiEventsDev/develop
main <- develop
- Loading branch information
Showing
43 changed files
with
923 additions
and
492 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
backend/app/Services/Domain/Question/EditQuestionService.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace HiEvents\Services\Domain\Question; | ||
|
||
use HiEvents\DomainObjects\Generated\QuestionDomainObjectAbstract; | ||
use HiEvents\DomainObjects\QuestionDomainObject; | ||
use HiEvents\DomainObjects\TicketDomainObject; | ||
use HiEvents\Repository\Interfaces\QuestionRepositoryInterface; | ||
use HTMLPurifier; | ||
use Illuminate\Database\DatabaseManager; | ||
use Throwable; | ||
|
||
class EditQuestionService | ||
{ | ||
public function __construct( | ||
private readonly QuestionRepositoryInterface $questionRepository, | ||
private readonly DatabaseManager $databaseManager, | ||
private readonly HTMLPurifier $purifier, | ||
) | ||
{ | ||
} | ||
|
||
/** | ||
* @throws Throwable | ||
*/ | ||
public function editQuestion( | ||
QuestionDomainObject $question, | ||
array $ticketIds, | ||
): QuestionDomainObject | ||
{ | ||
return $this->databaseManager->transaction(function () use ($question, $ticketIds) { | ||
$this->questionRepository->updateQuestion( | ||
questionId: $question->getId(), | ||
eventId: $question->getEventId(), | ||
attributes: [ | ||
QuestionDomainObjectAbstract::TITLE => $question->getTitle(), | ||
QuestionDomainObjectAbstract::EVENT_ID => $question->getEventId(), | ||
QuestionDomainObjectAbstract::BELONGS_TO => $question->getBelongsTo(), | ||
QuestionDomainObjectAbstract::TYPE => $question->getType(), | ||
QuestionDomainObjectAbstract::REQUIRED => $question->getRequired(), | ||
QuestionDomainObjectAbstract::OPTIONS => $question->getOptions(), | ||
QuestionDomainObjectAbstract::IS_HIDDEN => $question->getIsHidden(), | ||
QuestionDomainObjectAbstract::DESCRIPTION => $this->purifier->purify($question->getDescription()), | ||
], | ||
ticketIds: $ticketIds | ||
); | ||
|
||
return $this->questionRepository | ||
->loadRelation(TicketDomainObject::class) | ||
->findById($question->getId()); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
backend/database/migrations/2024_07_11_223142_add_description_to_questions_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration { | ||
public function up(): void | ||
{ | ||
Schema::table('questions', static function (Blueprint $table) { | ||
$table->text('description')->nullable(); | ||
}); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
Schema::table('questions', static function (Blueprint $table) { | ||
$table->dropColumn('description'); | ||
}); | ||
} | ||
}; |
Oops, something went wrong.