implemented step 05 by Gemini
added action saveConsent and ConsentService
This commit is contained in:
@ -52,6 +52,7 @@ try {
|
||||
|
||||
// Router
|
||||
$projectActions = new \App\Actions\ProjectActions();
|
||||
$consentService = new \App\Services\ConsentService();
|
||||
|
||||
switch ($action) {
|
||||
case 'ping':
|
||||
@ -78,6 +79,18 @@ try {
|
||||
sendResponse(true, $projectActions->getProjectStatus($userId, $projectId));
|
||||
break;
|
||||
|
||||
case 'saveConsent':
|
||||
$projectId = $data['project_id'] ?? null;
|
||||
$consentText = $data['payload']['consent_text'] ?? null;
|
||||
|
||||
if (!$projectId || !$consentText) {
|
||||
sendResponse(false, ['code' => 'MISSING_DATA', 'message' => 'Project ID and consent text are required.'], 400);
|
||||
}
|
||||
|
||||
$success = $consentService->saveConsent($projectId, $userId, $consentText);
|
||||
sendResponse($success, ['message' => 'Consent saved successfully.']);
|
||||
break;
|
||||
|
||||
default:
|
||||
sendResponse(false, ['code' => 'UNKNOWN_ACTION', 'message' => "Action '$action' is not defined."], 404);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user