Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

224 confirmation email when companies register #306

Open
wants to merge 31 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e700271
Added time interval to add second application with the same email add…
dsantosferreira Jan 14, 2023
e3ba9c7
Moved time interval logic to validator
dsantosferreira Jan 14, 2023
ba84863
Sends an email to company to confirm application (not tested)
dsantosferreira Jan 24, 2023
3fd941b
Changing validators to middleware and creating routes to validate app…
FranciscoCardoso913 Jan 26, 2023
7fe08b5
Making the program send a confirmation email when registing
FranciscoCardoso913 Jan 26, 2023
ca019bb
Fixing order in wich emails are sent to company when creating an appl…
FranciscoCardoso913 Jan 29, 2023
74c964a
Add unverified state
dsantosferreira Feb 3, 2023
2a57135
Adding custom errors for token validation
FranciscoCardoso913 Feb 8, 2023
431aacc
Changed emails templates and link from application validation expirat…
FranciscoCardoso913 Feb 11, 2023
a135fdf
Changing the order when the account is created so that it is created …
FranciscoCardoso913 Apr 2, 2023
ba32103
Fixed frontend confirmation link
dsantosferreira Apr 14, 2023
5625a90
Created new isPending attribute in Offer model and implemented creati…
dsantosferreira Apr 14, 2023
bc95f0b
Set isPending of all company's offers to false when its application i…
dsantosferreira Apr 16, 2023
994509a
Get all currently active offers endpoint only returns non-pending off…
dsantosferreira Apr 16, 2023
46f4581
Fixed offers not updating isPending status after company is approved
FranciscoCardoso913 Jun 26, 2023
89b75e8
Route to get an application from a company
FranciscoCardoso913 Jun 27, 2023
96dfd74
Rewriting the emails to match the current flow.
FranciscoCardoso913 Jul 4, 2023
b12205c
Adding and correcting tests for the endpoint apply/company
FranciscoCardoso913 Jul 15, 2023
6dada6d
Adding tests for the endpoint apply/company/:token/validate and chang…
FranciscoCardoso913 Jul 15, 2023
3f60be8
Adding tests for the endpoint /company/:companyId/state
FranciscoCardoso913 Jul 20, 2023
482b015
Created and fixed tests for the offers/ endpoint and fixed tests for …
FranciscoCardoso913 Jul 29, 2023
5d95f3b
Fixed tests from token.js and from the review endpoints
FranciscoCardoso913 Aug 3, 2023
e113bc8
Added tests for the endpoints applications/company/:id/approve and ap…
FranciscoCardoso913 Aug 3, 2023
64b8c31
Changed endpoint that returned company's state to return company's ap…
FranciscoCardoso913 Aug 23, 2023
96719ac
Clear unused functions and unneeded verifications and made more test…
FranciscoCardoso913 Aug 25, 2023
43a1e44
Updating the API documentation
FranciscoCardoso913 Aug 29, 2023
b193933
Improved applications' endpoints documentation
dsantosferreira Sep 10, 2023
711626e
Fixed netlify issue
FranciscoCardoso913 Oct 18, 2023
f7fd7e3
When creating a new application if an old application exists the old …
FranciscoCardoso913 Feb 5, 2024
46d86fd
Updating email texts and error types
FranciscoCardoso913 Feb 5, 2024
4f35451
Merge branch 'develop' of github.com:NIAEFEUP/nijobs-be into 224-conf…
FranciscoCardoso913 Mar 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ JWT_SECRET=Lendas contam que o Rui foi membro do IEEE.
# Frontend Password Recovery Base Route
PASSWORD_RECOVERY_LINK=https://localhost:3000/recover

# Frontend Application Confirmation Base Route
APPLICATION_CONFIRMATION_LINK=https://localhost:3000/apply/

# Specifies the port in which the app will be exposed
PORT=8087

Expand All @@ -45,12 +48,12 @@ ACCESS_CONTROL_ALLOW_ORIGINS=
MAIL_FROM=

# Password for email above
MAIL_FROM_PASSWORD=
MAIL_FROM_PASSWORD=

# Cloudinary API URL to save images
CLOUDINARY_URL=

# Hostname of the application (where the webserver will be served) - without the trailing '/'
# Hostname of the application (where the webserver will be served) - without the trailing '/'
WEBSERVER_HOST=https://localhost:8087

# Path to save file uploads, the path must be relative to the root of the project - Defaults to static
Expand Down
4 changes: 2 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
{
"extends": [
"eslint:recommended"
],
Expand Down Expand Up @@ -99,6 +99,6 @@
"no-var": "error",
"prefer-const": ["error", { "destructuring": "all" }],
"prefer-template": "error",
"template-curly-spacing": "error",
"template-curly-spacing": "error"
}
}
6 changes: 4 additions & 2 deletions documentation/docs-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ module.exports = {
"companies/disable",
"companies/enable",
"companies/delete",
"companies/concurrent-offers"
"companies/concurrent-offers",
"companies/get-application"
],
Applications: [
"applications/create",
"applications/search",
"applications/approve",
"applications/reject"
"applications/reject",
"applications/validate"
],
Auth: [
"auth/login",
Expand Down
37 changes: 37 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,39 @@ 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>
55 changes: 50 additions & 5 deletions documentation/docs/applications/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ 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
finish its registration.
In order for a Company to use its account, the company must verify its application by clicking in a link sent
by email after its creation. After that the Company should finish its registration.

**URL** : `/apply/company`

Expand All @@ -36,7 +36,11 @@ see [register](../auth/register).
Email used for the company application and subsequent account.

Must be in a valid email format.
Can't already be in use for accounts or other applications.
Can't already be in use on any account.

:::info
After creating an application, if another application is created with the same email after 10 minutes, the existing one will be replaced. Creating the new application before the 10 minute mark will result in an error.
:::

### password

Expand Down Expand Up @@ -181,7 +185,7 @@ values={[
"password": "password123",
"companyName": "Company",
"motivation": "We wish to revolutionize the industry with young engineers."
}
}ara quem usa o timetable-bruteforcer
```

</TabItem>
Expand Down Expand Up @@ -249,7 +253,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
39 changes: 39 additions & 0 deletions documentation/docs/applications/reject.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,42 @@ 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": "UNVERIFIED"
}
],
"docCount": 3
"docCount": 4
}
```

Expand Down
Loading
Loading