mirror of
https://codeberg.org/vlw/vlw.se.git
synced 2025-09-13 13:03:41 +02:00
Compare commits
2 commits
85e8e00091
...
5e9317def5
Author | SHA1 | Date | |
---|---|---|---|
5e9317def5 | |||
8209ea5ecc |
3 changed files with 8 additions and 4 deletions
|
@ -8,12 +8,11 @@
|
|||
use VLW\Database\Models\Coffee\Coffee;
|
||||
use VLW\Database\Tables\Coffee\Coffee as CoffeeTable;
|
||||
|
||||
require_once Path::root("src/UUID.php");
|
||||
require_once Path::root("src/API/API.php");
|
||||
require_once Path::root("src/Database/Models/Coffee/Coffee.php");
|
||||
require_once Path::root("src/Database/Tables/Coffee/Coffee.php");
|
||||
|
||||
final class POST_Coffee extends API {
|
||||
final class DELETE_Coffee extends API {
|
||||
public function __construct() {
|
||||
parent::__construct(new Ruleset()->GET([
|
||||
new Rules(CoffeeTable::ID->value)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
final class POST_Coffee extends API {
|
||||
public function __construct() {
|
||||
parent::__construct(new Ruleset()->POST([
|
||||
parent::__construct(new Ruleset(strict: true)->POST([
|
||||
new Rules(CoffeeTable::DATE_CREATED->value)
|
||||
->type(Type::STRING)
|
||||
->type(Type::NUMBER)
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace VLW\Database\Models\Coffee;
|
||||
|
||||
use \VV;
|
||||
use \Exception;
|
||||
use \vlw\MySQL\Order;
|
||||
use \DateTimeImmutable;
|
||||
|
||||
|
@ -61,7 +62,11 @@
|
|||
}
|
||||
|
||||
public function delete(): bool {
|
||||
return $this->db->delete([CoffeeTable::ID->value => $this->id]);
|
||||
try {
|
||||
return $this->db->from(CoffeeTable::TABLE)->delete([CoffeeTable::ID->value => $this->id]);
|
||||
} catch (Exception $error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
final public DateTimeImmutable $date_created {
|
||||
|
|
Loading…
Add table
Reference in a new issue