api-erstellen #1

Merged
TorstenHettstedt merged 52 commits from api-erstellen into master 2021-04-07 13:00:46 +02:00
4 changed files with 20 additions and 17 deletions
Showing only changes of commit 4871ff14dc - Show all commits
+5 -3
View File
@@ -82,6 +82,7 @@
"tags": [
"Eintragungen Arbeitszeiten"
],
"description": "Angabe des Datum im Request-Body werden ignoriert",
"parameters": [
{
"$ref": "#/components/parameters/date"
@@ -167,12 +168,13 @@
"description": "Eintrag der Arbeitszeit für einen Tag",
"type": "object",
"properties": {
"date": {
"workingDay": {
"description": "Datum eines Arbeitstages",
"type": "string",
"format": "date"
"format": "date",
"required": false
},
"workingHours": {
"workingTime": {
"description": "Arbeitszeit des Tages",
"type": "string",
"pattern": "[0-5]\\d:[0-5]\\d:[0-5]\\d",
+3 -2
View File
@@ -10,10 +10,11 @@ class Api extends Module
{
const FORMAT_TIME = 'string:regex(/\d+:[0-5]\d:[0-5]\d/)';
const FORMAT_DATE = 'string:regex(/\d{4}-\d{2}-\d{2}/)';
const WORKING_HOURS_JSON_FORMAT = [
'date' => 'string:date',
'workingHours' => self::FORMAT_TIME,
'workingDay' => self::FORMAT_DATE,
'workingTime' => self::FORMAT_TIME,
];
const WORKING_HOURS_VIEW_JSON_FORMAT = [
@@ -13,8 +13,8 @@ class CreateWorkingHoursCest
$I->haveHttpHeader('accept', 'application/json');
$I->haveHttpHeader('content-type', 'application/json');
$I->sendPost('/working-hours', [
'date' => '2020-04-01',
'workingHours' => '08:00:00',
'workingDay' => '2020-04-01',
'workingTime' => '08:00:00',
]);
$I->seeResponseCodeIs(HttpCode::CREATED);
$I->seeResponseIsJson();
@@ -27,8 +27,8 @@ class CreateWorkingHoursCest
$I->haveHttpHeader('accept', 'application/json');
$I->haveHttpHeader('content-type', 'application/json');
$I->sendPost('/working-hours', [
'date' => '2020-04-01',
'workingHours' => 8.0,
'workingDay' => '2020-04-01',
'workingTime' => 8.0,
]);
$I->seeResponseCodeIs(HttpCode::BAD_REQUEST);
$I->seeResponseIsJson();
@@ -41,8 +41,8 @@ class CreateWorkingHoursCest
$I->haveHttpHeader('accept', 'application/json');
$I->haveHttpHeader('content-type', 'application/json');
$I->sendPost('/working-hours', [
'date' => '2020-01-15',
'workingHours' => '08:00:00',
'workingDay' => '2020-01-15',
'workingTime' => '08:00:00',
]);
$I->seeResponseCodeIs(HttpCode::CONFLICT);
$I->seeResponseIsJson();
@@ -13,8 +13,8 @@ class UpdateWorkingHoursCest
$I->haveHttpHeader('accept', 'application/json');
$I->haveHttpHeader('content-type', 'application/json');
$I->sendPut('/working-hours/2020-01-15', [
'date' => '2020-01-15',
'workingHours' => '10:00:00',
'workingDay' => '2020-01-15',
'workingTime' => '10:00:00',
]);
$I->seeResponseCodeIs(HttpCode::OK);
$I->seeResponseIsJson();
@@ -26,8 +26,8 @@ class UpdateWorkingHoursCest
$I->haveHttpHeader('accept', 'application/json');
$I->haveHttpHeader('content-type', 'application/json');
$I->sendPut('/working-hours/2020-01-15', [
'date' => '2020-04-15',
'workingHours' => '10:00:00',
'workingDay' => '2020-04-15',
'workingTime' => '10:00:00',
]);
$I->seeResponseCodeIs(HttpCode::NOT_FOUND);
$I->seeResponseIsJson();
@@ -39,8 +39,8 @@ class UpdateWorkingHoursCest
$I->haveHttpHeader('accept', 'application/json');
$I->haveHttpHeader('content-type', 'application/json');
$I->sendPut('/working-hours/2020-01-15', [
'date' => '2020-01-15',
'workingHours' => 8.0,
'workingDay' => '2020-01-15',
'workingTime' => 8.0,
]);
$I->seeResponseCodeIs(HttpCode::BAD_REQUEST);
$I->seeResponseIsJson();