diff --git a/app/Services/PersonalDataSelection/Exporters/Base/ModelExportable.php b/app/Services/PersonalDataSelection/Exporters/Base/ModelExportable.php index bcb73b067..73862fde5 100644 --- a/app/Services/PersonalDataSelection/Exporters/Base/ModelExportable.php +++ b/app/Services/PersonalDataSelection/Exporters/Base/ModelExportable.php @@ -6,8 +6,16 @@ trait ModelExportable { + protected function exportData(): string { + $condition = $this->whereCondition ?? 'id'; + + return $this->model::where( + $this->whereColumn, + $this->user->{$condition} + )->get()->toJson(); + } + protected function onExportValidation(): bool { - return true; - // todo check for model + columns + return !empty($this->model) && !empty($this->whereColumn); } } diff --git a/app/Services/PersonalDataSelection/Exporters/EventExporter.php b/app/Services/PersonalDataSelection/Exporters/EventExporter.php new file mode 100644 index 000000000..e675c9ccb --- /dev/null +++ b/app/Services/PersonalDataSelection/Exporters/EventExporter.php @@ -0,0 +1,18 @@ +add('notifications.json', $userModel->notifications()->get()->toJson()) //TODO: columns definieren ->add('likes.json', $userModel->likes()->get()->toJson()) //TODO: columns definieren ->add('social_profile.json', $userModel->socialProfile()->with('mastodonserver')->get()) //TODO: columns definieren - ->add('event_suggestions.json', EventSuggestion::where('user_id', $userModel->id)->get()->toJson()) //TODO: columns definieren - ->add('events.json', Event::where('approved_by', $userModel->id)->get()->toJson()) //TODO: columns definieren ->add('webhooks.json', $webhooks) - ->add( - 'webhook_creation_requests.json', - WebhookCreationRequest::where('user_id', $userModel->id)->get()->toJson() //TODO: columns definieren - ) ->add('tokens.json', TokenController::index($userModel)->toJson()) //TODO: columns definieren ->add('ics_tokens.json', $userModel->icsTokens()->get()->toJson()) //TODO: columns definieren ->add('apps.json', $userModel->oAuthClients()->get()->toJson()) //TODO: columns definieren ->add('sessions.json', $userModel->sessions()->get()->toJson()) //TODO: columns definieren - ->add('home.json', $userModel->home()->get()->toJson()) //TODO: columns definieren - ->add('mentions.json', Mention::where('mentioned_id', $userModel->id)->get()->toJson()) //TODO: columns definieren + ->add('home.json', $userModel->home()->get()->toJson()) //TODO: columns definieren ->add('roles.json', $userModel->roles()->get()->toJson()) //TODO: columns definieren ->add('permissions.json', $userModel->permissions()->get()->toJson()) //TODO: columns definieren ; $exporter = new Exporter($personalDataSelection, $userModel); $exporter->export([ - StatusExporter::class, + //StatusExporter::class, FollowRequestsExporter::class, FollowsRequestsExporter::class, FollowsExporter::class, @@ -86,6 +78,10 @@ private function addUserPersonalData(PersonalDataSelection $personalDataSelectio TrustedUsersExporter::class, ActivityLogExporter::class, PasswordResetsExporter::class, + EventExporter::class, + EventSuggestionsExporter::class, + WebhookCreationRequestExporter::class, + MentionExporter::class, ]); } }