173 lines
3.9 KiB
Plaintext
173 lines
3.9 KiB
Plaintext
|
|
# Create object with timetable
|
||
|
|
POST http://localhost/wordpress/wp-json/reservations/v1/object
|
||
|
|
{
|
||
|
|
"name": "TestObject1",
|
||
|
|
"timetable": {
|
||
|
|
"block_len": 30,
|
||
|
|
"block_capacity": 2
|
||
|
|
}
|
||
|
|
}
|
||
|
|
HTTP 200
|
||
|
|
[Captures]
|
||
|
|
object_id: jsonpath "$[0]"
|
||
|
|
|
||
|
|
|
||
|
|
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/available
|
||
|
|
{
|
||
|
|
"timetable_id": {{object_id}},
|
||
|
|
"first_date": "2025-08-31",
|
||
|
|
"start": "8:00",
|
||
|
|
"end": "10:00",
|
||
|
|
"is_repeating": true,
|
||
|
|
"requires_confirmation": false,
|
||
|
|
"repeat_period": 7,
|
||
|
|
"repeat_times": 0,
|
||
|
|
"monday": true,
|
||
|
|
"tuesday": false,
|
||
|
|
"wednesday": true,
|
||
|
|
"thursday": false,
|
||
|
|
"friday": true,
|
||
|
|
"saturday": false,
|
||
|
|
"sunday": true
|
||
|
|
}
|
||
|
|
HTTP 200
|
||
|
|
[Asserts]
|
||
|
|
jsonpath "$" count == 4
|
||
|
|
|
||
|
|
|
||
|
|
GET http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation/occupancy?date=2025-08-31
|
||
|
|
HTTP 200
|
||
|
|
[Asserts]
|
||
|
|
jsonpath "$.occupancy" count == 4
|
||
|
|
|
||
|
|
jsonpath "$.occupancy[0]" == 0
|
||
|
|
jsonpath "$.occupancy[1]" == 0
|
||
|
|
jsonpath "$.occupancy[2]" == 0
|
||
|
|
jsonpath "$.occupancy[3]" == 0
|
||
|
|
|
||
|
|
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||
|
|
{
|
||
|
|
"timetable_id": {{object_id}},
|
||
|
|
"date": "2025-08-31",
|
||
|
|
"email": "test@test",
|
||
|
|
"full_name": "Test Test",
|
||
|
|
"phone": "123 456 789",
|
||
|
|
"reservations": [
|
||
|
|
{
|
||
|
|
"start_block_idx": 16,
|
||
|
|
"num_blocks": 2
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|
||
|
|
HTTP 200
|
||
|
|
|
||
|
|
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||
|
|
{
|
||
|
|
"timetable_id": {{object_id}},
|
||
|
|
"date": "2025-09-07",
|
||
|
|
"email": "test@test",
|
||
|
|
"full_name": "Test Test",
|
||
|
|
"phone": "123 456 789",
|
||
|
|
"reservations": [
|
||
|
|
{
|
||
|
|
"start_block_idx": 16,
|
||
|
|
"num_blocks": 2
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|
||
|
|
HTTP 200
|
||
|
|
|
||
|
|
|
||
|
|
# not available time
|
||
|
|
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||
|
|
{
|
||
|
|
"timetable_id": {{object_id}},
|
||
|
|
"date": "2025-09-06",
|
||
|
|
"email": "test@test",
|
||
|
|
"full_name": "Test Test",
|
||
|
|
"phone": "123 456 789",
|
||
|
|
"reservations": [
|
||
|
|
{
|
||
|
|
"start_block_idx": 16,
|
||
|
|
"num_blocks": 2
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|
||
|
|
HTTP 400
|
||
|
|
|
||
|
|
|
||
|
|
# Availabel time, still has capacity
|
||
|
|
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||
|
|
{
|
||
|
|
"timetable_id": {{object_id}},
|
||
|
|
"date": "2025-09-07",
|
||
|
|
"email": "test@test",
|
||
|
|
"full_name": "Test Test",
|
||
|
|
"phone": "123 456 789",
|
||
|
|
"reservations": [
|
||
|
|
{
|
||
|
|
"start_block_idx": 17,
|
||
|
|
"num_blocks": 2
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|
||
|
|
HTTP 200
|
||
|
|
|
||
|
|
GET http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation/occupancy?date=2025-09-07
|
||
|
|
HTTP 200
|
||
|
|
[Asserts]
|
||
|
|
jsonpath "$.occupancy" count == 4
|
||
|
|
|
||
|
|
jsonpath "$.occupancy[0]" == 1
|
||
|
|
jsonpath "$.occupancy[1]" == 2
|
||
|
|
jsonpath "$.occupancy[2]" == 1
|
||
|
|
jsonpath "$.occupancy[3]" == 0
|
||
|
|
|
||
|
|
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||
|
|
{
|
||
|
|
"timetable_id": {{object_id}},
|
||
|
|
"date": "2025-09-07",
|
||
|
|
"email": "test@test",
|
||
|
|
"full_name": "Test Test",
|
||
|
|
"phone": "123 456 789",
|
||
|
|
"reservations": [
|
||
|
|
{
|
||
|
|
"start_block_idx": 18,
|
||
|
|
"num_blocks": 1
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|
||
|
|
HTTP 200
|
||
|
|
|
||
|
|
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||
|
|
{
|
||
|
|
"timetable_id": {{object_id}},
|
||
|
|
"date": "2025-09-07",
|
||
|
|
"email": "test@test",
|
||
|
|
"full_name": "Test Test",
|
||
|
|
"phone": "123 456 789",
|
||
|
|
"reservations": [
|
||
|
|
{
|
||
|
|
"start_block_idx": 18,
|
||
|
|
"num_blocks": 1
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|
||
|
|
HTTP 400
|
||
|
|
|
||
|
|
POST http://localhost/wordpress/wp-json/reservations/v1/object/{{object_id}}/timetable/reservation
|
||
|
|
{
|
||
|
|
"timetable_id": {{object_id}},
|
||
|
|
"date": "2025-09-07",
|
||
|
|
"email": "test@test",
|
||
|
|
"full_name": "Test Test",
|
||
|
|
"phone": "123 456 789",
|
||
|
|
"reservations": [
|
||
|
|
{
|
||
|
|
"start_block_idx": 16,
|
||
|
|
"num_blocks": 1
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|
||
|
|
HTTP 400
|