diff --git a/endpoints/battlestation/GET.php b/endpoints/battlestation/GET.php deleted file mode 100644 index b238306..0000000 --- a/endpoints/battlestation/GET.php +++ /dev/null @@ -1,57 +0,0 @@ -ruleset = new Ruleset(strict: true); - - $this->ruleset->GET([ - (new Rules(ConfigModel::REF_MB_ID->value)) - ->type(Type::STRING) - ->min(parent::UUID_LENGTH) - ->max(parent::UUID_LENGTH), - - (new Rules(ConfigModel::FRIENDLY_NAME->value)) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR) - ]); - - parent::__construct(Databases::BATTLESTATION, $this->ruleset); - - // Use a copy of search parameters - $this->query = $_GET; - } - - private function get_config(): array { - return $this->results = $this->db - ->for(ConfigModel::NAME) - ->where($this->query) - ->order([ConfigModel::DATE_BUILT->value => "DESC"]) - ->select(ConfigModel::values()) - ->fetch_all(MYSQLI_ASSOC); - } - - public function main(): Response { - // Set properties as "searchable" - parent::make_wildcard_search(ConfigModel::FRIENDLY_NAME->value, $this->query); - - $this->get_config(); - - // Return 404 Not Found if response array is empty - return new Response($this->results, $this->results ? 200 : 404); - } - } \ No newline at end of file diff --git a/endpoints/battlestation/chassis/GET.php b/endpoints/battlestation/chassis/GET.php deleted file mode 100644 index 4f8618a..0000000 --- a/endpoints/battlestation/chassis/GET.php +++ /dev/null @@ -1,97 +0,0 @@ -ruleset = new Ruleset(strict: true); - - $this->ruleset->GET([ - (new Rules(ChassisTable::ID->value)) - ->type(Type::STRING) - ->min(parent::UUID_LENGTH) - ->max(parent::UUID_LENGTH), - - (new Rules(ChassisTable::VENDOR_NAME->value)) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(ChassisTable::VENDOR_MODEL->value)) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(ChassisTable::STORAGE_TWOINCHFIVE->value)) - ->type(Type::NUMBER) - ->type(Type::NULL) - ->min(0) - ->max(parent::MYSQL_TINYINT_MAX_LENGTH), - - (new Rules(ChassisTable::STORAGE_THREEINCHFIVE->value)) - ->type(Type::NUMBER) - ->type(Type::NULL) - ->min(0) - ->max(parent::MYSQL_TINYINT_MAX_LENGTH), - - (new Rules(ChassisTable::IS_RETIRED->value)) - ->type(Type::BOOLEAN) - ]); - - parent::__construct(Databases::BATTLESTATION, $this->ruleset); - - // Use a copy of search parameters - $this->query = $_GET; - } - - private function get_motherboards(): void { - foreach ($this->results as &$result) { - // Get motherboard id from relationship by chassis id - $result[self::REL_MOTHERBOARDS] = $this->db - ->for(ChassisMbTable::NAME) - ->where([ChassisMbTable::REF_CHASSIS_ID->value => $result[ChassisTable::ID->value]]) - ->select(ChassisMbTable::values()) - ->fetch_all(MYSQLI_ASSOC); - } - } - - private function get_chassis(): array { - return $this->results = $this->db - ->for(ChassisTable::NAME) - ->where($this->query) - ->order([ChassisTable::DATE_AQUIRED->value => "DESC"]) - ->select(ChassisTable::values()) - ->fetch_all(MYSQLI_ASSOC); - } - - public function main(): Response { - // Set properties as "searchable" - parent::make_wildcard_search(ChassisTable::VENDOR_NAME->value, $this->query); - parent::make_wildcard_search(ChassisTable::VENDOR_MODEL->value, $this->query); - - // Get hardware - $this->get_chassis(); - - // Resolve hardware relationships - $this->get_motherboards(); - - // Return 404 Not Found if response array is empty - return new Response($this->results, $this->results ? 200 : 404); - } - } \ No newline at end of file diff --git a/endpoints/battlestation/coolers/GET.php b/endpoints/battlestation/coolers/GET.php deleted file mode 100644 index 79dbe5d..0000000 --- a/endpoints/battlestation/coolers/GET.php +++ /dev/null @@ -1,102 +0,0 @@ -ruleset = new Ruleset(strict: true); - - $this->ruleset->GET([ - (new Rules(CoolerModel::ID->value)) - ->type(Type::STRING) - ->min(parent::UUID_LENGTH) - ->max(parent::UUID_LENGTH), - - (new Rules(CoolerModel::TYPE_LIQUID->value)) - ->type(Type::BOOLEAN), - - (new Rules(CoolerModel::SIZE_FAN->value)) - ->type(Type::NULL) - ->type(Type::NUMBER) - ->min(1) - ->max(parent::MYSQL_INTR_MAX_LENGTH), - - (new Rules(CoolerModel::SIZE_RADIATOR->value)) - ->type(Type::NULL) - ->type(Type::NUMBER) - ->min(1) - ->max(parent::MYSQL_INTR_MAX_LENGTH), - - (new Rules(CoolerModel::VENDOR_NAME->value)) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(CoolerModel::VENDOR_MODEL->value)) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(CoolerModel::IS_RETIRED->value)) - ->type(Type::BOOLEAN) - ]); - - parent::__construct(Databases::BATTLESTATION, $this->ruleset); - - // Use a copy of search parameters - $this->query = $_GET; - } - - private function get_motherboards(): void { - foreach ($this->results as &$result) { - // Get motherboard id from relationship by chassis id - $result[self::REL_MOTHERBOARDS] = $this->db - ->for(MbCoolerModel::NAME) - ->where([MbCoolerModel::REF_COOLER_ID->value => $result[CoolerModel::ID->value]]) - ->select(MbCoolerModel::values()) - ->fetch_all(MYSQLI_ASSOC); - } - } - - private function get_coolers(): array { - return $this->results = $this->db - ->for(CoolerModel::NAME) - ->where($this->query) - ->order([CoolerModel::DATE_AQUIRED->value => "DESC"]) - ->select(CoolerModel::values()) - ->fetch_all(MYSQLI_ASSOC); - } - - public function main(): Response { - // Set properties as "searchable" - parent::make_wildcard_search(CoolerModel::VENDOR_NAME->value, $this->query); - parent::make_wildcard_search(CoolerModel::VENDOR_MODEL->value, $this->query); - - // Get hardware - $this->get_coolers(); - - // Resolve hardware relationships - $this->get_motherboards(); - - // Return 404 Not Found if response array is empty - return new Response($this->results, $this->results ? 200 : 404); - } - } \ No newline at end of file diff --git a/endpoints/battlestation/cpu/GET.php b/endpoints/battlestation/cpu/GET.php deleted file mode 100644 index 6c98fa0..0000000 --- a/endpoints/battlestation/cpu/GET.php +++ /dev/null @@ -1,111 +0,0 @@ -ruleset = new Ruleset(strict: true); - - $this->ruleset->GET([ - (new Rules(CpuTable::ID->value)) - ->type(Type::STRING) - ->min(parent::UUID_LENGTH) - ->max(parent::UUID_LENGTH), - - (new Rules(CpuTable::CLOCK_BASE->value)) - ->type(Type::NUMBER) - ->min(1), - - (new Rules(CpuTable::CLOCK_TURBO->value)) - ->type(Type::NUMBER) - ->min(1), - - (new Rules(CpuTable::CORE_COUNT_PERFORMANCE->value)) - ->type(Type::NUMBER) - ->min(1) - ->max(parent::MYSQL_TINYINT_MAX_LENGTH), - - (new Rules(CpuTable::CORE_COUNT_EFFICIENCY->value)) - ->type(Type::NUMBER) - ->min(1) - ->max(parent::MYSQL_TINYINT_MAX_LENGTH), - - (new Rules(CpuTable::CORE_THREADS->value)) - ->type(Type::NUMBER) - ->min(1) - ->max(parent::MYSQL_TINYINT_MAX_LENGTH), - - (new Rules(CpuTable::VENDOR_NAME->value)) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(CpuTable::VENDOR_MODEL->value)) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(CpuTable::IS_RETIRED->value)) - ->type(Type::BOOLEAN) - ]); - - parent::__construct(Databases::BATTLESTATION, $this->ruleset); - - // Use a copy of search parameters - $this->query = $_GET; - } - - private function get_motherboards(): void { - foreach ($this->results as &$result) { - // Get motherboard id from relationship by chassis id - $result[self::REL_MOTHERBOARDS] = $this->db - ->for(MbCpuCoolerModel::NAME) - ->where([MbCpuCoolerModel::REF_CPU_ID->value => $result[CpuTable::ID->value]]) - ->select(MbCpuCoolerModel::values()) - ->fetch_all(MYSQLI_ASSOC); - } - } - - private function get_cpu(): array { - return $this->results = $this->db - ->for(CpuTable::NAME) - ->where($this->query) - ->order([CpuTable::DATE_AQUIRED->value => "DESC"]) - ->select(CpuTable::values()) - ->fetch_all(MYSQLI_ASSOC); - } - - public function main(): Response { - // Set properties as "searchable" - parent::make_wildcard_search(CpuTable::VENDOR_NAME->value, $this->query); - parent::make_wildcard_search(CpuTable::VENDOR_MODEL->value, $this->query); - - // Get hardware - $this->get_cpu(); - - // Resolve hardware relationships - $this->get_motherboards(); - - // Return 404 Not Found if response array is empty - return new Response($this->results, $this->results ? 200 : 404); - } - } \ No newline at end of file diff --git a/endpoints/battlestation/dram/GET.php b/endpoints/battlestation/dram/GET.php deleted file mode 100644 index a847e63..0000000 --- a/endpoints/battlestation/dram/GET.php +++ /dev/null @@ -1,109 +0,0 @@ -ruleset = new Ruleset(strict: true); - - $this->ruleset->GET([ - (new Rules(DramTable::ID->value)) - ->type(Type::STRING) - ->min(parent::UUID_LENGTH) - ->max(parent::UUID_LENGTH), - - (new Rules(DramTable::CAPACITY->value)) - ->type(Type::NUMBER) - ->min(1), - - (new Rules(DramTable::SPEED->value)) - ->type(Type::NUMBER) - ->min(1), - - (new Rules(DramTable::FORMFACTOR->value)) - ->type(Type::ENUM, DramFormfactorEnum::names()), - - (new Rules(DramTable::TECHNOLOGY->value)) - ->type(Type::ENUM, DramTechnologyEnum::names()), - - (new Rules(DramTable::ECC->value)) - ->type(Type::BOOLEAN), - - (new Rules(DramTable::BUFFERED->value)) - ->type(Type::BOOLEAN), - - (new Rules(DramTable::VENDOR_NAME->value)) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(DramTable::VENDOR_MODEL->value)) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(DramTable::IS_RETIRED->value)) - ->type(Type::BOOLEAN) - ]); - - parent::__construct(Databases::BATTLESTATION, $this->ruleset); - - // Use a copy of search parameters - $this->query = $_GET; - } - - private function get_motherboards(): void { - foreach ($this->results as &$result) { - // Get motherboard id from relationship by chassis id - $result[self::REL_MOTHERBOARDS] = $this->db - ->for(MbDramTable::NAME) - ->where([MbDramTable::REF_DRAM_ID->value => $result[DramTable::ID->value]]) - ->select(MbDramTable::values()) - ->fetch_all(MYSQLI_ASSOC); - } - } - - private function get_dram(): array { - return $this->results = $this->db - ->for(DramTable::NAME) - ->where($this->query) - ->order([DramTable::DATE_AQUIRED->value => "DESC"]) - ->select(DramTable::values()) - ->fetch_all(MYSQLI_ASSOC); - } - - public function main(): Response { - // Set properties as "searchable" - parent::make_wildcard_search(DramTable::VENDOR_NAME->value, $this->query); - parent::make_wildcard_search(DramTable::VENDOR_MODEL->value, $this->query); - - // Get hardware - $this->get_dram(); - - // Resolve hardware relationships - $this->get_motherboards(); - - // Return 404 Not Found if response array is empty - return new Response($this->results, $this->results ? 200 : 404); - } - } \ No newline at end of file diff --git a/endpoints/battlestation/gpu/GET.php b/endpoints/battlestation/gpu/GET.php deleted file mode 100644 index f203c9f..0000000 --- a/endpoints/battlestation/gpu/GET.php +++ /dev/null @@ -1,101 +0,0 @@ -ruleset = new Ruleset(strict: true); - - $this->ruleset->GET([ - (new Rules(GpuTable::ID->value)) - ->type(Type::STRING) - ->min(parent::UUID_LENGTH) - ->max(parent::UUID_LENGTH), - - (new Rules(GpuTable::MEMORY->value)) - ->type(Type::NUMBER) - ->min(1), - - (new Rules(GpuTable::VENDOR_NAME->value)) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(GpuTable::VENDOR_MODEL->value)) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(GpuTable::VENDOR_CHIP_NAME->value)) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(GpuTable::VENDOR_CHIP_MODEL->value)) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(GpuTable::IS_RETIRED->value)) - ->type(Type::BOOLEAN) - ]); - - parent::__construct(Databases::BATTLESTATION, $this->ruleset); - - // Use a copy of search parameters - $this->query = $_GET; - } - - private function get_motherboards(): void { - foreach ($this->results as &$result) { - // Get motherboard id from relationship by chassis id - $result[self::REL_MOTHERBOARDS] = $this->db - ->for(MbGpuTable::NAME) - ->where([MbGpuTable::REF_GPU_ID->value => $result[GpuTable::ID->value]]) - ->select(MbGpuTable::values()) - ->fetch_all(MYSQLI_ASSOC); - } - } - - private function get_gpu(): array { - return $this->results = $this->db - ->for(GpuTable::NAME) - ->where($this->query) - ->order([GpuTable::DATE_AQUIRED->value => "DESC"]) - ->select(GpuTable::values()) - ->fetch_all(MYSQLI_ASSOC); - } - - public function main(): Response { - // Set properties as "searchable" - parent::make_wildcard_search(GpuTable::VENDOR_NAME->value, $this->query); - parent::make_wildcard_search(GpuTable::VENDOR_MODEL->value, $this->query); - parent::make_wildcard_search(GpuTable::VENDOR_CHIP_NAME->value, $this->query); - parent::make_wildcard_search(GpuTable::VENDOR_CHIP_MODEL->value, $this->query); - - // Get hardware - $this->get_gpu(); - - // Resolve hardware relationships - $this->get_motherboards(); - - // Return 404 Not Found if response array is empty - return new Response($this->results, $this->results ? 200 : 404); - } - } \ No newline at end of file diff --git a/endpoints/battlestation/mb/GET.php b/endpoints/battlestation/mb/GET.php deleted file mode 100644 index d2a41a0..0000000 --- a/endpoints/battlestation/mb/GET.php +++ /dev/null @@ -1,188 +0,0 @@ -ruleset = new Ruleset(strict: true); - - $this->ruleset->GET([ - (new Rules(MbTable::ID->value)) - ->type(Type::STRING) - ->min(parent::UUID_LENGTH) - ->max(parent::UUID_LENGTH), - - (new Rules(MbTable::FORMFACTOR->value)) - ->type(Type::ENUM, MbFormfactorEnum::names()), - - (new Rules(MbTable::VENDOR_NAME->value)) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(MbTable::VENDOR_MODEL->value)) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(MbTable::NETWORK_ETHERNET->value)) - ->type(Type::NULL) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(MbTable::NETWORK_WLAN->value)) - ->type(Type::NULL) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(MbTable::NETWORK_BLUETOOTH->value)) - ->type(Type::NULL) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(MbTable::IS_RETIRED->value)) - ->type(Type::BOOLEAN) - ]); - - parent::__construct(Databases::BATTLESTATION, $this->ruleset); - - // Use a copy of search parameters - $this->query = $_GET; - } - - private function get_chassis(): void { - foreach ($this->results as &$result) { - // Get motherboard id from relationship by chassis id - $result[self::REL_CHASSIS] = $this->db - ->for(ChassisMbTable::NAME) - ->where([ChassisMbTable::REF_MB_ID->value => $result[MbTable::ID->value]]) - ->select(ChassisMbTable::values()) - ->fetch_all(MYSQLI_ASSOC); - } - } - - private function get_psu(): void { - foreach ($this->results as &$result) { - // Get motherboard id from relationship by chassis id - $result[self::REL_PSU] = $this->db - ->for(MbPsuTable::NAME) - ->where([MbPsuTable::REF_MB_ID->value => $result[MbTable::ID->value]]) - ->select(MbPsuTable::values()) - ->fetch_all(MYSQLI_ASSOC); - } - } - - private function get_cpu(): void { - foreach ($this->results as &$result) { - // Get motherboard id from relationship by chassis id - $result[self::REL_CPU] = $this->db - ->for(MbCpuCoolerModel::NAME) - ->where([MbCpuCoolerModel::REF_MB_ID->value => $result[MbTable::ID->value]]) - ->select(MbCpuCoolerModel::values()) - ->fetch_all(MYSQLI_ASSOC); - } - } - - private function get_gpu(): void { - foreach ($this->results as &$result) { - // Get motherboard id from relationship by chassis id - $result[self::REL_GPU] = $this->db - ->for(MbGpuTable::NAME) - ->where([MbGpuTable::REF_MB_ID->value => $result[MbTable::ID->value]]) - ->select(MbGpuTable::values()) - ->fetch_all(MYSQLI_ASSOC); - } - } - - private function get_dram(): void { - foreach ($this->results as &$result) { - // Get motherboard id from relationship by chassis id - $result[self::REL_DRAM] = $this->db - ->for(MbDramTable::NAME) - ->where([MbDramTable::REF_MB_ID->value => $result[MbTable::ID->value]]) - ->select(MbDramTable::values()) - ->fetch_all(MYSQLI_ASSOC); - } - } - - private function get_storage(): void { - foreach ($this->results as &$result) { - // Get motherboard id from relationship by chassis id - $result[self::REL_STORAGE] = $this->db - ->for(MbStorageTable::NAME) - ->where([MbStorageTable::REF_MB_ID->value => $result[MbTable::ID->value]]) - ->select(MbStorageTable::values()) - ->fetch_all(MYSQLI_ASSOC); - } - } - - // ---- - - private function get_motherboards(): array { - return $this->results = $this->db - ->for(MbTable::NAME) - ->where($this->query) - ->order([MbTable::DATE_AQUIRED->value => "DESC"]) - ->select(MbTable::values()) - ->fetch_all(MYSQLI_ASSOC); - } - - public function main(): Response { - // Set properties as "searchable" - parent::make_wildcard_search(MbTable::VENDOR_NAME->value, $this->query); - parent::make_wildcard_search(MbTable::VENDOR_MODEL->value, $this->query); - - // Get hardware - $this->get_motherboards(); - - // Resolve hardware relationships - $this->get_chassis(); - $this->get_cpu(); - $this->get_psu(); - $this->get_gpu(); - $this->get_dram(); - $this->get_storage(); - - // Return 404 Not Found if response array is empty - return new Response($this->results, $this->results ? 200 : 404); - } - } \ No newline at end of file diff --git a/endpoints/battlestation/psu/GET.php b/endpoints/battlestation/psu/GET.php deleted file mode 100644 index f988b20..0000000 --- a/endpoints/battlestation/psu/GET.php +++ /dev/null @@ -1,96 +0,0 @@ -ruleset = new Ruleset(strict: true); - - $this->ruleset->GET([ - (new Rules(PsuTable::ID->value)) - ->type(Type::STRING) - ->min(parent::UUID_LENGTH) - ->max(parent::UUID_LENGTH), - - (new Rules(PsuTable::POWER->value)) - ->type(Type::NUMBER) - ->min(1) - ->max(parent::SIZE_UINT8), - - (new Rules(PsuTable::EIGHTYPLUS_RATING->value)) - ->type(Type::ENUM, EightyplusRatingEnum::names()), - - (new Rules(PsuTable::VENDOR_NAME->value)) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(PsuTable::VENDOR_MODEL->value)) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(PsuTable::IS_RETIRED->value)) - ->type(Type::BOOLEAN) - ]); - - parent::__construct(Databases::BATTLESTATION, $this->ruleset); - - // Use a copy of search parameters - $this->query = $_GET; - } - - private function get_motherboards(): void { - foreach ($this->results as &$result) { - // Get motherboard id from relationship by chassis id - $result[self::REL_MOTHERBOARDS] = $this->db - ->for(MbPsuTable::NAME) - ->where([MbPsuTable::REF_PSU_ID->value => $result[PsuTable::ID->value]]) - ->select(MbPsuTable::values()) - ->fetch_all(MYSQLI_ASSOC); - } - } - - private function get_psu(): array { - return $this->results = $this->db - ->for(PsuTable::NAME) - ->where($this->query) - ->order([PsuTable::DATE_AQUIRED->value => "DESC"]) - ->select(PsuTable::values()) - ->fetch_all(MYSQLI_ASSOC); - } - - public function main(): Response { - // Set properties as "searchable" - parent::make_wildcard_search(PsuTable::VENDOR_NAME->value, $this->query); - parent::make_wildcard_search(PsuTable::VENDOR_MODEL->value, $this->query); - - // Get hardware - $this->get_psu(); - - // Resolve hardware relationships - $this->get_motherboards(); - - // Return 404 Not Found if response array is empty - return new Response($this->results, $this->results ? 200 : 404); - } - } \ No newline at end of file diff --git a/endpoints/battlestation/storage/GET.php b/endpoints/battlestation/storage/GET.php deleted file mode 100644 index 4425788..0000000 --- a/endpoints/battlestation/storage/GET.php +++ /dev/null @@ -1,104 +0,0 @@ -ruleset = new Ruleset(strict: true); - - $this->ruleset->GET([ - (new Rules(StorageTable::ID->value)) - ->type(Type::STRING) - ->min(parent::UUID_LENGTH) - ->max(parent::UUID_LENGTH), - - (new Rules(StorageTable::DISK_TYPE->value)) - ->type(Type::ENUM, StorageDiskTypeEnum::names()), - - (new Rules(StorageTable::DISK_SIZE->value)) - ->type(Type::NUMBER) - ->min(1) - ->max(parent::SIZE_UINT8), - - (new Rules(StorageTable::DISK_INTERFACE->value)) - ->type(Type::ENUM, StorageDiskInterfaceEnum::names()), - - (new Rules(StorageTable::DISK_FORMFACTOR->value)) - ->type(Type::ENUM, StorageDiskFormfactorEnum::names()), - - (new Rules(StorageTable::VENDOR_NAME->value)) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(StorageTable::VENDOR_MODEL->value)) - ->type(Type::STRING) - ->min(1) - ->max(parent::SIZE_VARCHAR), - - (new Rules(StorageTable::IS_RETIRED->value)) - ->type(Type::BOOLEAN) - ]); - - parent::__construct(Databases::BATTLESTATION, $this->ruleset); - - // Use a copy of search parameters - $this->query = $_GET; - } - - private function get_motherboards(): void { - foreach ($this->results as &$result) { - // Get motherboard id from relationship by chassis id - $result[self::REL_MOTHERBOARDS] = $this->db - ->for(MbStorageTable::NAME) - ->where([MbStorageTable::REF_STORAGE_ID->value => $result[StorageTable::ID->value]]) - ->select(MbStorageTable::values()) - ->fetch_all(MYSQLI_ASSOC); - } - } - - private function get_storage(): array { - return $this->results = $this->db - ->for(StorageTable::NAME) - ->where($this->query) - ->order([StorageTable::DATE_AQUIRED->value => "DESC"]) - ->select(StorageTable::values()) - ->fetch_all(MYSQLI_ASSOC); - } - - public function main(): Response { - // Set properties as "searchable" - parent::make_wildcard_search(StorageTable::VENDOR_NAME->value, $this->query); - parent::make_wildcard_search(StorageTable::VENDOR_MODEL->value, $this->query); - - // Get hardware - $this->get_storage(); - - // Resolve hardware relationships - $this->get_motherboards(); - - // Return 404 Not Found if response array is empty - return new Response($this->results, $this->results ? 200 : 404); - } - } \ No newline at end of file diff --git a/public/about.php b/public/about.php index 918cf22..5554450 100644 --- a/public/about.php +++ b/public/about.php @@ -88,7 +88,7 @@

Personal

Coffee, of course.. and..

At times, I become a true, amateur, armchair detective for a variety of your typical-nerdy topics that I find interesting. And will spend a disproportionate to real-world-personal-use amount of time reading about that stuff too.

-

Another silent passion of mine that comes out every few years is building computers and fiddling with weird networking stuff.

+

Another silent passion of mine that comes out every few years is building computers and fiddling with weird networking stuff.

And then of course I don't mind some occational gaming, and watching movies and TV-series.