Skip to content
Open
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
9 changes: 9 additions & 0 deletions .nextcloudignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,18 @@
/.tx
/.nextcloudignore
/.php_cs.dist
/.php-cs-fixer.cache
/.php-cs-fixer.dist.php
/phpunit*xml
/psalm.xml
/tests
/vendor/bin
/vendor-bin
/.git-blame-ignore-revs
/node_modules
/src
/package.json
/package-lock.json
/vite.config.mjs
/renovate.json
/REUSE.toml
5 changes: 5 additions & 0 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<types>
<prevent_group_restriction/>
</types>
<icon>img/app.svg</icon>
<category>office</category>
<category>organization</category>
<bugs>https://github.com/nextcloud/calendar_resource_management</bugs>
Expand All @@ -34,4 +35,8 @@
<command>OCA\CalendarResourceManagement\Command\ListResources</command>
<command>OCA\CalendarResourceManagement\Command\DeleteResource</command>
</commands>
<settings>
<admin>OCA\CalendarResourceManagement\Settings\AdminSettings</admin>
<admin-section>OCA\CalendarResourceManagement\Settings\AdminSection</admin-section>
</settings>
</info>
25 changes: 25 additions & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

return [
'routes' => [
// API endpoints for rooms and resources
['name' => 'admin#getrooms', 'url' => '/admin/rooms', 'verb' => 'GET'],
['name' => 'admin#createroom', 'url' => '/admin/rooms', 'verb' => 'POST'],
['name' => 'admin#deleteroom', 'url' => '/admin/rooms/{id}', 'verb' => 'DELETE'],
['name' => 'admin#getresources', 'url' => '/admin/resources', 'verb' => 'GET'],
['name' => 'admin#createresource', 'url' => '/admin/resources', 'verb' => 'POST'],
['name' => 'admin#deleteresource', 'url' => '/admin/resources/{id}', 'verb' => 'DELETE'],
['name' => 'admin#getstories', 'url' => '/admin/stories', 'verb' => 'GET'],
['name' => 'admin#createbuilding', 'url' => '/admin/buildings', 'verb' => 'POST'],
['name' => 'admin#createstory', 'url' => '/admin/stories', 'verb' => 'POST'],
['name' => 'admin#getbuildings', 'url' => '/admin/buildings', 'verb' => 'GET'],
['name' => 'admin#deletebuilding', 'url' => '/admin/buildings/{id}', 'verb' => 'DELETE'],
['name' => 'admin#deletestory', 'url' => '/admin/stories/{id}', 'verb' => 'DELETE'],
]
];
3 changes: 3 additions & 0 deletions img/app.svg
Comment thread
SebastianKrupinski marked this conversation as resolved.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 29 additions & 1 deletion lib/Connector/Resource/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,35 @@ public function __construct(
* @return array
*/
public function getAllResources(): array {
return [];
$resources = [];
try {
// Load all resources
$resourceModels = $this->resourceMapper->findAll();

foreach ($resourceModels as $resourceModel) {
try {
$restrictions = $this->restrictionMapper->findAllByEntityTypeAndId('resource', $resourceModel->getId());
$resources[] = new ResourceObject($resourceModel, $restrictions, $this);
} catch (\Exception $ex) {
$this->logger->error('Could not load resource with id ' . $resourceModel->getId(), ['exception' => $ex]);
}
}

// Load all vehicles
$vehicleModels = $this->vehicleMapper->findAll();

foreach ($vehicleModels as $vehicleModel) {
try {
$restrictions = $this->restrictionMapper->findAllByEntityTypeAndId('vehicle', $vehicleModel->getId());
$resources[] = new Vehicle($vehicleModel, $restrictions, $this);
} catch (\Exception $ex) {
$this->logger->error('Could not load vehicle with id ' . $vehicleModel->getId(), ['exception' => $ex]);
}
}
} catch (\Exception $ex) {
$this->logger->error('Could not fetch all resources', ['exception' => $ex]);
}
return $resources;
}

/**
Expand Down
19 changes: 18 additions & 1 deletion lib/Connector/Room/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,24 @@ public function __construct(
* @return array
*/
public function getAllRooms(): array {
return [];
$rooms = [];
try {
$roomModels = $this->mapper->findAll();

foreach ($roomModels as $roomModel) {
try {
$restrictions = $this->restrictionMapper->findAllByEntityTypeAndId('room', $roomModel->getId());
$story = $this->storyMapper->find($roomModel->getStoryId());
$building = $this->buildingMapper->find($story->getBuildingId());
$rooms[] = new Room($roomModel, $story, $building, $restrictions, $this);
} catch (\Exception $ex) {
$this->logger->error('Could not load room with id ' . $roomModel->getId(), ['exception' => $ex]);
}
}
} catch (\Exception $ex) {
$this->logger->error('Could not fetch all rooms', ['exception' => $ex]);
}
return $rooms;
}

/**
Expand Down
Loading
Loading