@@ -3,37 +3,31 @@ extractRequestData:
3
3
cookie : ${incoming.headers.cookie}
4
4
organizationWorkingTimeStartISO : ${incoming.body.organizationWorkingTimeStartISO}
5
5
organizationWorkingTimeEndISO : ${incoming.body.organizationWorkingTimeEndISO}
6
- organizationWorkingTimeWeekdaysArray : ${incoming.body.organizationWorkingTimeWeekdays}
7
- organizationWorkingTimeHolidays : ${incoming.body.organizationWorkingTimeHolidays}
8
6
9
7
extractTokenData :
10
8
call : http.post
11
9
args :
12
10
# TODO: replace with env variable and correct path to TIM endpoint
13
- url : http://byk-private-ruuter-yml:8080/mocks/ mock-tim-custom-jwt-userinfo
11
+ url : http://byk-private-ruuter-yml:8080/mock-tim-custom-jwt-userinfo
14
12
headers :
15
13
cookie : ${cookie}
16
14
body :
17
15
# TODO: pass cookie name correctly to TIM
18
16
cookieName : " customJwtCookie"
19
17
result : jwtResult
20
- next : validateAdministrator
21
18
22
19
validateAdministrator :
23
20
switch :
24
21
# TODO: use correct structure when request is made against TIM
25
22
- condition : ${jwtResult.response.body.response.authorities.includes("ROLE_ADMINISTRATOR")}
26
- next : mapArrayToString
23
+ next : validateBody
27
24
next : returnUnauthorized
28
25
29
- mapArrayToString :
30
- call : http.post
31
- args :
32
- url : https://byk-dmapper:8443/json/v2/map_array_to_string
33
- body :
34
- inputArray : ${organizationWorkingTimeWeekdaysArray}
35
- result : mapArrayResult
36
- next : setOrganizationWorkingTime
26
+ validateBody :
27
+ switch :
28
+ - condition : ' ${!!(new Date(organizationWorkingTimeStartISO).getDay() && new Date(organizationWorkingTimeEndISO).getDay())}'
29
+ next : setOrganizationWorkingTime
30
+ next : returnInvalidBody
37
31
38
32
setOrganizationWorkingTime :
39
33
call : http.post
@@ -43,8 +37,6 @@ setOrganizationWorkingTime:
43
37
body :
44
38
organizationWorkingTimeStartISO : ${organizationWorkingTimeStartISO}
45
39
organizationWorkingTimeEndISO : ${organizationWorkingTimeEndISO}
46
- organizationWorkingTimeWeekdays : ${mapArrayResult.response.body.concatenatedArray}
47
- organizationWorkingTimeHolidays : ${incoming.body.organizationWorkingTimeHolidays}
48
40
created : ${new Date().toISOString()}
49
41
result : setOrganizationWorkingTimeResult
50
42
0 commit comments