-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Contexts): API to create a new Context
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
- Loading branch information
Showing
9 changed files
with
276 additions
and
9 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
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,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OCA\Tables\Db; | ||
|
||
use OCP\AppFramework\Db\Entity; | ||
|
||
/** | ||
* @method getContextId(): int | ||
* @method setContextId(int $value): void | ||
* @method getNodeId(): int | ||
* @method setNodeId(int $value): void | ||
* @method getNodeType(): string | ||
* @method setNodeType(string $value): void | ||
* @method getPermissions(): int | ||
* @method setPermissions(int $value): void | ||
*/ | ||
|
||
class ContextNodeRelation extends Entity implements \JsonSerializable { | ||
protected ?int $contextId = null; | ||
protected ?int $nodeId = null; | ||
protected ?string $nodeType = null; | ||
protected ?int $permissions = null; | ||
|
||
public function __construct() { | ||
$this->addType('id', 'integer'); | ||
} | ||
|
||
public function jsonSerialize(): array { | ||
return [ | ||
'id' => $this->getId(), | ||
'contextId' => $this->getContextId(), | ||
'nodeId' => $this->getNodeId(), | ||
'nodeType' => $this->getNodeType(), | ||
'permissions' => $this->getPermissions() | ||
]; | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OCA\Tables\Db; | ||
|
||
use OCP\AppFramework\Db\QBMapper; | ||
use OCP\IDBConnection; | ||
|
||
/** @template-extends QBMapper<ContextNodeRelation> */ | ||
class ContextNodeRelationMapper extends QBMapper { | ||
protected string $table = 'tables_contexts_rel_context_node'; | ||
|
||
public function __construct(IDBConnection $db) { | ||
parent::__construct($db, $this->table, ContextNodeRelation::class); | ||
} | ||
|
||
} |
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,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OCA\Tables\Db; | ||
|
||
use OCP\AppFramework\Db\Entity; | ||
|
||
/** | ||
* @method getContextId(): int | ||
* @method setContextId(int $value): void | ||
* @method getPageType(): string | ||
* @method setPageType(string $value): void | ||
*/ | ||
class Page extends Entity implements \JsonSerializable { | ||
public const TYPE_STARTPAGE = 'startpage'; | ||
|
||
protected ?int $contextId = null; | ||
protected ?string $pageType = null; | ||
|
||
public function __construct() { | ||
$this->addType('id', 'integer'); | ||
} | ||
|
||
public function jsonSerialize(): array { | ||
return [ | ||
'id' => $this->getId(), | ||
'contextId' => $this->getContextId(), | ||
'pageType' => $this->getPageType(), | ||
]; | ||
} | ||
} |
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,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OCA\Tables\Db; | ||
|
||
use OCP\AppFramework\Db\Entity; | ||
|
||
/** | ||
* @method getPageId(): int | ||
* @method setPageId(int $value): void | ||
* @method getNodeRelId(): int | ||
* @method setNodeRelId(int $value): void | ||
* @method getOrder(): int | ||
* @method setOrder(int $value): void | ||
*/ | ||
class PageContent extends Entity implements \JsonSerializable { | ||
protected ?int $pageId = null; | ||
protected ?int $nodeRelId = null; | ||
protected ?int $order = null; | ||
|
||
public function __construct() { | ||
$this->addType('id', 'integer'); | ||
} | ||
|
||
public function jsonSerialize(): array { | ||
return [ | ||
'id' => $this->getId(), | ||
'pageId' => $this->getPageId(), | ||
'nodeRelId' => $this->getNodeRelId(), | ||
'order' => $this->getOrder(), | ||
]; | ||
} | ||
} |
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,15 @@ | ||
<?php | ||
|
||
namespace OCA\Tables\Db; | ||
|
||
use OCP\AppFramework\Db\QBMapper; | ||
use OCP\IDBConnection; | ||
|
||
/** @template-extends QBMapper<PageContent> */ | ||
class PageContentMapper extends QBMapper { | ||
protected string $table = 'tables_contexts_page_content'; | ||
|
||
public function __construct(IDBConnection $db) { | ||
parent::__construct($db, $this->table, ContextNodeRelation::class); | ||
Check failure on line 13 in lib/Db/PageContentMapper.php GitHub Actions / static-psalm-analysis dev-stable28InvalidArgument
Check failure on line 13 in lib/Db/PageContentMapper.php GitHub Actions / static-psalm-analysis dev-masterInvalidArgument
|
||
} | ||
} |
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,15 @@ | ||
<?php | ||
|
||
namespace OCA\Tables\Db; | ||
|
||
use OCP\AppFramework\Db\QBMapper; | ||
use OCP\IDBConnection; | ||
|
||
/** @template-extends QBMapper<Page> */ | ||
class PageMapper extends QBMapper { | ||
protected string $table = 'tables_contexts_page'; | ||
|
||
public function __construct(IDBConnection $db) { | ||
parent::__construct($db, $this->table, ContextNodeRelation::class); | ||
Check failure on line 13 in lib/Db/PageMapper.php GitHub Actions / static-psalm-analysis dev-stable28InvalidArgument
Check failure on line 13 in lib/Db/PageMapper.php GitHub Actions / static-psalm-analysis dev-masterInvalidArgument
|
||
} | ||
} |
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