Skip to content

Commit b5c2abf

Browse files
leave suport
1 parent 9e0071e commit b5c2abf

3 files changed

Lines changed: 53 additions & 7 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ If you exceed the rate limit, you'll get a [429 Too Many Requests](http://tools.
7878
* [Clients](sections/clients.md)
7979
* [Comments](sections/comments.md)
8080
* [Company](sections/company.md)
81-
* [Company-Days-Exceptions](sections/companies_days_exceptions.md)
81+
* [CompaniesDays-Exceptions](sections/companies_days_exceptions.md)
8282
* [Discussions](sections/discussions.md)
8383
* [Estimate Templates](sections/estimate_templates.md)
8484
* [Estimates](sections/estimates.md)

sections/companies_days_exceptions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Company Days Exceptions
1+
# Companies Days Exceptions
22

33
Days-exceptions is a date interval that defines a working or a non-working period of time.
44

sections/leaves_support.md

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,57 @@
11
# Leaves Support
22

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
44

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:
76

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
955

1056
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:
1157

@@ -29,7 +75,7 @@ Example of response:
2975
"info": {
3076
"type":"user_working_days_count",
3177
"params": {
32-
"user_id":8,
78+
"user_id":76509,
3379
"start_date":"2017-07-06T00:00:00",
3480
"end_date":"2017-07-30T00:00:00"
3581
}

0 commit comments

Comments
 (0)