Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@
['name' => 'ui#auditTrail', 'url' => '/audit-trails', 'verb' => 'GET'],
['name' => 'ui#searchTrail', 'url' => '/search-trails', 'verb' => 'GET'],
['name' => 'ui#webhooks', 'url' => '/webhooks', 'verb' => 'GET'],
['name' => 'ui#webhooksLogs', 'url' => '/webhooks/logs', 'verb' => 'GET'],
['name' => 'ui#entities', 'url' => '/entities', 'verb' => 'GET'],
['name' => 'files#page', 'url' => '/files', 'verb' => 'GET'],

Expand All @@ -402,5 +403,7 @@
['name' => 'webhooks#events', 'url' => '/api/webhooks/events', 'verb' => 'GET'],
['name' => 'webhooks#logs', 'url' => '/api/webhooks/{id}/logs', 'verb' => 'GET', 'requirements' => ['id' => '\d+']],
['name' => 'webhooks#logStats', 'url' => '/api/webhooks/{id}/logs/stats', 'verb' => 'GET', 'requirements' => ['id' => '\d+']],
['name' => 'webhooks#allLogs', 'url' => '/api/webhooks/logs', 'verb' => 'GET'],
['name' => 'webhooks#retry', 'url' => '/api/webhooks/logs/{logId}/retry', 'verb' => 'POST', 'requirements' => ['logId' => '\d+']],
],
];
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ services:
- solr
- ollama
- presidio-analyzer
- n8n
volumes:
- nextcloud:/var/www/html:rw
- ./custom_apps:/var/www/html/custom_apps
Expand All @@ -206,6 +207,8 @@ services:
- PHP_MEMORY_LIMIT=4G
- PHP_UPLOAD_LIMIT=2G
- PHP_POST_MAX_SIZE=2G
# depends_on:
depends_on:
- db
- n8n
# init-ubuntu:
# condition: service_completed_successfully
1 change: 1 addition & 0 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ function ($container) {
$container->get(EntityRelationMapper::class),
$container->get(ChunkMapper::class),
$container->get(SettingsService::class),
$container->get(id: 'OCP\IDBConnection'),
$container->get(id: 'Psr\Log\LoggerInterface')
);
}
Expand Down
4 changes: 3 additions & 1 deletion lib/Command/SolrDebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,9 @@ private function testSolrAdminAPI(OutputInterface $output, array $solrSettings):
$collectionCount = count($collectionsData['cluster']['collections']);
$output->writeln(" <info>✅ Found $collectionCount collections (SolrCloud mode)</info>");
foreach (array_keys($collectionsData['cluster']['collections']) as $collectionName) {
$output->writeln(" - <comment>$collectionName</comment>");
/** @var string|int $collectionName */
$collectionNameStr = is_string($collectionName) ? $collectionName : (string) $collectionName;
$output->writeln(" - <comment>".$collectionNameStr."</comment>");
}
}
} else {
Expand Down
6 changes: 3 additions & 3 deletions lib/Command/SolrManagementCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ private function handleWarm(OutputInterface $output): int
foreach ($warmQueries as $query) {
$output->write(' 🔥 '.$query['description'].'... ');

$result = $this->solrService->searchObjects(query: $query);
$result = $this->solrService->searchObjects(searchParams: $query);
if ($result['success'] === true) {
$output->writeln('<info>✅</info>');
$successCount++;
Expand Down Expand Up @@ -395,7 +395,7 @@ private function handleHealth(OutputInterface $output): int
// Basic search test.
$output->writeln('');
$output->writeln('🔍 <info>Testing search functionality...</info>');
$searchResult = $this->solrService->searchObjects(query: ['q' => '*:*', 'rows' => 1]);
$searchResult = $this->solrService->searchObjects(searchParams: ['q' => '*:*', 'rows' => 1]);
if ($searchResult['success'] === true) {
$output->writeln(' ✅ Search working ('.$searchResult['execution_time_ms'].'ms)');
$output->writeln(' 📊 Total documents: <comment>'.$searchResult['total'].'</comment>');
Expand Down Expand Up @@ -469,7 +469,7 @@ private function handleSchemaCheck(OutputInterface $output): int
$output->writeln('🔍 Checking field compatibility...');

// Test a document structure.
$testResult = $this->solrService->searchObjects(query: ['q' => '*:*', 'rows' => 1]);
$testResult = $this->solrService->searchObjects(searchParams: ['q' => '*:*', 'rows' => 1]);
if ($testResult['success'] === true && empty($testResult['data']) === false) {
$sampleDoc = $testResult['data'][0];
$availableFields = array_keys($sampleDoc);
Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/ConfigurationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -626,11 +626,11 @@ public function discover(): JSONResponse
// Call appropriate service.
if ($source === 'github') {
$this->logger->info('About to call GitHub search service');
$results = $this->githubService->searchConfigurations(query: $search, page: $page);
$results = $this->githubService->searchConfigurations(search: $search, page: $page);
$this->logger->info('GitHub search completed', ['result_count' => count($results['results'] ?? [])]);
} else {
$this->logger->info('About to call GitLab search service');
$results = $this->gitlabService->searchConfigurations(query: $search, page: $page);
$results = $this->gitlabService->searchConfigurations(search: $search, page: $page);
$this->logger->info('GitLab search completed', ['result_count' => count($results['results'] ?? [])]);
}

Expand Down
5 changes: 1 addition & 4 deletions lib/Controller/ConfigurationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,15 +307,12 @@ public function export(int $id, bool $includeObjects=false): DataDownloadRespons
/**
* Import a configuration
*
* @param bool $includeObjects Whether to include objects in the import.
* @param bool $force Force import even if the same or newer version already exists
*
* @return JSONResponse The import result.
*
* @NoAdminRequired
* @NoCSRFRequired
*/
public function import(bool $includeObjects=false, bool $force=false): JSONResponse
public function import(): JSONResponse
{
try {
// Get the uploaded file from the request if a single file has been uploaded.
Expand Down
37 changes: 31 additions & 6 deletions lib/Controller/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IRequest;
use Psr\Log\LoggerInterface;

/**
* Class DashboardController
Expand All @@ -41,23 +42,33 @@ class DashboardController extends Controller
*/
private DashboardService $dashboardService;

/**
* Logger instance
*
* @var LoggerInterface
*/
private LoggerInterface $logger;


/**
* Constructor for the DashboardController
*
* @param string $appName The name of the app
* @param IRequest $request The request object
* @param DashboardService $dashboardService The dashboard service instance
* @param LoggerInterface $logger Logger instance
*
* @return void
*/
public function __construct(
string $appName,
IRequest $request,
DashboardService $dashboardService
DashboardService $dashboardService,
LoggerInterface $logger
) {
parent::__construct(appName: $appName, request: $request);
$this->dashboardService = $dashboardService;
$this->logger = $logger;

}//end __construct()

Expand All @@ -67,15 +78,13 @@ public function __construct(
*
* This method renders the dashboard page of the application, adding any necessary data to the template.
*
* @param string|null $getParameter Optional parameter for the page request
*
* @return TemplateResponse The rendered template response
*
* @NoAdminRequired
*
* @NoCSRFRequired
*/
public function page(?string $getParameter=null): TemplateResponse
public function page(): TemplateResponse
{
try {
$response = new TemplateResponse(
Expand Down Expand Up @@ -335,8 +344,24 @@ public function getMostActiveObjects(?int $registerId=null, ?int $schemaId=null,
$data = $this->dashboardService->getMostActiveObjects(registerId: $registerId, schemaId: $schemaId, limit: $limit, hours: $hours);
return new JSONResponse(data: $data);
} catch (\Exception $e) {
return new JSONResponse(data: ['error' => $e->getMessage()], statusCode: 500);
}
$this->logger->error(
message: 'Error retrieving most active objects: '.$e->getMessage(),
context: [
'register_id' => $registerId,
'schema_id' => $schemaId,
'limit' => $limit,
'hours' => $hours,
'trace' => $e->getTraceAsString(),
]
);

return new JSONResponse(
data: [
'error' => 'Failed to retrieve most active objects: '.$e->getMessage(),
],
statusCode: 500
);
}//end try

}//end getMostActiveObjects()

Expand Down
3 changes: 1 addition & 2 deletions lib/Controller/FileExtractionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,11 @@ public function __construct(
* array<never, never>
* >
*/
public function index(?int $limit=100, ?int $offset=0, ?string $status=null, ?string $search=null): JSONResponse
public function index(): JSONResponse
{
try {
// TextExtractionService doesn't have findByStatus, use discoverUntrackedFiles or extractPendingFiles instead.
// For now, return empty array as this endpoint needs to be redesigned for chunk-based architecture.
// Note: Search filtering removed as it's not applicable to empty array

return new JSONResponse(
data: [
Expand Down
6 changes: 6 additions & 0 deletions lib/Controller/FilesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ public function index(
string $schema,
string $id
): JSONResponse {
// Note: $register and $schema are route parameters for API consistency
// They are part of the URL structure (/api/objects/{register}/{schema}/{id}/files)
// but only $id is used to fetch files
// Reference them to satisfy static analysis
$routeParams = ['register' => $register, 'schema' => $schema];
unset($routeParams);
try {
// Get the raw files from the file service.
$files = $this->fileService->getFiles(object: $id);
Expand Down
8 changes: 7 additions & 1 deletion lib/Controller/ObjectsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\Uid\Uuid;
use OCA\OpenRegister\Service\FileService;
use OCA\OpenRegister\Service\ExportService;
Expand Down Expand Up @@ -386,7 +387,7 @@ public function index(string $register, string $schema, ObjectService $objectSer
{
try {
// Resolve slugs to numeric IDs consistently (validation only).
$this->resolveRegisterSchemaIds(register: $register, schema: $schema, objectService: $objectService);
$resolved = $this->resolveRegisterSchemaIds(register: $register, schema: $schema, objectService: $objectService);
} catch (\OCA\OpenRegister\Exception\RegisterNotFoundException | \OCA\OpenRegister\Exception\SchemaNotFoundException $e) {
// Return 404 with clear error message if register or schema not found.
return new JSONResponse(data: ['message' => $e->getMessage()], statusCode: 404);
Expand Down Expand Up @@ -1019,6 +1020,11 @@ public function contracts(string $id, string $register, string $schema, ObjectSe
// Set the schema and register to the object service.
$objectService->setSchema(schema: $schema);
$objectService->setRegister(register: $register);

// Note: $id is a route parameter for API consistency (/api/objects/{register}/{schema}/{id}/contracts)
// Currently returns empty array as contract functionality is not yet implemented
$objectId = $id; // Reserved for future use when contract functionality is implemented
unset($objectId);

// Get request parameters for filtering and searching.
$requestParams = $this->request->getParams();
Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/OrganisationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public function create(string $name, string $description=''): JSONResponse
$requestData = $this->request->getParams();
$uuid = $requestData['uuid'] ?? '';

$organisation = $this->organisationService->createOrganisation(name: $name, description: $description, isPublic: true, uuid: $uuid);
$organisation = $this->organisationService->createOrganisation(name: $name, description: $description, addCurrentUser: true, uuid: $uuid);

return new JSONResponse(
data: [
Expand Down Expand Up @@ -541,7 +541,7 @@ public function update(string $uuid): JSONResponse

// Validate parent assignment to prevent circular references.
try {
$this->organisationMapper->validateParentAssignment(organisationUuid: $uuid, parentUuid: $newParent);
$this->organisationMapper->validateParentAssignment(organisationUuid: $uuid, newParentUuid: $newParent);
$organisation->setParent($newParent);
} catch (Exception $e) {
$this->logger->warning(
Expand Down
18 changes: 18 additions & 0 deletions lib/Controller/UiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,24 @@ public function webhooks(): TemplateResponse
}//end webhooks()


/**
* Returns the webhook logs page template.
*
* @NoAdminRequired
* @NoCSRFRequired
*
* @return TemplateResponse The template response.
*
* @phpstan-return TemplateResponse
* @psalm-return TemplateResponse
*/
public function webhooksLogs(): TemplateResponse
{
return $this->makeSpaResponse();

}//end webhooksLogs()


/**
* Returns the entities page template.
*
Expand Down
Loading