-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from ConductionNL/development
Development to main
- Loading branch information
Showing
82 changed files
with
4,652 additions
and
996 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"files.autoSave": "afterDelay", | ||
"editor.defaultFormatter": "dbaeumer.vscode-eslint", | ||
"editor.formatOnSave": true, | ||
"eslint.format.enable": true, | ||
"cSpell.words": [ | ||
"depubliceren", | ||
"Depubliceren", | ||
"gedepubliceerd", | ||
"Matadata", | ||
"nextcloud", | ||
"opencatalogi", | ||
"organisation", | ||
"Organisation", | ||
"organisations", | ||
"Organisations", | ||
"pinia", | ||
"Toegangs" | ||
], | ||
"[javascript]": { | ||
"editor.defaultFormatter": "dbaeumer.vscode-eslint" | ||
}, | ||
"[css]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
version: "3.5" | ||
volumes: | ||
nextcloud: | ||
apps: | ||
db: | ||
config: | ||
|
||
services: | ||
db: | ||
image: mariadb:10.6 | ||
restart: always | ||
command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW | ||
volumes: | ||
- db:/var/lib/mysql | ||
environment: | ||
- MYSQL_ROOT_PASSWORD='!ChangeMe!' | ||
- MYSQL_PASSWORD='!ChangeMe!' | ||
- MYSQL_DATABASE=nextcloud | ||
- MYSQL_USER=nextcloud | ||
|
||
init-ubuntu: | ||
image: ubuntu | ||
command: sh /home/ubuntu/docker/init-ubuntu.sh | ||
volumes: | ||
- ./docker:/home/ubuntu/docker | ||
- .:/home/ubuntu/app | ||
|
||
nextcloud: | ||
user: root | ||
container_name: nextcloud | ||
# entrypoint: occ app:enable openregister | ||
image: nextcloud | ||
restart: always | ||
ports: | ||
- 8080:80 | ||
links: | ||
- db | ||
volumes: | ||
- nextcloud:/var/www/html:rw | ||
- ./custom_apps:/var/www/html/custom_apps | ||
- .:/var/www/html/custom_apps/openregister | ||
environment: | ||
- MYSQL_PASSWORD='!ChangeMe!' | ||
- MYSQL_DATABASE=nextcloud | ||
- MYSQL_USER=nextcloud | ||
- MYSQL_HOST=db | ||
- TZ=Europe/Amsterdam | ||
- NEXTCLOUD_ADMIN_USER=admin | ||
- NEXTCLOUD_ADMIN_PASSWORD=admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apt update; | ||
apt install npm composer php-gd php-zip -y | ||
|
||
cd /home/ubuntu/app | ||
npm i | ||
npm run dev | ||
|
||
composer install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
<?php | ||
|
||
namespace OCA\OpenRegister\Controller; | ||
|
||
use OCA\OpenRegister\Service\ObjectService; | ||
use OCA\OpenRegister\Service\SearchService; | ||
use OCA\OpenRegister\Db\ObjectEntity; | ||
use OCA\OpenRegister\Db\ObjectEntityMapper; | ||
use OCP\AppFramework\Controller; | ||
use OCP\AppFramework\Http\TemplateResponse; | ||
use OCP\AppFramework\Http\JSONResponse; | ||
use OCP\IAppConfig; | ||
use OCP\IRequest; | ||
|
||
class ObjectsController extends Controller | ||
{ | ||
/** | ||
* Constructor for the ObjectsController | ||
* | ||
* @param string $appName The name of the app | ||
* @param IRequest $request The request object | ||
* @param IAppConfig $config The app configuration object | ||
*/ | ||
public function __construct( | ||
$appName, | ||
IRequest $request, | ||
private readonly IAppConfig $config, | ||
private readonly ObjectEntityMapper $objectEntityMapper | ||
) | ||
{ | ||
parent::__construct($appName, $request); | ||
} | ||
|
||
/** | ||
* Returns the template of the main app's page | ||
* | ||
* This method renders the main page of the application, adding any necessary data to the template. | ||
* | ||
* @NoAdminRequired | ||
* @NoCSRFRequired | ||
* | ||
* @return TemplateResponse The rendered template response | ||
*/ | ||
public function page(): TemplateResponse | ||
{ | ||
return new TemplateResponse( | ||
'openconnector', | ||
'index', | ||
[] | ||
); | ||
} | ||
|
||
/** | ||
* Retrieves a list of all objects | ||
* | ||
* This method returns a JSON response containing an array of all objects in the system. | ||
* | ||
* @NoAdminRequired | ||
* @NoCSRFRequired | ||
* | ||
* @return JSONResponse A JSON response containing the list of objects | ||
*/ | ||
public function index(ObjectService $objectService, SearchService $searchService): JSONResponse | ||
{ | ||
$filters = $this->request->getParams(); | ||
$fieldsToSearch = ['uuid', 'register', 'schema']; | ||
|
||
$searchParams = $searchService->createMySQLSearchParams(filters: $filters); | ||
$searchConditions = $searchService->createMySQLSearchConditions(filters: $filters, fieldsToSearch: $fieldsToSearch); | ||
$filters = $searchService->unsetSpecialQueryParams(filters: $filters); | ||
|
||
return new JSONResponse(['results' => $this->objectEntityMapper->findAll(limit: null, offset: null, filters: $filters, searchConditions: $searchConditions, searchParams: $searchParams)]); | ||
} | ||
|
||
/** | ||
* Retrieves a single object by its ID | ||
* | ||
* This method returns a JSON response containing the details of a specific object. | ||
* | ||
* @NoAdminRequired | ||
* @NoCSRFRequired | ||
* | ||
* @param string $id The ID of the object to retrieve | ||
* @return JSONResponse A JSON response containing the object details | ||
*/ | ||
public function show(string $id): JSONResponse | ||
{ | ||
try { | ||
return new JSONResponse($this->objectEntityMapper->find(id: (int) $id)); | ||
} catch (DoesNotExistException $exception) { | ||
return new JSONResponse(data: ['error' => 'Not Found'], statusCode: 404); | ||
} | ||
} | ||
|
||
/** | ||
* Creates a new object | ||
* | ||
* This method creates a new object based on POST data. | ||
* | ||
* @NoAdminRequired | ||
* @NoCSRFRequired | ||
* | ||
* @return JSONResponse A JSON response containing the created object | ||
*/ | ||
public function create(): JSONResponse | ||
{ | ||
$data = $this->request->getParams(); | ||
|
||
foreach ($data as $key => $value) { | ||
if (str_starts_with($key, '_')) { | ||
unset($data[$key]); | ||
} | ||
} | ||
|
||
if (isset($data['id'])) { | ||
unset($data['id']); | ||
} | ||
|
||
return new JSONResponse($this->objectEntityMapper->createFromArray(object: $data)); | ||
} | ||
|
||
/** | ||
* Updates an existing object | ||
* | ||
* This method updates an existing object based on its ID. | ||
* | ||
* @NoAdminRequired | ||
* @NoCSRFRequired | ||
* | ||
* @param string $id The ID of the object to update | ||
* @return JSONResponse A JSON response containing the updated object details | ||
*/ | ||
public function update(int $id): JSONResponse | ||
{ | ||
$data = $this->request->getParams(); | ||
|
||
foreach ($data as $key => $value) { | ||
if (str_starts_with($key, '_')) { | ||
unset($data[$key]); | ||
} | ||
} | ||
if (isset($data['id'])) { | ||
unset($data['id']); | ||
} | ||
return new JSONResponse($this->objectEntityMapper->updateFromArray(id: (int) $id, object: $data)); | ||
} | ||
|
||
/** | ||
* Deletes an object | ||
* | ||
* This method deletes an object based on its ID. | ||
* | ||
* @NoAdminRequired | ||
* @NoCSRFRequired | ||
* | ||
* @param string $id The ID of the object to delete | ||
* @return JSONResponse An empty JSON response | ||
*/ | ||
public function destroy(int $id): JSONResponse | ||
{ | ||
$this->objectEntityMapper->delete($this->objectEntityMapper->find((int) $id)); | ||
|
||
return new JSONResponse([]); | ||
} | ||
} |
Oops, something went wrong.