-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(emails): ajoute un CRON pour vérifier les emails des laboratoires (
#82)
- Loading branch information
Showing
11 changed files
with
121 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"jobs": [ | ||
{ | ||
"command": "*/10 * * * * curl ${REACT_APP_API_URL}/api/m2m/checkLaboratoryEmails -H \"authorization: ${M2M_BASIC_TOKEN}\"", | ||
"size": "M" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { constants } from 'http2'; | ||
import {Request, Response} from 'express'; | ||
|
||
export const checkLaboratoryEmails = async (_request: Request, response: Response): Promise<void> => { | ||
|
||
|
||
console.info('Cheking emails...'); | ||
|
||
|
||
//TODO | ||
|
||
|
||
response.status(constants.HTTP_STATUS_OK).send('OK'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import express from 'express'; | ||
import { constants } from 'http2'; | ||
import request from 'supertest'; | ||
import { describe, test } from 'vitest'; | ||
import config from '../../utils/config'; | ||
import { basicAuthCheck } from '../checks/authCheck'; | ||
|
||
describe('basicAuth', () => { | ||
const app = express(); | ||
|
||
const myM2MRoute = '/basic-auth-route'; | ||
app.use(myM2MRoute, basicAuthCheck, (_request, response) => | ||
response.sendStatus(constants.HTTP_STATUS_OK) | ||
); | ||
|
||
test('should respond with the status 200 with good basic token', async () => { | ||
await request(app) | ||
.get(myM2MRoute) | ||
.set('authorization', config.m2mBasicToken) | ||
.expect(constants.HTTP_STATUS_OK); | ||
}); | ||
|
||
test('should respond with the status 401 with wrong basic token', async () => { | ||
await request(app) | ||
.get(myM2MRoute) | ||
.set('authorization', 'pas bon token') | ||
.expect(constants.HTTP_STATUS_UNAUTHORIZED); | ||
}); | ||
test('should respond with the status 401 with no basic token', async () => { | ||
await request(app) | ||
.get(myM2MRoute) | ||
.expect(constants.HTTP_STATUS_UNAUTHORIZED); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import express from 'express'; | ||
import { checkLaboratoryEmails } from '../controllers/checkLaboratoryEmailsController'; | ||
import { basicAuthCheck } from '../middlewares/checks/authCheck'; | ||
|
||
export const m2mProtectedRouter = express.Router(); | ||
|
||
m2mProtectedRouter.use(basicAuthCheck); | ||
m2mProtectedRouter.use('/checkLaboratoryEmails', checkLaboratoryEmails) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters