Explorar el Código

removed description get from the aplication

EduLascala hace 4 meses
padre
commit
dbfcc262f5
Se han modificado 2 ficheros con 0 adiciones y 42 borrados
  1. 0 30
      controllers/DescriptionGetController.php
  2. 0 12
      models/DescriptionModel.php

+ 0 - 30
controllers/DescriptionGetController.php

@@ -1,30 +0,0 @@
-<?php
-
-namespace Controllers;
-
-use Libs\ResponseLib;
-use Models\DescriptionModel;
-use Psr\Http\Message\ServerRequestInterface;
-use Respect\Validation\Validator as v;
-use Respect\Validation\Exceptions\ValidationException;
-
-class DescriptionGetController
-{
-    public function __invoke(ServerRequestInterface $request)
-    {
-        $body = json_decode((string) $request->getBody(), true) ?? [];
-
-        try {
-            v::key('company_id', v::intType()->positive())->assert($body);
-        } catch (ValidationException $e) {
-            return ResponseLib::sendFail("Validation failed: " . $e->getFullMessage(), [], "E_VALIDATE")->withStatus(400);
-        }
-
-        $companyId = (int) $body['company_id'];
-
-        $model = new DescriptionModel();
-        $data = $model->getDescriptionsByCompany($companyId);
-
-        return ResponseLib::sendOk($data);
-    }
-}

+ 0 - 12
models/DescriptionModel.php

@@ -14,18 +14,6 @@ class DescriptionModel
         $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
     }
 
-    public function getDescriptionsByCompany(int $companyId): array
-{
-    $stmt = $this->pdo->prepare("
-        SELECT d.description_id, d.description_text, d.product_id
-        FROM description d
-        WHERE d.company_id = :company_id
-    ");
-    $stmt->execute(['company_id' => $companyId]);
-
-    return $stmt->fetchAll(\PDO::FETCH_ASSOC);
-}
-
     public function addDescription(int $productId, int $companyId, string $text): bool
     {
         $stmt = $this->pdo->prepare("