0
0
Fork 0
mirror of https://github.com/verdigado/organization_folders.git synced 2024-11-22 04:38:09 +01:00

save fileId for folder resources

This commit is contained in:
Jonathan Treffler 2024-10-31 17:51:20 +01:00
parent 92c431e856
commit 82d95da322
3 changed files with 9 additions and 1 deletions

View file

@ -6,12 +6,14 @@ class FolderResource extends Resource {
protected $membersAclPermission; protected $membersAclPermission;
protected $managersAclPermission; protected $managersAclPermission;
protected $inheritedAclPermission; protected $inheritedAclPermission;
protected $fileId;
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
$this->addType('membersAclPermission','integer'); $this->addType('membersAclPermission','integer');
$this->addType('managersAclPermission','integer'); $this->addType('managersAclPermission','integer');
$this->addType('inheritedAclPermission','integer'); $this->addType('inheritedAclPermission','integer');
$this->addType('fileId','integer');
} }
public static function fromRow(array $row): static { public static function fromRow(array $row): static {
@ -26,6 +28,7 @@ class FolderResource extends Resource {
$instance->setMembersAclPermission($row["members_acl_permission"]); $instance->setMembersAclPermission($row["members_acl_permission"]);
$instance->setManagersAclPermission($row["managers_acl_permission"]); $instance->setManagersAclPermission($row["managers_acl_permission"]);
$instance->setInheritedAclPermission($row["inherited_acl_permission"]); $instance->setInheritedAclPermission($row["inherited_acl_permission"]);
$instance->setFileId($row["file_id"]);
$instance->resetUpdatedFields(); $instance->resetUpdatedFields();
@ -45,6 +48,7 @@ class FolderResource extends Resource {
'membersAclPermission' => $this->membersAclPermission, 'membersAclPermission' => $this->membersAclPermission,
'managersAclPermission' => $this->managersAclPermission, 'managersAclPermission' => $this->managersAclPermission,
'inheritedAclPermission' => $this->inheritedAclPermission, 'inheritedAclPermission' => $this->inheritedAclPermission,
'fileId' => $this->fileId,
]; ];
} }

View file

@ -18,7 +18,7 @@ class ResourceMapper extends QBMapper {
public const FOLDER_RESOURCES_TABLE = "organizationfolders_folder_resources"; public const FOLDER_RESOURCES_TABLE = "organizationfolders_folder_resources";
private const updateableResourceProperties = ["parentResource", "active", "name", "lastUpdatedTimestamp"]; private const updateableResourceProperties = ["parentResource", "active", "name", "lastUpdatedTimestamp"];
private const updateableFolderResourceProperties = ["membersAclPermission", "managersAclPermission", "inheritedAclPermission"]; private const updateableFolderResourceProperties = ["membersAclPermission", "managersAclPermission", "inheritedAclPermission", "fileId"];
public function __construct(IDBConnection $db) { public function __construct(IDBConnection $db) {
parent::__construct($db, self::RESOURCES_TABLE, Resource::class); parent::__construct($db, self::RESOURCES_TABLE, Resource::class);

View file

@ -89,6 +89,9 @@ class Version000000Date20241014120000 extends SimpleMigrationStep {
'length' => 11, 'length' => 11,
'notnull' => true, 'notnull' => true,
]); ]);
$table->addColumn('file_id', Types::INTEGER, [
'notnull' => true,
]);
$table->setPrimaryKey(['resource_id']); $table->setPrimaryKey(['resource_id']);
$table->addForeignKeyConstraint( $table->addForeignKeyConstraint(
@ -97,6 +100,7 @@ class Version000000Date20241014120000 extends SimpleMigrationStep {
['id'], ['id'],
['onDelete' => 'CASCADE'], ['onDelete' => 'CASCADE'],
'organizationfolders_folder_resources_resource_id_fk'); 'organizationfolders_folder_resources_resource_id_fk');
$table->addIndex(['file_id'], 'organizationfolders_folder_resources_file_id_index');
} }
return $schema; return $schema;