wip: 2025-02-05T04:38:16+0100 (1738726696)

This commit is contained in:
Victor Westerlund 2025-02-05 04:41:45 +01:00
parent 28bb004004
commit 7f97bf7766
7 changed files with 10 additions and 112 deletions

1
.gitignore vendored
View file

@ -1,6 +1,5 @@
# Public assets # # Public assets #
################# #################
public/robots.txt
public/.well-known public/.well-known
assets/js/modules/npm assets/js/modules/npm

View file

@ -29,7 +29,7 @@
(new Rules(SearchTable::ID->value)) (new Rules(SearchTable::ID->value))
->type(Type::STRING) ->type(Type::STRING)
->min(10) ->min(1)
->max(10) ->max(10)
->default(null), ->default(null),

View file

@ -1,48 +0,0 @@
<?php
use Reflect\{Response, Path};
use ReflectRules\{Ruleset, Rules, Type};
use VLW\Database\Database;
use VLW\Database\Tables\Work\PermalinksTable;
require_once Path::root("src/Database/Database.php");
require_once Path::root("src/Database/Tables/Work/WorkPermalinks.php");
class GET_WorkPermalinks extends Database {
protected Ruleset $ruleset;
public function __construct() {
$this->ruleset = new Ruleset(strict: true);
$this->ruleset->GET([
(new Rules(PermalinksTable::ID->value))
->type(Type::STRING)
->min(1)
->max(parent::SIZE_VARCHAR),
(new Rules(PermalinksTable::REF_WORK_ID->value))
->type(Type::STRING)
->min(1)
->max(parent::SIZE_VARCHAR)
]);
$this->ruleset->validate_or_exit();
parent::__construct();
}
public function main(): Response {
$response = $this->db->for(PermalinksTable::NAME)
->where($_GET)
->select([
PermalinksTable::ID->value,
PermalinksTable::REF_WORK_ID->value,
PermalinksTable::DATE_CREATED->value
]);
return $response->num_rows > 0
? new Response($response->fetch_all(MYSQLI_ASSOC))
: new Response([], 404);
}
}

View file

@ -1,61 +0,0 @@
<?php
use Reflect\Call;
use Reflect\{Response, Path};
use ReflectRules\{Ruleset, Rules, Type};
use VLW\Database\Database;
use VLW\Database\Tables\Work\PermalinksTable;
require_once Path::root("src/Database/Database.php");
require_once Path::root("src/Database/Tables/Work/WorkPermalinks.php");
class POST_WorkPermalinks extends Database {
protected Ruleset $ruleset;
public function __construct() {
$this->ruleset = new Ruleset(strict: true);
$this->ruleset->POST([
(new Rules(PermalinksTable::ID->value))
->required()
->type(Type::STRING)
->min(1)
->max(parent::SIZE_VARCHAR),
(new Rules(PermalinksTable::REF_WORK_ID->value))
->required()
->type(Type::STRING)
->min(1)
->max(parent::SIZE_VARCHAR),
(new Rules(PermalinksTable::DATE_CREATED->value))
->type(Type::NUMBER)
->min(1)
->max(parent::SIZE_UINT8)
->default(time())
]);
$this->ruleset->validate_or_exit();
parent::__construct();
}
private static function get_entity(): Response {
return (new Call(Endpoints::WORK->value))->params([
WorkTable::ID->value => $_POST[TagsTable::REF_WORK_ID->value]
])->get();
}
public function main(): Response {
// Bail out if work entity could not be fetched
$entity = self::get_entity();
if (!$entity->ok) {
return $entity;
}
return $this->db->for(PermalinksTable::NAME)->insert($_POST) === true
? new Response($_POST[PermalinksTable::ID->value], 201)
: new Response("Failed to add permalink to work entity", 500);
}
}

View file

@ -121,7 +121,10 @@ section.timeline .items .item img {
} }
section.timeline .items .item .actions { section.timeline .items .item .actions {
display: flex;
align-items: baseline;
margin-top: 7px; margin-top: 7px;
gap: var(--padding);
} }
/* # Size queries */ /* # Size queries */
@ -166,6 +169,10 @@ section.timeline .items .item .actions {
border-top-color: rgba(var(--primer-color-accent), .2); border-top-color: rgba(var(--primer-color-accent), .2);
} }
section.timeline .items .item .actions {
flex-direction: column;
}
section.timeline .year:first-of-type .month:first-of-type .day:first-of-type .items .item:first-of-type { section.timeline .year:first-of-type .month:first-of-type .day:first-of-type .items .item:first-of-type {
margin-top: var(--padding); margin-top: var(--padding);
} }

View file

@ -1 +0,0 @@
../../../../../node_modules/elevent/src/Elevent.mjs

2
public/robots.txt Normal file
View file

@ -0,0 +1,2 @@
User-agent: *
Disallow: