mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
61 lines
1.9 KiB
PHP
61 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\KeyValuePairs\ControllersLogic;
|
|
|
|
|
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
|
use App\Classes\Modules\KeyValuePairs\Services\ListsKeyValuePairs;
|
|
use App\Classes\Modules\KeyValuePairs\Standards\Rules\CanListChatGPTPrompts;
|
|
use App\Http\Resources\ChatGPTPromptResource;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ListChatGPTPromptsKVPLogic extends AbstractControllerLogic
|
|
{
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function notification(): array
|
|
{
|
|
return [
|
|
'title' => 'Retrieve ChatGPT Prompts',
|
|
'message' => 'You have successfully retrieved a list of ChatGPT Prompts'
|
|
];
|
|
}
|
|
|
|
/** @var CanListChatGPTPrompts */
|
|
private $canListChatGPTPrompts;
|
|
|
|
/** @var ListsKeyValuePairs */
|
|
private $listsKeyValuePairs;
|
|
|
|
/**
|
|
* ListChatGPTPromptsKVPLogic constructor.
|
|
* @param CanListChatGPTPrompts $canListChatGPTPrompts
|
|
* @param ListsKeyValuePairs $listsKeyValuePairs
|
|
*/
|
|
public function __construct(CanListChatGPTPrompts $canListChatGPTPrompts, ListsKeyValuePairs $listsKeyValuePairs)
|
|
{
|
|
$this->canListChatGPTPrompts = $canListChatGPTPrompts;
|
|
$this->listsKeyValuePairs = $listsKeyValuePairs;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param Request $request
|
|
* @return JsonResponse
|
|
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
|
* @throws \App\Classes\Exceptions\MalformedRequestException
|
|
* @throws \App\Classes\Exceptions\RequestValidationException
|
|
*/
|
|
public function logic(Request $request): JsonResponse
|
|
{
|
|
$this->canListChatGPTPrompts->passes();
|
|
|
|
$prompts = $this->listsKeyValuePairs->execute(array_merge($this->listsKeyValuePairs->deserializeFilters($request->input('filters')), ['chatgpt_prompt' => false]));
|
|
|
|
return $this->collectionResponse(ChatGPTPromptResource::collection($prompts));
|
|
}
|
|
}
|