Skip to content

Commit

Permalink
Updating the API documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
FranciscoCardoso913 committed Aug 29, 2023
1 parent a124a32 commit deedeb5
Show file tree
Hide file tree
Showing 12 changed files with 14,077 additions and 9,967 deletions.
36 changes: 36 additions & 0 deletions documentation/docs/applications/approve.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Highlight from "../../src/highlight.js"
## Details

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

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

Expand Down Expand Up @@ -169,3 +170,38 @@ values={[

</TabItem>
</Tabs>
### Example 5 - Application is not verified

**Code** : <Highlight level="danger" inline>409 CONFLICT</Highlight>

<Tabs
defaultValue="request"
values={[
{label: 'Request', value: 'request'},
{label: 'Response', value: 'response'},
]}
>
<TabItem value="request">

```bash
/applications/company/631a18cf8e61e0acea76e5e1/approve
```

</TabItem>

<TabItem value="response">

```json
{
"error_code": 1,
"errors": [
{
"msg": "application-must-be-verified"
}
]
}
```

</TabItem>
</Tabs>
45 changes: 43 additions & 2 deletions documentation/docs/applications/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Highlight from "../../src/highlight.js"
## Details

This endpoint is used to create company applications.
In order of a Company to use its account, the application must be accepted by an Admin and then the Company should
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
finish its registration.

**URL** : `/apply/company`
Expand Down Expand Up @@ -249,7 +249,48 @@ values={[
</TabItem>
</Tabs>

### Example 5 - Invalid Password
### Example 5 - Application with the same email created recently

**Code** : <Highlight level="danger" inline>403 FORBIDDEN</Highlight>

<Tabs
defaultValue="request"
values={[
{label: 'Request', value: 'request'},
{label: 'Response', value: 'response'},
]}
>
<TabItem value="request">

```json
{
"email": "[email protected]",
"password": "password123",
"companyName": "Company",
"motivation": "We wish to revolutionize the industry with young engineers."
}
```

</TabItem>

<TabItem value="response">

```json
{
"error_code": 1,
"errors": [
{
"msg": "company-application-recently-created",
}
]
}
```

</TabItem>
</Tabs>

### Example 6 - Invalid Password

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

Expand Down
38 changes: 38 additions & 0 deletions documentation/docs/applications/reject.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,41 @@ values={[

</TabItem>
</Tabs>
### Example 5 - Application is not verified

**Code** : <Highlight level="danger" inline>409 CONFLICT</Highlight>

<Tabs
defaultValue="request"
values={[
{label: 'Request', value: 'request'},
{label: 'Response', value: 'response'},
]}
>
<TabItem value="request">

```json
{
"rejectReason": "The motivation of the company is not convincing"
}
```

</TabItem>

<TabItem value="response">

```json
{
"error_code": 1,
"errors": [
{
"msg": "application-must-be-verified"
}
]
}
```

</TabItem>
</Tabs>

17 changes: 15 additions & 2 deletions documentation/docs/applications/search.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Filters the applications by the name of the respective companies.
Array of strings which filters the application by their state.

:::caution
Must be a valid state (currently `["PENDING", "APPROVED", "REJECTED"]`).
Must be a valid state (currently `["UNVERIFIED", "PENDING", "APPROVED", "REJECTED"]`).
:::

### submissionDateFrom
Expand Down Expand Up @@ -153,6 +153,7 @@ values={[
"companyName": "Company name",
"motivation": "We wish to revolutionize the industry with young engineers.",
"submittedAt": "2022-09-08T16:31:11.784Z",
"isVerified": true,
"__v": 0,
"state": "PENDING"
},
Expand All @@ -162,6 +163,7 @@ values={[
"companyName": "Example Company",
"motivation": "We are a brand new tech company in Porto, Portugal",
"submittedAt": "2022-09-07T13:15:15.971Z",
"isVerified": true,
"__v": 0,
"approvedAt": "2022-09-07T13:17:30.908Z",
"state": "APPROVED"
Expand All @@ -172,13 +174,24 @@ values={[
"companyName": "Bad Company",
"motivation": "We want to exploit workers.",
"submittedAt": "2022-09-07T13:15:15.971Z",
"isVerified": true,
"__v": 0,
"rejectedAt": "2022-09-07T13:17:30.908Z",
"rejectReason": "Motivation doesn't seem right",
"state": "REJECTED"
},
{
"_id": "63189963541e53a45a423dce",
"email": "[email protected]",
"companyName": "Unverified",
"motivation": "We are a new company in Lisbon",
"submittedAt": "2022-09-07T13:15:15.971Z",
"isVerified": false,
"__v": 0,
"state": "PENDING"
}
],
"docCount": 3
"docCount": 4
}
```

Expand Down
161 changes: 161 additions & 0 deletions documentation/docs/applications/validate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
---
id: validate
title: Validate Application
sidebar_label: Validate Application
slug: /applications/validate
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

import Highlight from "../../src/highlight.js"

## Details

This endpoint is used to validate an application using a previous created token.
The token is generated with the [ create ](./create) endpoint and is sent to the user by email.


**URL** : `/apply/company/:token/validate`

**Method** : <Highlight level="info" inline>POST</Highlight>

## Request examples

### Example 1 - Valid Request

**Code** : <Highlight level="success" inline>200 OK</Highlight>

<Tabs
defaultValue="request"
values={[
{label: 'Request', value: 'request'},
{label: 'Response', value: 'response'},
]}
>
<TabItem value="request">

```bash
/apply/company/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Im5pQGFlZmV1cC5wdCIsImlhdCI6MTY2MzAxMzg0OSwiZXhwIjoxNjYzMDE0NDQ5fQ.k5Z_nBpqt_Hs8JBhLH0ZXTl2-BG-utdIAUdhKXEFuFc/validate
```

</TabItem>

<TabItem value="response">

```json
{}
```

</TabItem>
</Tabs>

### Example 2 - Invalid Token

**Code** : <Highlight level="danger" inline>404 NOT_FOUND</Highlight>

<Tabs
defaultValue="request"
values={[
{label: 'Request', value: 'request'},
{label: 'Response', value: 'response'},
]}
>
<TabItem value="request">

```bash
/apply/company/invalid/validate

```

</TabItem>

<TabItem value="response">

```json
{
"error_code": 3,
"errors": [
{
"msg": "invalid-token"
}
]
}
```

</TabItem>
</Tabs>

### Example 3 - Expired Token

**Code** : <Highlight level="danger" inline>410 GONE</Highlight>

<Tabs
defaultValue="request"
values={[
{label: 'Request', value: 'request'},
{label: 'Response', value: 'response'},
]}
>
<TabItem value="request">

```bash
/apply/company/expired/validate
```

</TabItem>

<TabItem value="response">

```json
{
"error_code": 3,
"errors": [
{
"msg": "expired-token"
}
]
}
```

</TabItem>
</Tabs>

### Example 4 - Application Already Validated

**Code** : <Highlight level="danger" inline>409 CONFLICT</Highlight>

<Tabs
defaultValue="request"
values={[
{label: 'Request', value: 'request'},
{label: 'Response', value: 'response'},
]}
>
<TabItem value="request">

```bash
/apply/company/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Im5pQGFlZmV1cC5wdCIsImlhdCI6MTY2MzAxMzg0OSwiZXhwIjoxNjYzMDE0NDQ5fQ.k5Z_nBpqt_Hs8JBhLH0ZXTl2-BG-utdIAUdhKXEFuFc/validate
```

</TabItem>

<TabItem value="response">

```json
{
"error_code": 3,
"errors": [
{
"msg": "application-already-validated"
}
]
}
```

</TabItem>
</Tabs>
Loading

0 comments on commit deedeb5

Please sign in to comment.