mirror of
https://github.com/Karaka-Management/oms-Kanban.git
synced 2026-02-17 12:48:41 +00:00
update
This commit is contained in:
parent
828989a4e1
commit
b44c01d622
43
Admin/Install/Search.php
Normal file
43
Admin/Install/Search.php
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Jingga
|
||||||
|
*
|
||||||
|
* PHP Version 8.1
|
||||||
|
*
|
||||||
|
* @package Modules\Kanban\Admin\Install
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 2.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link https://jingga.app
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Modules\Kanban\Admin\Install;
|
||||||
|
|
||||||
|
use phpOMS\Application\ApplicationAbstract;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search class.
|
||||||
|
*
|
||||||
|
* @package Modules\Kanban\Admin\Install
|
||||||
|
* @license OMS License 2.0
|
||||||
|
* @link https://jingga.app
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
final class Search
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Install navigation providing
|
||||||
|
*
|
||||||
|
* @param ApplicationAbstract $app Application
|
||||||
|
* @param string $path Module path
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public static function install(ApplicationAbstract $app, string $path) : void
|
||||||
|
{
|
||||||
|
\Modules\Search\Admin\Installer::installExternal($app, ['path' => __DIR__ . '/SearchCommands.php']);
|
||||||
|
}
|
||||||
|
}
|
||||||
32
Admin/Install/SearchCommands.php
Normal file
32
Admin/Install/SearchCommands.php
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Jingga
|
||||||
|
*
|
||||||
|
* PHP Version 8.1
|
||||||
|
*
|
||||||
|
* @package Modules\Kanban
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 2.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link https://jingga.app
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Modules\Kanban\Controller\SearchController;
|
||||||
|
use Modules\Kanban\Models\PermissionCategory;
|
||||||
|
use phpOMS\Account\PermissionType;
|
||||||
|
use phpOMS\Router\RouteVerb;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'^(?!:).+.*?' => [
|
||||||
|
[
|
||||||
|
'dest' => '\Modules\Kanban\Controller\SearchController:searchGeneral',
|
||||||
|
'verb' => RouteVerb::ANY,
|
||||||
|
'permission' => [
|
||||||
|
'module' => SearchController::NAME,
|
||||||
|
'type' => PermissionType::READ,
|
||||||
|
'state' => PermissionCategory::BOARD,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
@ -97,7 +97,7 @@ final class ApiController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($uploadedFiles = $request->files)) {
|
if (!empty($uploadedFiles = $request->files)) {
|
||||||
$uploaded = $this->app->moduleManager->get('Media')->uploadFiles(
|
$uploaded = $this->app->moduleManager->get('Media', 'Api')->uploadFiles(
|
||||||
[],
|
[],
|
||||||
[],
|
[],
|
||||||
$uploadedFiles,
|
$uploadedFiles,
|
||||||
|
|
@ -111,10 +111,9 @@ final class ApiController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($mediaFiles = $request->getDataJson('media'))) {
|
$mediaFiles = $request->getDataJson('media');
|
||||||
foreach ($mediaFiles as $media) {
|
foreach ($mediaFiles as $media) {
|
||||||
$card->files[] = new NullMedia($media);
|
$card->files[] = new NullMedia($media);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $card;
|
return $card;
|
||||||
|
|
@ -194,7 +193,7 @@ final class ApiController extends Controller
|
||||||
$comment->createdBy = new NullAccount($request->header->account);
|
$comment->createdBy = new NullAccount($request->header->account);
|
||||||
|
|
||||||
if (!empty($uploadedFiles = $request->files)) {
|
if (!empty($uploadedFiles = $request->files)) {
|
||||||
$uploaded = $this->app->moduleManager->get('Media')->uploadFiles(
|
$uploaded = $this->app->moduleManager->get('Media', 'Api')->uploadFiles(
|
||||||
[],
|
[],
|
||||||
[],
|
[],
|
||||||
$uploadedFiles,
|
$uploadedFiles,
|
||||||
|
|
|
||||||
77
Controller/SearchController.php
Normal file
77
Controller/SearchController.php
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Jingga
|
||||||
|
*
|
||||||
|
* PHP Version 8.1
|
||||||
|
*
|
||||||
|
* @package Modules\Kanban
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 2.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link https://jingga.app
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Modules\Kanban\Controller;
|
||||||
|
|
||||||
|
use Modules\Kanban\Models\KanbanCardMapper;
|
||||||
|
use phpOMS\DataStorage\Database\Query\OrderType;
|
||||||
|
use phpOMS\Message\RequestAbstract;
|
||||||
|
use phpOMS\Message\ResponseAbstract;
|
||||||
|
use phpOMS\System\MimeType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search class.
|
||||||
|
*
|
||||||
|
* @package Modules\Kanban
|
||||||
|
* @license OMS License 2.0
|
||||||
|
* @link https://jingga.app
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
final class SearchController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Api method to search for tags
|
||||||
|
*
|
||||||
|
* @param RequestAbstract $request Request
|
||||||
|
* @param ResponseAbstract $response Response
|
||||||
|
* @param array $data Generic data
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function searchGeneral(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||||
|
{
|
||||||
|
/** @var \Modules\Kanban\Models\KanbanCard[] $docs */
|
||||||
|
$docs = KanbanCardMapper::getAll()
|
||||||
|
->with('tags')
|
||||||
|
->with('tags/title')
|
||||||
|
->where('name', '%' . ($request->getDataString('search') ?? '') . '%', 'LIKE')
|
||||||
|
->where('descriptionRaw', '%' . ($request->getDataString('search') ?? '') . '%', 'LIKE', 'OR')
|
||||||
|
->where('tags/title/language', $response->header->l11n->language)
|
||||||
|
->sort('createdAt', OrderType::DESC)
|
||||||
|
->limit(8)
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$results = [];
|
||||||
|
foreach ($docs as $doc) {
|
||||||
|
$results[] = [
|
||||||
|
'title' => $doc->name,
|
||||||
|
'summary' => '',
|
||||||
|
'link' => '{/base}/kanban/card?id=' . $doc->id,
|
||||||
|
'account' => '',
|
||||||
|
'createdAt' => $doc->createdAt,
|
||||||
|
'image' => '',
|
||||||
|
'tags' => $doc->tags,
|
||||||
|
'type' => 'list_links',
|
||||||
|
'module' => 'Kanban',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true);
|
||||||
|
$response->add($request->uri->__toString(), $results);
|
||||||
|
}
|
||||||
|
}
|
||||||
7
Models/Elastic/KanbanCard.json
Normal file
7
Models/Elastic/KanbanCard.json
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"id": "{id}",
|
||||||
|
"title": "{title}",
|
||||||
|
"content": "{content}",
|
||||||
|
"language": "{language}",
|
||||||
|
"tags": ["{tags}"]
|
||||||
|
}
|
||||||
4
Models/Elastic/KanbanCardComment.json
Normal file
4
Models/Elastic/KanbanCardComment.json
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"id": "{id}",
|
||||||
|
"content": "{content}"
|
||||||
|
}
|
||||||
|
|
@ -62,7 +62,7 @@ class KanbanCard implements \JsonSerializable
|
||||||
public int $type = CardType::TEXT;
|
public int $type = CardType::TEXT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Color schme.
|
* Color scheme.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user