feat: CI/CD pipeline setup complete - Ansible playbooks updated, secrets configured, workflow ready
This commit is contained in:
@@ -8,7 +8,9 @@ use App\Domain\PreSave\PreSaveCampaignRepositoryInterface;
|
||||
use App\Domain\PreSave\PreSaveRegistration;
|
||||
use App\Domain\PreSave\PreSaveRegistrationRepositoryInterface;
|
||||
use App\Domain\PreSave\ValueObjects\StreamingPlatform;
|
||||
use App\Framework\Exception\ErrorCode;
|
||||
use App\Framework\Exception\Core\AuthErrorCode;
|
||||
use App\Framework\Exception\Core\DatabaseErrorCode;
|
||||
use App\Framework\Exception\Core\ValidationErrorCode;
|
||||
use App\Framework\Exception\FrameworkException;
|
||||
use App\Framework\OAuth\OAuthServiceInterface;
|
||||
|
||||
@@ -38,14 +40,14 @@ final readonly class PreSaveCampaignService
|
||||
|
||||
if ($campaign === null) {
|
||||
throw FrameworkException::create(
|
||||
ErrorCode::ENTITY_NOT_FOUND,
|
||||
DatabaseErrorCode::ENTITY_NOT_FOUND,
|
||||
'Campaign not found'
|
||||
)->withData(['campaign_id' => $campaignId]);
|
||||
}
|
||||
|
||||
if (! $campaign->acceptsRegistrations()) {
|
||||
throw FrameworkException::create(
|
||||
ErrorCode::VAL_BUSINESS_RULE_VIOLATION,
|
||||
ValidationErrorCode::BUSINESS_RULE_VIOLATION,
|
||||
'Campaign is not accepting registrations'
|
||||
)->withData([
|
||||
'campaign_id' => $campaignId,
|
||||
@@ -55,7 +57,7 @@ final readonly class PreSaveCampaignService
|
||||
|
||||
if (! $campaign->hasPlatform($platform)) {
|
||||
throw FrameworkException::create(
|
||||
ErrorCode::VAL_BUSINESS_RULE_VIOLATION,
|
||||
ValidationErrorCode::BUSINESS_RULE_VIOLATION,
|
||||
'Campaign does not support this platform'
|
||||
)->withData([
|
||||
'campaign_id' => $campaignId,
|
||||
@@ -66,7 +68,7 @@ final readonly class PreSaveCampaignService
|
||||
// Check if already registered
|
||||
if ($this->registrationRepository->hasRegistered($userId, $campaignId, $platform)) {
|
||||
throw FrameworkException::create(
|
||||
ErrorCode::VAL_BUSINESS_RULE_VIOLATION,
|
||||
ValidationErrorCode::BUSINESS_RULE_VIOLATION,
|
||||
'User already registered for this campaign'
|
||||
)->withData([
|
||||
'user_id' => $userId,
|
||||
@@ -78,7 +80,7 @@ final readonly class PreSaveCampaignService
|
||||
// Verify user has OAuth token for platform
|
||||
if (! $this->oauthService->hasProvider($userId, $platform->getOAuthProvider())) {
|
||||
throw FrameworkException::create(
|
||||
ErrorCode::AUTH_TOKEN_NOT_FOUND,
|
||||
AuthErrorCode::UNAUTHORIZED,
|
||||
'User not connected to ' . $platform->getDisplayName()
|
||||
)->withData([
|
||||
'user_id' => $userId,
|
||||
@@ -112,7 +114,7 @@ final readonly class PreSaveCampaignService
|
||||
// Can only cancel pending registrations
|
||||
if (! $registration->status->shouldProcess()) {
|
||||
throw FrameworkException::create(
|
||||
ErrorCode::VAL_BUSINESS_RULE_VIOLATION,
|
||||
ValidationErrorCode::BUSINESS_RULE_VIOLATION,
|
||||
'Cannot cancel registration in current status'
|
||||
)->withData(['status' => $registration->status->value]);
|
||||
}
|
||||
@@ -131,7 +133,7 @@ final readonly class PreSaveCampaignService
|
||||
|
||||
if ($campaign === null) {
|
||||
throw FrameworkException::create(
|
||||
ErrorCode::ENTITY_NOT_FOUND,
|
||||
DatabaseErrorCode::ENTITY_NOT_FOUND,
|
||||
'Campaign not found'
|
||||
)->withData(['campaign_id' => $campaignId]);
|
||||
}
|
||||
@@ -140,7 +142,7 @@ final readonly class PreSaveCampaignService
|
||||
$statusCounts = $this->registrationRepository->getStatusCounts($campaignId);
|
||||
|
||||
return [
|
||||
'campaign' => $campaign->toArray(),
|
||||
'campaign' => $campaign,
|
||||
'total_registrations' => $stats['total_registrations'],
|
||||
'completed' => $stats['completed'],
|
||||
'pending' => $stats['pending'],
|
||||
|
||||
Reference in New Issue
Block a user