-
Notifications
You must be signed in to change notification settings - Fork 2
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
SD 272: decs integration #110
Merged
Merged
Changes from all commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
c1812d2
Add sql-producer behaviour and instructions for setting up local stac…
caf52b6
Add behaviour to convert form complaints data to fit DECS schema
7fa9ecf
Add tests checking complaint data formatting is correct
dc59eb4
Update node version and sql queue config
MaxOSullivan 4d753af
Update eslint version and fix linting errors
8bb2634
Add function to convert enums across complaint types to base complain…
bec1e53
inject validator as argument to validAgainstSchema, add validatorFactory
147c0f9
Add logging of send to queue response
adb6736
changed preprod namespace to new preprod namespace
ab0a748
Merge pull request #113 from UKHomeOffice/SD-710-new-preprod-env
James-Hovell 7e94623
SD-720: Fixed eslint errors and upgraded eslint
SarahJaneLuff 0f4f072
Merge pull request #114 from UKHomeOffice/feature/SD-720-Update-Linti…
joehod ceac847
Add tests for send-to-sqs
56f16ff
Add meaningful error messages to util functions
bd50ba9
readme
9332cd7
Merge pull request #115 from UKHomeOffice/SD-710-new-preprod-env
James-Hovell 2dc5afa
Add sql-producer behaviour and instructions for setting up local stac…
ee3a483
Add behaviour to convert form complaints data to fit DECS schema
ef7868c
Add tests checking complaint data formatting is correct
97e0962
Update node version and sql queue config
MaxOSullivan aa751ef
Update eslint version and fix linting errors
38ced3b
Add function to convert enums across complaint types to base complain…
683244a
inject validator as argument to validAgainstSchema, add validatorFactory
d2d779a
Add logging of send to queue response
17b336c
Add tests for send-to-sqs
26f30e9
Add meaningful error messages to util functions
19a3e91
rebase from master
e5ece04
Update package lock
33cc247
SD-725: Upgrade Node Version to 14
SarahJaneLuff 3302c4d
SD-725: Corrected Typo Error in .drone.yml file for feature branch ev…
SarahJaneLuff a2a6656
Merge pull request #119 from UKHomeOffice/feature/SD-725-upgrade-Node…
sulthan-ahmed 4dc8ea8
formatting for kube change
8a7409b
Merge pull request #120 from UKHomeOffice/SD-710-new-preprod-env
James-Hovell 29d5113
SD-725: Added tagging conditional of kube repo in drone.yml file, to …
SarahJaneLuff b92e1e3
Merge pull request #121 from UKHomeOffice/feature/SD-725-upgrade-Node…
James-Hovell 79923b9
Refactor to json converters to functional approach
8abd40d
Add sql-producer behaviour and instructions for setting up local stac…
861cfff
Add behaviour to convert form complaints data to fit DECS schema
7bcaeb2
Add tests checking complaint data formatting is correct
f7e8dbe
Update node version and sql queue config
MaxOSullivan 6b20185
Update eslint version and fix linting errors
3f33545
Add function to convert enums across complaint types to base complain…
fa6c93a
inject validator as argument to validAgainstSchema, add validatorFactory
97ca852
Add logging of send to queue response
56eef15
Add tests for send-to-sqs
5ceadf3
Add meaningful error messages to util functions
fd2b544
rebase from master
86c159b
Add sql-producer behaviour and instructions for setting up local stac…
3dba7d9
Add behaviour to convert form complaints data to fit DECS schema
4bc627f
Add tests checking complaint data formatting is correct
7410edf
Update node version and sql queue config
MaxOSullivan 5738272
Update eslint version and fix linting errors
502e0c9
Add function to convert enums across complaint types to base complain…
d9d2f1c
inject validator as argument to validAgainstSchema, add validatorFactory
5b492db
Add logging of send to queue response
fd0d8f0
Add tests for send-to-sqs
5014a42
Add meaningful error messages to util functions
ec748b4
Refactor to json converters to functional approach
fdfbf89
Fix merge conflicts with remote
4445851
Fix sendToQueue config option and add test
f8bb068
Add fallback stub email to config
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ apps/**/acceptance/**/*.js | |
LICENSE | ||
README.md | ||
CONTRIBUTING.md | ||
test/executions | ||
test/coverage |
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 |
---|---|---|
@@ -1,7 +1,12 @@ | ||
.DS_Store | ||
apps/*/translations/en | ||
node_modules | ||
node_modules/ | ||
public | ||
npm-debug.log | ||
apps/*/translations/* | ||
!apps/*/translations/src | ||
.idea | ||
.DS_Store | ||
apps/.DS_Store | ||
.nyc_output | ||
.env | ||
test/executions | ||
test/coverage |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM node:10-alpine | ||
FROM node:14-alpine | ||
|
||
RUN apk upgrade --no-cache | ||
RUN addgroup -S app | ||
|
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
## Getting started | ||
|
||
|
||
Get the project from Github | ||
```bash | ||
$ git clone [email protected]:UKHomeOffice/UKVI-Complaints.git && cd UKVI-Complaints | ||
|
@@ -19,6 +20,37 @@ Run the services locally with Docker Compose | |
$ docker-compose up | ||
``` | ||
|
||
|
||
### Set up AWS SQS queue locally | ||
|
||
Run AWS services locally using localstack. | ||
|
||
```bash | ||
$ docker run --rm -p 4566:4566 -p 4571:4571 localstack/localstack | ||
``` | ||
|
||
To create an SQS queue on the localstack instance. | ||
```bash | ||
aws \ | ||
sqs create-queue \ | ||
--queue-name local-queue \ | ||
--endpoint-url http://localhost:4566 \ | ||
--region eu-west-2 | ||
``` | ||
|
||
This will return a url, add this is the url of the localstack sqs queue: | ||
``` | ||
http://localhost:4566/000000000000/local-queue | ||
``` | ||
|
||
To view what is on the queue currently run: | ||
```bash | ||
aws --endpoint-url=http://localhost:4566 --region eu-west-2 sqs receive-message --queue-url http://localhost:4566/000000000000/local-queue --max-number-of-messages 10 | ||
``` | ||
|
||
|
||
### Running in dev | ||
|
||
Getting your hands dirty (You'll need [Redis](http://redis.io/) for this) | ||
```bash | ||
$ npm run dev | ||
|
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,41 @@ | ||
'use strict'; | ||
joehod marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const Validator = require('jsonschema').Validator; | ||
const config = require('../../../config'); | ||
const { validAgainstSchema, sendToQueue } = require('../lib/utils'); | ||
const formatComplaintData = require('../lib/format-complaint-data'); | ||
|
||
module.exports = superclass => class SendToSQS extends superclass { | ||
|
||
// eslint-disable-next-line consistent-return | ||
saveValues(req, res, next) { | ||
try { | ||
if (!config.sendToQueue) { | ||
return next(); | ||
} | ||
|
||
const complaintData = formatComplaintData(req.sessionModel.attributes); | ||
joehod marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if (validAgainstSchema(complaintData, new Validator())) { | ||
return sendToQueue(complaintData) | ||
.then(() => { | ||
next(); | ||
}) | ||
.catch(err => { | ||
SendToSQS.handleError(next, err); | ||
}); | ||
} | ||
} catch (err) { | ||
SendToSQS.handleError(next, err); | ||
} | ||
} | ||
|
||
|
||
static handleError(next, err) { | ||
err.formNotSubmitted = true; | ||
// eslint-disable-next-line no-console | ||
console.error(err); | ||
return next(err); | ||
} | ||
|
||
}; | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you be able to explain the technical architecture before hand, e.g. the data gets sent to a AWS Queue in DECs service.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay yeah I can do that. Max and I were gonna make some changes to the README anyway so we can add more about that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MaxOSullivan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you'll have time for this, so maybe just add this as part of a tech debt ticket for the decs intergration