requests for changes fixed and format + verify
continuous-integration/drone/push Build is passing Details

pull/97/head
sam 1 year ago
parent 4cf9089e80
commit cadab3c1eb

@ -30,4 +30,3 @@ function get_database(): PDO {
return $pdo;
}

@ -26,8 +26,6 @@ class API {
header('Content-type: application/json');
echo $response->getJson();
} elseif (get_class($response) != HttpResponse::class) {
var_dump($response);
var_dump(get_class($response));
throw new Exception("API returned unknown Http Response");
}
}

@ -15,7 +15,6 @@ use IQBall\Core\Model\TeamModel;
use IQBall\Core\Validation\DefaultValidators;
class APITeamController {
private TeamModel $teamModel;
/**
@ -64,14 +63,14 @@ class APITeamController {
});
}
public function updateTeam(int $id):HttpResponse{
public function updateTeam(int $id): HttpResponse {
return APIControl::runChecked([
'name' => [DefaultValidators::name()],
'picture' => [DefaultValidators::isURL()],
'mainColor' => [DefaultValidators::hexColor()],
'secondaryColor' => [DefaultValidators::hexColor()],
], function (HttpRequest $req){
$this->teamModel->editTeam($req['id'],$req['name'], $req['picture'], $req['mainColor'], $req['secondaryColor']);
], function (HttpRequest $req) {
$this->teamModel->editTeam($req['id'], $req['name'], $req['picture'], $req['mainColor'], $req['secondaryColor']);
return HttpResponse::fromCode(HttpCodes::OK);
});
}

@ -15,7 +15,6 @@ class Control {
* @param array<string, Validator[]> $schema an array of `fieldName => DefaultValidators` which represents the request object schema
* @param callable(HttpRequest): HttpResponse $run the callback to run if the request is valid according to the given schema.
* The callback must accept an HttpRequest, and return an HttpResponse object.
<<<<<<< HEAD:src/Core/Control.php
* @param ControlSchemaErrorResponseFactory $errorFactory an error factory to use if the request does not validate the required schema
* @return HttpResponse
*/

Loading…
Cancel
Save