Skip to content

Commit

Permalink
[Release] Version 0.0.2 (#249)
Browse files Browse the repository at this point in the history
* [Fix] Various bug fixes (#236)

* [Fix] Prevent RCD email from breaking into two lines (#237)

* [Feature] Add date of birth filter to permit holders page (#238)

* [Fix] Convert patient condition field to checkbox field (#239)

* Convert patient condition field to checkbox field

* Fix build error

* [Improvement] Add error logging, improve error handling (#240)

* Add error logging, improve error handling

* Replace GraphQL hooks with custom implementation

* [Feature] Build privacy policy and terms and conditions pages (#241)

* Create privacy policy and ToC pages

* Fix links in ToC pages

* [Fix] Fix replacement application expiry date (#242)

* [Fix] Disable GraphQL playground in production (#244)

* [Fix] Remove GQL playground redirect (#245)

* [Improvement] Various fixes (#246)

* [Fix] Fix homepage RCD emails (#247)

* [Fix] Get most recent permit by latest expiry date (#248)
  • Loading branch information
OustanDing committed Aug 10, 2022
1 parent 43f6edb commit f264903
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/applicants/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const getMostRecentPermit = async (applicantId: number): Promise<Permit |
where: { id: applicantId },
})
.permits({
orderBy: { createdAt: SortOrder.DESC },
orderBy: { expiryDate: SortOrder.DESC },
take: 1,
});

Expand Down
16 changes: 10 additions & 6 deletions lib/graphql/apollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ const schema = applyMiddleware(

export const apolloServer = new ApolloServer({
schema,
playground: {
settings: {
'schema.polling.enable': false, // Disable infinite schema introspection
'request.credentials': 'include', // Include auth token in requests
},
},
playground:
process.env.NODE_ENV === 'development'
? {
settings: {
'schema.polling.enable': false, // Disable infinite schema introspection
'request.credentials': 'include', // Include auth token in requests
},
}
: false,
introspection: process.env.NODE_ENV === 'development',
context,
});
25 changes: 25 additions & 0 deletions pages/404.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { GridItem, Text, VStack } from '@chakra-ui/react';
import Layout from '@components/applicant/Layout';
import { NextPage } from 'next';
import Link from 'next/link';

const NotFound: NextPage = () => {
return (
<Layout>
<GridItem colSpan={12}>
<VStack align="stretch" spacing="24px" minHeight="calc(100vh - 280px)">
<Text as="h1" textStyle="display-xlarge">
404 Page not found
</Text>
<Link href="/" passHref>
<Text as="a" textStyle="button-regular" color="primary">
Back to home
</Text>
</Link>
</VStack>
</GridItem>
</Layout>
);
};

export default NotFound;
25 changes: 25 additions & 0 deletions pages/500.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { GridItem, Text, VStack } from '@chakra-ui/react';
import Layout from '@components/applicant/Layout';
import { NextPage } from 'next';
import Link from 'next/link';

const ErrorPage: NextPage = () => {
return (
<Layout>
<GridItem colSpan={12}>
<VStack align="stretch" spacing="24px" minHeight="calc(100vh - 280px)">
<Text as="h1" textStyle="display-xlarge">
500 Internal error
</Text>
<Link href="/" passHref>
<Text as="a" textStyle="button-regular" color="primary">
Back to home
</Text>
</Link>
</VStack>
</GridItem>
</Layout>
);
};

export default ErrorPage;
7 changes: 7 additions & 0 deletions pages/api/payment-received.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import crypto from 'crypto'; // Verifying Shopify Request
import getRawBody from 'raw-body';
import sendConfirmationEmail from '@lib/applications/sendConfirmationEmail';
import { stripPostalCode } from '@lib/utils/format';
import logger from '@lib/utils/logging';

/**
* Webhook to handle payment submission from Shopify
Expand Down Expand Up @@ -46,6 +47,7 @@ import { stripPostalCode } from '@lib/utils/format';
*/
const paymentReceivedHandler: NextApiHandler = async (req, res) => {
if (req.method !== 'POST') {
logger.error('Failed to process payment received webhook payload, method not allowed');
return res.status(405).end('Method not allowed');
}

Expand All @@ -57,6 +59,10 @@ const paymentReceivedHandler: NextApiHandler = async (req, res) => {
.update(rawBody)
.digest('base64');
if (digest !== hmacHeader) {
logger.error(
{ req, rawBody },
`Failed to process payment received webhook payload, response did not come from Shopify`
);
return res.status(401).end();
}

Expand Down Expand Up @@ -162,6 +168,7 @@ const paymentReceivedHandler: NextApiHandler = async (req, res) => {
}
} catch (err) {
// TODO: Add some sort of logging or notification
logger.error({ rawBody, error: err }, `Failed to process webhook payload`);
res.status(500).end();
}

Expand Down
4 changes: 2 additions & 2 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default function Landing() {
</Text>
<Text as="p" textStyle="body-regular" align="left" mt="24px">
After completing the form, either email (
<a href="mailto:rcdparkingpermit@richmond.org">
<a href="mailto:rcdparkingpermit@rcdrichmond.org">
<Text as="span" fontWeight="bold" whiteSpace="nowrap">
parkingpermit@rcdrichmond.org
</Text>
Expand Down Expand Up @@ -213,7 +213,7 @@ export default function Landing() {
604-232-2404
</Text>{' '}
or via email at{' '}
<a href="mailto:rcdparkingpermit@richmond.org">
<a href="mailto:rcdparkingpermit@rcdrichmond.org">
<Text as="span" fontWeight="bold" whiteSpace="nowrap">
parkingpermit@rcdrichmond.org
</Text>
Expand Down

0 comments on commit f264903

Please sign in to comment.