Skip to content

Commit 84876be

Browse files
committed
Fixes clusterfuck of who knows what happened.
1 parent 567f9a6 commit 84876be

File tree

7 files changed

+310
-198
lines changed

7 files changed

+310
-198
lines changed

source/includes/_accounts.md

Lines changed: 5 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -2,107 +2,18 @@
22

33
## Switch Accounts
44

5-
```shell
6-
curl "https://api.runara.com/accounts/switch/{ID}"
7-
-H "Authorization: Bearer:your.jwt.token"
8-
```
5+
Switches the current account of the user, provided the user has access to the account.
96

10-
Switches the current account of the user provided that the user has access to the account.
11-
12-
<aside class="warning">
7+
<aside class="info">
138
User must have access to the account before switching to it. If they do not, a `401` response is returned.
149
</aside>
1510

1611
### HTTP Request
1712

18-
`GET https://api.runara.com/accounts/switch/{ID}`
19-
20-
### URL Parameters
21-
22-
Parameter | Required | Description | Example
23-
--------- | -------- | ----------- | -----------
24-
ID | true | ID of account to switch to. | `568b55febffebc91068d4579`
25-
26-
## View User Favorites
27-
28-
```shell
29-
curl "https://api.runara.com/accounts/favorites"
30-
-H "Authorization: Bearer:your.jwt.token"
31-
```
32-
> The above command returns JSON structured like this:
33-
34-
```json
35-
{
36-
"data":{
37-
[
38-
{
39-
"name": "Curves2Go",
40-
"locations": [
41-
{
42-
"name": "West End",
43-
"id": "234343"
44-
}
45-
],
46-
"id": "2344342"
47-
}
48-
]
49-
}
50-
}
51-
```
52-
53-
Returns the clients's favorites list.
54-
55-
<aside class="warning">
56-
If you wish to view the favorites of a different client, you can change the method of this request to POST and pass the client's ID as "client".
57-
</aside>
58-
59-
### HTTP Request
60-
61-
`GET https://api.runara.com/accounts/favorites`
62-
63-
### BODY Parameters
64-
65-
Parameter | Required | Description | Example
66-
--------- | -------- | ----------- | -----------
67-
client | false | ID of client if not current client. | `234334`
68-
69-
## Manage User Favorites
70-
71-
```shell
72-
curl "https://api.runara.com/accounts/favorite"
73-
-H "Authorization: Bearer:your.jwt.token"
74-
```
75-
76-
> The above command returns JSON structured like this:
77-
78-
```json
79-
{
80-
"data":{
81-
[
82-
{
83-
"name": "Curves2Go",
84-
"multiple": true,
85-
"locations": [
86-
{
87-
"name": "West End",
88-
"id": "234343"
89-
}
90-
],
91-
"id": "234334"
92-
}
93-
]
94-
}
95-
}
96-
```
97-
98-
Adds or removes (favorites or un-favorites) a location for a client. If client already has the `location` marked as favorite, then this action will un-favorite the locaton.
99-
100-
### HTTP Request
101-
102-
`POST https://api.runara.com/accounts/favorite`
13+
`GET https://api.runara.com/admin/switch/{ID}`
10314

104-
### BODY Parameters
15+
### Route Parameters
10516

10617
Parameter | Required | Description | Example
10718
--------- | -------- | ----------- | -----------
108-
location | true | ID of location to favorite. | `2343432`
19+
ID | true | ID of account to switch to. | `11234433`

source/includes/_admin.md

Lines changed: 114 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,144 @@
11
# Admin
22

3-
## What (and why) are Admin Routes?
3+
## What are Admin Routes?
44

55
The `admin` routes are helper endpoints created to assist staff with day-to-day workflow tasks, such as check-ins and payments. While these tasks can be achieved using other existing endpoints, `admin` routes are always set in the context of a staff member so any information returned is pertinent to the logged-in user (Staff Member).
66

77
## Admin View
88

9-
> Example Result:
9+
> Example Response:
1010
1111
```json
1212
{
13-
"meta" : {
14-
"accounts" : [
15-
{
16-
"id" : "sd5763ce9a89201a8f515fa4",
17-
"name" : "ABC and Co.",
18-
"role" : "staff"
19-
},
20-
{
21-
"id" : "335763ce9a89203a8f515fd0",
22-
"name" : "Curves on South",
23-
"role" : "staff"
24-
}
25-
],
26-
"current_account" : [
27-
{
28-
"id" : "sd5763ce9a89201a8f515fa4",
29-
"name" : "ABC and Co.",
30-
"role" : "staff"
31-
}
32-
]
33-
},
13+
"meta": {
14+
"accounts": [
15+
{
16+
"id": 100110,
17+
"name": "Body by Keelay",
18+
"role": "Administrator"
19+
},
20+
{
21+
"id": 100111,
22+
"name": "5x5 Inc",
23+
"role": "Staff"
24+
}
25+
],
3426
"data": [
27+
{
28+
"id": 477,
29+
"session_id": null,
30+
"name": "StrongLifts Introduction",
31+
"type": "Class",
32+
"item_id": 100118,
33+
"date": "August 28th at 8:00am",
34+
"timestamp": 1535457600,
35+
"duration": "30 minutes",
36+
"timespan": "8:00am - 8:30am",
37+
"clients": [
38+
{
39+
"id": 100137,
40+
"booking_id": 477,
41+
"name": "Fatima Kuphal",
42+
"payment_status": 0,
43+
"payment_status_description": "Unpaid - Pay at Checkin",
44+
"payment_amount": "30.00",
45+
"checked_in": false,
46+
"photo": {
47+
"default": null,
48+
"thumb": null
49+
}
50+
}
51+
],
52+
"account": {
53+
"id": 100110,
54+
"name": "Body by Keelay"
55+
},
56+
"staffed_by": {
57+
"id": 100135,
58+
"name": "Trudie Kirlin",
59+
"photo": {
60+
"default": "https:\/\/randomuser.me\/api\/portraits\/men\/1.jpg",
61+
"thumb": "https:\/\/randomuser.me\/api\/portraits\/men\/1.jpg"
62+
}
63+
},
64+
"location": {
65+
"id": 100118,
66+
"name": "Pineville",
67+
"room": null
68+
},
69+
"capacity": 20,
70+
"total_clients": 1,
71+
"total_checkins": 0
72+
},
73+
{
74+
"id": 848,
75+
"session_id": null,
76+
"name": "Cut and Shampoo",
77+
"type": "Appointment",
78+
"item_id": 100111,
79+
"date": "August 28th at 10:30am",
80+
"timestamp": 1535466600,
81+
"duration": "105 minutes",
82+
"timespan": "10:30am - 12:15pm",
83+
"clients": [
3584
{
36-
"id": "5976940e9a81200a4f10c363",
37-
"session_id": "5959bdce1a892041711c4a2a-5959bdce1a892041711c4a2d-1500985800",
38-
"name": "Insanity Level 1",
39-
"type": "class",
40-
"item_id": "5959bdce1a892041711c4a2a",
41-
"date": "July 25th at 12:30pm",
42-
"timestamp": 1500985800,
43-
"duration": "60 minutes",
44-
"timespan": "12:30pm - 1:30pm",
45-
"clients": [
46-
{
47-
"id": "595b06a91a89204afc2fb2c4",
48-
"booking_id": "5959bdce9a892041711c4a2a-5959bdce1a892041711c4a2d-1500985800",
49-
"name": "Nestor DuBuque",
50-
"payment_status": {
51-
"status": 1,
52-
"description": "Paid - Credit Card"
53-
},
54-
"payment_amount": "24.00",
55-
"checked_in": false
56-
},
57-
{
58-
"id": "595b06a81a89204afe458627",
59-
"booking_id": "5959bdce9a891041711c4a2a-5959bdce9a892041711c4a2d-1500985800",
60-
"name": "Kenyon Hartmann",
61-
"payment_status": {
62-
"status": 0,
63-
"description": "Unpaid - Pay at checkin"
64-
},
65-
"payment_amount": "24.00",
66-
"checked_in": false
67-
}
68-
],
69-
"account": {
70-
"id": "5940b4a81a892006485be28b",
71-
"name": "Curves2Go"
72-
},
73-
"staffed_by": {
74-
"id": "594c6d7f1a8920785c0e25e8",
75-
"name": "Michael Wuori"
76-
},
77-
"location": {
78-
"id": "5940b6251a892006485be2bd",
79-
"name": "Suburbia",
80-
"room": "Studio A"
81-
},
82-
"capacity": 25,
83-
"total_clients": 2,
84-
"total_checkins": 0
85-
}
86-
]
85+
"id": 100112,
86+
"booking_id": 848,
87+
"name": "Jamie Kihn",
88+
"payment_status": 1,
89+
"payment_status_description": "Paid - Cash",
90+
"payment_amount": "64.00",
91+
"checked_in": false,
92+
"photo": {
93+
"default": null,
94+
"thumb": null
95+
}
96+
}
97+
],
98+
"account": {
99+
"id": 100110,
100+
"name": "Body by Keelay"
101+
},
102+
"staffed_by": {
103+
"id": 100135,
104+
"name": "Trudie Kirlin",
105+
"photo": {
106+
"default": "https:\/\/randomuser.me\/api\/portraits\/men\/1.jpg",
107+
"thumb": "https:\/\/randomuser.me\/api\/portraits\/men\/1.jpg"
108+
}
109+
},
110+
"location": {
111+
"id": 100116,
112+
"name": "123 Main",
113+
"room": null
114+
},
115+
"capacity": null,
116+
"total_clients": 1,
117+
"total_checkins": 0
118+
}
119+
]
120+
}
87121
}
88122
```
89123

90124
If logged-in as a staff member, returns upcoming bookings staff accounts.
91125

92-
<aside class="notice">
93126
This endpoint should only be used by staff members. Non staff members will not receive any results from this endpoint.
94-
</aside>
95127

96128
### HTTP Request
97129

98130
`GET https://api.runara.com/admin`
99131

100-
101-
## Switch Accounts
102-
103-
```shell
104-
curl "https://api.runara.com/admin/switch/{ID}"
105-
-H "Authorization: Bearer:your.jwt.token"
106-
```
107-
108-
Switches the current account of the user, provided the user has access to the account.
109-
110-
<aside class="warning">
111-
User must have access to the account before switching to it. If they do not, a `401` response is returned.
132+
<aside class="notice">
133+
If logged-in as a manager or administrator, you can pass an optional staff ID in the request URL to view a particular staff member's bookings. Note: the `accounts` object will return empty as you are not allowed to view a staff member's associated accounts.
112134
</aside>
113135

114-
### HTTP Request
136+
### HTTP Request for Specific Staff (admin-only)
115137

116-
`GET https://api.runara.com/admin/switch/{ID}`
138+
`GET https://api.runara.com/admin/{staff_id}`
117139

118-
### URL Parameters
140+
### Route Parameters
119141

120142
Parameter | Required | Description | Example
121143
--------- | -------- | ----------- | -----------
122-
ID | true | ID of account to switch to. | `568b55febffebc91068d4579`
144+
ID | false | ID of staff to view. | `11234433`

0 commit comments

Comments
 (0)