Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev to main #77

Merged
merged 20 commits into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0f5b7b8
First code for linked data
rubenvdlinde Nov 28, 2024
8585690
Bit of code clean up and edge cases
rubenvdlinde Nov 29, 2024
d078a02
Merge branch 'development' into feature/REGISTERS-66/linked-files
WilcoLouwerse Nov 29, 2024
0d9d723
Quick fixes
WilcoLouwerse Nov 29, 2024
e1f6434
Create new object if no id
bbrands02 Nov 29, 2024
90f8c7a
Merge pull request #76 from ConductionNL/fix/check-id-when-save-object
bbrands02 Nov 29, 2024
f321ca2
Fix attaching subobjects to object
rjzondervan Nov 29, 2024
983da29
test
rjzondervan Nov 29, 2024
9a37409
Added FileService
WilcoLouwerse Nov 29, 2024
aba3418
Merge branch 'feature/REGISTERS-66/linked-files-test' into feature/RE…
WilcoLouwerse Nov 29, 2024
b2d0f8a
Merge remote-tracking branch 'origin/feature/REGISTERS-66/linked-file…
rjzondervan Nov 29, 2024
587031e
Revert test
rjzondervan Nov 29, 2024
ad2ed6a
Almost working code for getting SharePoint file and connect it to object
WilcoLouwerse Nov 29, 2024
7512913
Decode base64 encoded files
rjzondervan Nov 29, 2024
1db4cd2
Merge remote-tracking branch 'origin/feature/REGISTERS-66/Fix-subobje…
rjzondervan Nov 30, 2024
1bcc6f6
Fix weird urls, use array instead of object
rjzondervan Nov 30, 2024
dc74503
Fix object
rjzondervan Nov 30, 2024
81246fa
Merge pull request #79 from ConductionNL/feature/REGISTERS-66/encode
rjzondervan Nov 30, 2024
032715b
Fix two small bugs
rjzondervan Nov 30, 2024
fffa450
Merge pull request #80 from ConductionNL/feature/REGISTERS-66/encode
rjzondervan Nov 30, 2024
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
11 changes: 10 additions & 1 deletion lib/Db/ObjectEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,26 @@
class ObjectEntity extends Entity implements JsonSerializable
{
protected ?string $uuid = null;
protected ?string $uri = null;
protected ?string $version = null;
protected ?string $register = null;
protected ?string $schema = null;
protected ?array $object = [];
protected ?array $files = []; // array of file ids that are related to this object
protected ?array $relations = []; // array of object ids that this object is related to
protected ?string $textRepresentation = null;
protected ?DateTime $updated = null;
protected ?DateTime $created = null;

public function __construct() {
$this->addType(fieldName:'uuid', type: 'string');
$this->addType(fieldName:'uuid', type: 'string');
$this->addType(fieldName:'uri', type: 'string');
$this->addType(fieldName:'version', type: 'string');
$this->addType(fieldName:'register', type: 'string');
$this->addType(fieldName:'schema', type: 'string');
$this->addType(fieldName:'object', type: 'json');
$this->addType(fieldName:'files', type: 'json');
$this->addType(fieldName:'relations', type: 'json');
$this->addType(fieldName:'textRepresentation', type: 'text');
$this->addType(fieldName:'updated', type: 'datetime');
$this->addType(fieldName:'created', type: 'datetime');
Expand Down Expand Up @@ -72,10 +78,13 @@ public function getObjectArray(): array
return [
'id' => $this->id,
'uuid' => $this->uuid,
'uri' => $this->uri,
'version' => $this->version,
'register' => $this->register,
'schema' => $this->schema,
'object' => $this->object,
'files' => $this->files,
'relations' => $this->relations,
'textRepresentation' => $this->textRepresentation,
'updated' => isset($this->updated) ? $this->updated->format('c') : null,
'created' => isset($this->created) ? $this->created->format('c') : null
Expand Down
78 changes: 78 additions & 0 deletions lib/Migration/Version1Date20241128221000.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\OpenRegister\Migration;

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

/**
* FIXME Auto-generated migration step: Please modify to your needs!
*/
class Version1Date20241128221000 extends SimpleMigrationStep {

/**
* @param IOutput $output
* @param Closure(): ISchemaWrapper $schemaClosure
* @param array $options
*/
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
}

/**
* @param IOutput $output
* @param Closure(): ISchemaWrapper $schemaClosure
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();

// Update the openregister_objects table
$table = $schema->getTable('openregister_objects');
if ($table->hasColumn('uri') === false) {
$table->addColumn(
name: 'uri',
typeName: Types::STRING,
options: [
'notnull' => true,
'length' => 255
]
)->setDefault('');
}
if ($table->hasColumn('files') === false) {
$table->addColumn(
name: 'files',
typeName: Types::JSON,
options: ['notnull' => false]
)->setDefault('{}');
}
if ($table->hasColumn('relations') === false) {
$table->addColumn(
name: 'relations',
typeName: Types::JSON,
options: ['notnull' => false]
)->setDefault('{}');;
}

return $schema;
}

/**
* @param IOutput $output
* @param Closure(): ISchemaWrapper $schemaClosure
* @param array $options
*/
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
}
}
Loading