mirror of
https://codeberg.org/vlw/vlw.se.git
synced 2025-09-13 21:13:40 +02:00
40 lines
No EOL
973 B
PHP
40 lines
No EOL
973 B
PHP
<?php
|
|
|
|
use Reflect\Path;
|
|
use Reflect\Response;
|
|
use ReflectRules\Type;
|
|
use ReflectRules\Rules;
|
|
use ReflectRules\Ruleset;
|
|
|
|
use const VLW\API\RESP_DELETE_OK;
|
|
use VLW\API\Databases\VLWdb\{
|
|
VLWdb,
|
|
Databases
|
|
};
|
|
use VLW\API\Databases\VLWdb\Models\Playground\Coffee\CoffeeModel;
|
|
|
|
require_once Path::root("src/databases/VLWdb.php");
|
|
require_once Path::root("src/databases/models/Playground/Coffee/Coffee.php");
|
|
|
|
class DELETE_PlaygroundCoffee extends VLWdb {
|
|
protected Ruleset $ruleset;
|
|
|
|
public function __construct() {
|
|
parent::__construct();
|
|
$this->ruleset = new Ruleset(strict: true);
|
|
|
|
$this->ruleset->GET([
|
|
(new Rules(CoffeeModel::ID->value))
|
|
->required()
|
|
->type(Type::NUMBER)
|
|
]);
|
|
|
|
parent::__construct(Databases::PLAYGROUND, $this->ruleset);
|
|
}
|
|
|
|
public function main(): Response {
|
|
return $this->db->for(WorkActionsModel::TABLE)->delete($_POST) === true
|
|
? new Response(RESP_DELETE_OK)
|
|
: new Response("D:", 500);
|
|
}
|
|
} |