You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sections/leaves_support.md
+51-5Lines changed: 51 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,57 @@
1
1
# Leaves Support
2
2
3
-
There are three endpoints to consider when you want to find working/non-working days in a specific interval of time.
3
+
## Get user annual leave info
4
4
5
-
For company, get from the [company info](company.md) "working_days" and verify if contains the numeric representation of the day of the week (ISO-8601) for every date from the interval.
6
-
Then, make a GET request to `/api/companiesdaysexceptions?where=date<=interval.end_date&&end_date>=interval.start_date` (see [Company Days Exceptions](companies_days_exceptions.md)) and exclude or include the intervals depending on the field "is_working".
5
+
Make sure you've set up the annual leave entitlement for company (POST request to `/api/company/[COMPANY_ID]`) or for an user (POST request to `/api/users/[USER_ID]`) with the body:
7
6
8
-
For a user, you need to make a GET request to `/api/usersdaysexceptions?where=user_id=[USER_ID]&&date<=interval.end_date&&end_date>=interval.start_date` (see [Users Days Exceptions](users_days_exceptions.md)) and exclude or include the intervals from those of the company.
7
+
```json
8
+
{
9
+
"annual_leave_days_number":21
10
+
}
11
+
```
12
+
13
+
Get the user annual leave info by making a POST request to `/api/statsreports` with the body:
14
+
15
+
```json
16
+
{
17
+
"params":{
18
+
"user_id":76509,
19
+
"date_interval":"this_year"
20
+
},
21
+
"type": "user_annual_leave_stats"
22
+
}
23
+
```
24
+
25
+
Example of response:
26
+
27
+
```json
28
+
{
29
+
"statsreports":[
30
+
{
31
+
"info": {
32
+
"type":"user_annual_leave_stats",
33
+
"params": {
34
+
"user_id":76509,
35
+
"date_interval":"this_year"
36
+
}
37
+
},
38
+
"content":[
39
+
{
40
+
"user_annual_leave_stats": {
41
+
"annual_leave_days_number":21,
42
+
"unpaid_leave_days_count":3,
43
+
"used_leave_days_count":5
44
+
}
45
+
}
46
+
]
47
+
}
48
+
]
49
+
}
50
+
```
51
+
52
+
Available options for date interval are 'this_year' and 'last_year'.
53
+
54
+
## Get working days count
9
55
10
56
You can find the number of the working days for a user in a interval of time by making a POST request to `/api/statsreports` with the body:
0 commit comments