mirror of
https://codeberg.org/vlw/vlw.se.git
synced 2025-09-13 21:13:40 +02:00
The PR is a huge refactor of all Reflect and Vegvisir code. I've merged the API and "Front-end" codebases together into the same root, this will allow for both Reflect and Vegvisir to use the same resources. Not only that, but I've also added proper database modeling with actual OOP inheritance for database tables. Reviewed-on: https://codeberg.org/vlw/vlw.se/pulls/23
36 lines
No EOL
848 B
PHP
36 lines
No EOL
848 B
PHP
<?php
|
|
|
|
use vlw\MySQL\Order;
|
|
use Reflect\{Response, Path};
|
|
use ReflectRules\{Ruleset, Rules, Type};
|
|
|
|
use VLW\Database\Database;
|
|
use VLW\Database\Tables\Work\ActionsTable;
|
|
|
|
require_once Path::root("src/Database/Database.php");
|
|
require_once Path::root("src/Database/Tables/Work/Actions.php");
|
|
|
|
class GET_WorkActions extends Database {
|
|
protected Ruleset $ruleset;
|
|
|
|
public function __construct() {
|
|
$this->ruleset = new Ruleset(strict: true);
|
|
|
|
$this->ruleset->GET([
|
|
(new Rules(ActionsTable::REF_WORK_ID->value))
|
|
->type(Type::STRING)
|
|
->min(1)
|
|
->max(parent::SIZE_VARCHAR)
|
|
]);
|
|
|
|
$this->ruleset->validate_or_exit();
|
|
|
|
parent::__construct();
|
|
}
|
|
|
|
public function main(): Response {
|
|
return $this->list(ActionsTable::NAME, ActionsTable::values(), [
|
|
ActionsTable::ORDER_IDX->value => Order::DESC
|
|
]);
|
|
}
|
|
} |