Skip to content

Commit 43a1e44

Browse files
Updating the API documentation
1 parent 96719ac commit 43a1e44

File tree

14 files changed

+6073
-3575
lines changed

14 files changed

+6073
-3575
lines changed

documentation/docs-index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ module.exports = {
2828
"companies/disable",
2929
"companies/enable",
3030
"companies/delete",
31-
"companies/concurrent-offers"
31+
"companies/concurrent-offers",
32+
"companies/get-application"
3233
],
3334
Applications: [
3435
"applications/create",
3536
"applications/search",
3637
"applications/approve",
37-
"applications/reject"
38+
"applications/reject",
39+
"applications/validate"
3840
],
3941
Auth: [
4042
"auth/login",

documentation/docs/applications/approve.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import Highlight from "../../src/highlight.js"
1313
## Details
1414

1515
This endpoint is used to approve a company Application, specified by applicationId.
16+
It changes all the companies offers to not pending.
1617

1718
**URL** : `/applications/company/:applicationId/approve`
1819

@@ -169,3 +170,38 @@ values={[
169170

170171
</TabItem>
171172
</Tabs>
173+
### Example 5 - Application is not verified
174+
175+
**Code** : <Highlight level="danger" inline>409 CONFLICT</Highlight>
176+
177+
<Tabs
178+
defaultValue="request"
179+
values={[
180+
{label: 'Request', value: 'request'},
181+
{label: 'Response', value: 'response'},
182+
]}
183+
>
184+
185+
<TabItem value="request">
186+
187+
```bash
188+
/applications/company/631a18cf8e61e0acea76e5e1/approve
189+
```
190+
191+
</TabItem>
192+
193+
<TabItem value="response">
194+
195+
```json
196+
{
197+
"error_code": 1,
198+
"errors": [
199+
{
200+
"msg": "application-must-be-verified"
201+
}
202+
]
203+
}
204+
```
205+
206+
</TabItem>
207+
</Tabs>

documentation/docs/applications/create.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Highlight from "../../src/highlight.js"
1313
## Details
1414

1515
This endpoint is used to create company applications.
16-
In order of a Company to use its account, the application must be accepted by an Admin and then the Company should
16+
In order of a Company to use its account, the company must verify its application by clicking in a link sent by email after the creation of the application and then the Company should
1717
finish its registration.
1818

1919
**URL** : `/apply/company`
@@ -249,7 +249,48 @@ values={[
249249
</TabItem>
250250
</Tabs>
251251

252-
### Example 5 - Invalid Password
252+
### Example 5 - Application with the same email created recently
253+
254+
**Code** : <Highlight level="danger" inline>403 FORBIDDEN</Highlight>
255+
256+
<Tabs
257+
defaultValue="request"
258+
values={[
259+
{label: 'Request', value: 'request'},
260+
{label: 'Response', value: 'response'},
261+
]}
262+
>
263+
264+
<TabItem value="request">
265+
266+
```json
267+
{
268+
"email": "[email protected]",
269+
"password": "password123",
270+
"companyName": "Company",
271+
"motivation": "We wish to revolutionize the industry with young engineers."
272+
}
273+
```
274+
275+
</TabItem>
276+
277+
<TabItem value="response">
278+
279+
```json
280+
{
281+
"error_code": 1,
282+
"errors": [
283+
{
284+
"msg": "company-application-recently-created",
285+
}
286+
]
287+
}
288+
```
289+
290+
</TabItem>
291+
</Tabs>
292+
293+
### Example 6 - Invalid Password
253294

254295
**Code** : <Highlight level="danger" inline>422 UNPROCESSABLE ENTITY</Highlight>
255296

documentation/docs/applications/reject.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,41 @@ values={[
197197

198198
</TabItem>
199199
</Tabs>
200+
### Example 5 - Application is not verified
201+
202+
**Code** : <Highlight level="danger" inline>409 CONFLICT</Highlight>
203+
204+
<Tabs
205+
defaultValue="request"
206+
values={[
207+
{label: 'Request', value: 'request'},
208+
{label: 'Response', value: 'response'},
209+
]}
210+
>
211+
212+
<TabItem value="request">
213+
214+
```json
215+
{
216+
"rejectReason": "The motivation of the company is not convincing"
217+
}
218+
```
219+
220+
</TabItem>
221+
222+
<TabItem value="response">
223+
224+
```json
225+
{
226+
"error_code": 1,
227+
"errors": [
228+
{
229+
"msg": "application-must-be-verified"
230+
}
231+
]
232+
}
233+
```
234+
235+
</TabItem>
236+
</Tabs>
237+

documentation/docs/applications/search.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Filters the applications by the name of the respective companies.
6666
Array of strings which filters the application by their state.
6767

6868
:::caution
69-
Must be a valid state (currently `["PENDING", "APPROVED", "REJECTED"]`).
69+
Must be a valid state (currently `["UNVERIFIED", "PENDING", "APPROVED", "REJECTED"]`).
7070
:::
7171

7272
### submissionDateFrom
@@ -153,6 +153,7 @@ values={[
153153
"companyName": "Company name",
154154
"motivation": "We wish to revolutionize the industry with young engineers.",
155155
"submittedAt": "2022-09-08T16:31:11.784Z",
156+
"isVerified": true,
156157
"__v": 0,
157158
"state": "PENDING"
158159
},
@@ -162,6 +163,7 @@ values={[
162163
"companyName": "Example Company",
163164
"motivation": "We are a brand new tech company in Porto, Portugal",
164165
"submittedAt": "2022-09-07T13:15:15.971Z",
166+
"isVerified": true,
165167
"__v": 0,
166168
"approvedAt": "2022-09-07T13:17:30.908Z",
167169
"state": "APPROVED"
@@ -172,13 +174,24 @@ values={[
172174
"companyName": "Bad Company",
173175
"motivation": "We want to exploit workers.",
174176
"submittedAt": "2022-09-07T13:15:15.971Z",
177+
"isVerified": true,
175178
"__v": 0,
176179
"rejectedAt": "2022-09-07T13:17:30.908Z",
177180
"rejectReason": "Motivation doesn't seem right",
178181
"state": "REJECTED"
182+
},
183+
{
184+
"_id": "63189963541e53a45a423dce",
185+
"email": "[email protected]",
186+
"companyName": "Unverified",
187+
"motivation": "We are a new company in Lisbon",
188+
"submittedAt": "2022-09-07T13:15:15.971Z",
189+
"isVerified": false,
190+
"__v": 0,
191+
"state": "PENDING"
179192
}
180193
],
181-
"docCount": 3
194+
"docCount": 4
182195
}
183196
```
184197

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
---
2+
id: validate
3+
title: Validate Application
4+
sidebar_label: Validate Application
5+
slug: /applications/validate
6+
---
7+
8+
import Tabs from '@theme/Tabs';
9+
import TabItem from '@theme/TabItem';
10+
11+
import Highlight from "../../src/highlight.js"
12+
13+
## Details
14+
15+
This endpoint is used to validate an application using a previous created token.
16+
The token is generated with the [ create ](./create) endpoint and is sent to the user by email.
17+
18+
19+
**URL** : `/apply/company/:token/validate`
20+
21+
**Method** : <Highlight level="info" inline>POST</Highlight>
22+
23+
## Request examples
24+
25+
### Example 1 - Valid Request
26+
27+
**Code** : <Highlight level="success" inline>200 OK</Highlight>
28+
29+
<Tabs
30+
defaultValue="request"
31+
values={[
32+
{label: 'Request', value: 'request'},
33+
{label: 'Response', value: 'response'},
34+
]}
35+
>
36+
37+
<TabItem value="request">
38+
39+
```bash
40+
/apply/company/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Im5pQGFlZmV1cC5wdCIsImlhdCI6MTY2MzAxMzg0OSwiZXhwIjoxNjYzMDE0NDQ5fQ.k5Z_nBpqt_Hs8JBhLH0ZXTl2-BG-utdIAUdhKXEFuFc/validate
41+
```
42+
43+
</TabItem>
44+
45+
<TabItem value="response">
46+
47+
```json
48+
{}
49+
```
50+
51+
</TabItem>
52+
</Tabs>
53+
54+
### Example 2 - Invalid Token
55+
56+
**Code** : <Highlight level="danger" inline>404 NOT_FOUND</Highlight>
57+
58+
<Tabs
59+
defaultValue="request"
60+
values={[
61+
{label: 'Request', value: 'request'},
62+
{label: 'Response', value: 'response'},
63+
]}
64+
>
65+
66+
<TabItem value="request">
67+
68+
```bash
69+
/apply/company/invalid/validate
70+
71+
```
72+
73+
</TabItem>
74+
75+
<TabItem value="response">
76+
77+
```json
78+
{
79+
"error_code": 3,
80+
"errors": [
81+
{
82+
"msg": "invalid-token"
83+
}
84+
]
85+
}
86+
```
87+
88+
</TabItem>
89+
</Tabs>
90+
91+
### Example 3 - Expired Token
92+
93+
**Code** : <Highlight level="danger" inline>410 GONE</Highlight>
94+
95+
<Tabs
96+
defaultValue="request"
97+
values={[
98+
{label: 'Request', value: 'request'},
99+
{label: 'Response', value: 'response'},
100+
]}
101+
>
102+
103+
<TabItem value="request">
104+
105+
```bash
106+
/apply/company/expired/validate
107+
```
108+
109+
</TabItem>
110+
111+
<TabItem value="response">
112+
113+
```json
114+
{
115+
"error_code": 3,
116+
"errors": [
117+
{
118+
"msg": "expired-token"
119+
}
120+
]
121+
}
122+
```
123+
124+
</TabItem>
125+
</Tabs>
126+
127+
### Example 4 - Application Already Validated
128+
129+
**Code** : <Highlight level="danger" inline>409 CONFLICT</Highlight>
130+
131+
<Tabs
132+
defaultValue="request"
133+
values={[
134+
{label: 'Request', value: 'request'},
135+
{label: 'Response', value: 'response'},
136+
]}
137+
>
138+
139+
<TabItem value="request">
140+
141+
```bash
142+
/apply/company/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Im5pQGFlZmV1cC5wdCIsImlhdCI6MTY2MzAxMzg0OSwiZXhwIjoxNjYzMDE0NDQ5fQ.k5Z_nBpqt_Hs8JBhLH0ZXTl2-BG-utdIAUdhKXEFuFc/validate
143+
```
144+
145+
</TabItem>
146+
147+
<TabItem value="response">
148+
149+
```json
150+
{
151+
"error_code": 3,
152+
"errors": [
153+
{
154+
"msg": "application-already-validated"
155+
}
156+
]
157+
}
158+
```
159+
160+
</TabItem>
161+
</Tabs>

0 commit comments

Comments
 (0)