Skip to content

Commit

Permalink
[Release] Version 0.0.7
Browse files Browse the repository at this point in the history
* [Fix] Pin GitHub CI runner image to ubuntu-20.04 (#285)
* Update README (#284)
* Fix time zone bug in requests header (#281)
* [Fix] Fix time zone for requests and reports (#278)
* [Chore] Add BSF contributors to employee database (#277)
* [Chore] Create docker-compose.yml file for local PostgreSQL instance (#276)
* [Docs] BSF CONTRIBUTING.md (#275)
  • Loading branch information
leogjhuang committed Mar 20, 2023
1 parent 12983bc commit 3f2d160
Show file tree
Hide file tree
Showing 10 changed files with 189 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest]
os: [ubuntu-20.04]
node: [14.17.0]

steps:
Expand Down
91 changes: 91 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Contributions

## New Contributors

Thank you for taking the time to contribute to this repo! This project is actively in use with our
clients and requires the help of volunteers like yourself to maintain and continue to foster this
project’s growth. Every contribution helps and credit is always given!

To get started contributing to this project, please email <bpsf@gmail.com>. An exec on the team will
send you a Slack invite and will onboard you onto our project.

# Roles

We have two roles on the maintenance team: Blueprint Software Foundation (BSF) executive and
contributors.

## Blueprint Software Foundation executive member

BSF is an overarching organization responsible for the upkeep of projects shipped by UW Blueprint.
As of writing, BSF is composed of 3 executives: 2 alumni and a UW Blueprint president.

Executives are responsible for maintaining communications with clients and with UW Blueprint
regarding maintenance projects and onboarding new projects onto BSF. They are also responsible for
coordinating work on tasks/issues and onboarding contributors.

## Contributors

Much of the fruitful maintenance and upkeep work on projects will be due to our wonderful
contributors! Contributors will work with execs in prioritizing and planning maintenance work and
shipping the work to our clients. As of writing, **contributors will be sourced from UW Blueprint
alumni** but we are planning on opening up contributions to those not part of UW Blueprint.

# Contribution workflow

Please follow the following steps in order to productively contribute to this repository.

## Step 1: Fork the repo

On the repository’s main page, click ‘Fork Repo’ at the top of the page.

## Step 2: Configure your environment

Once you have Notion access, take a look at the README.md file,
[development guidelines](https://www.notion.so/uwblueprintexecs/Development-processes-a0313f2bef9941fc8752c8e7b5be5e70)
and
[engineering best practices](https://www.notion.so/uwblueprintexecs/READ-Best-Practices-Engineering-3174edea363b4d4896af8dfc461cfd9c)
to set up your environment.

## Step 3: Connect with people

As mentioned above, if you are not already on our Slack, please email <bpsf@gmail.com>. Once added,
please talk to the execs on which issues or features are highest priority. This will be available as
a Notion board as well.

Once an issue is chosen, discuss with fellow contributors and execs on Slack on how you plan on
approaching the issues. We will subsequently assign you the issue and you can get cracking!

## Step 4: Prepare PR

Clone your fork locally and start to make your changes. Small changes are always greater than huge,
breaking changes! Make sure that you test a variety of situations before you push your change to
your fork!

## Step 5: Pass PR review

Once you feel confident that your change addresses the issue/feature spec, sync your fork with the
main repository and open up a PR on the main repo from your fork. Please provide a detailed
description of your change and ask for the reviews of an exec/designated contributor.

Please be cognizant of an executive’s relatively limited time. Reviews may take longer than you
would expect! Use Slack wisely to ensure that you can get a review in a timely manner.

# Thank you!

We want to thank the following individuals for their tireless contributions:

- Oustan Ding
- Carelynn Tsai
- Vedant Patel
- Angela Dietz
- Anish Aggarwal
- Christian Chan
- Emilio Mena
- Jihad Bunkheila
- Bonnie Chin
- Anthea Tawiah
- Charmaine Wang
- Jeffrey Zhang
- Amanda Guo
- Andy Lee
- Jennifer Tsai
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,40 @@ applicant-facing application portal and an internal user/APP management portal.

## Run locally

1. Start database

```bash
docker-compose up --build
```

2. Run the application

```bash
yarn install
npx prisma generate
yarn dev
```

3. Deploy prisma schema

```bash
npx prisma db push
```

4. Seed database

```bash
npx prisma db seed --preview-feature
```

5. Verify database

```bash
docker exec -it rcd_db /bin/bash -c "psql -U postgres -d rcd"
```

## Run locally (Heroku)

Duplicate `.env.sample` to `.env` and configure environment variables.

To deploy your database schema, run:
Expand Down
4 changes: 2 additions & 2 deletions components/admin/requests/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ShopifyBadge from '@components/admin/ShopifyBadge';
import PermitTypeBadge from '@components/admin/PermitTypeBadge';
import { ApplicationStatus, ApplicationType, PermitType } from '@lib/graphql/types';
import { titlecase } from '@tools/string';
import { formatDateYYYYMMDD } from '@lib/utils/date';
import { formatDateYYYYMMDD, formatDateYYYYMMDDLocal } from '@lib/utils/date';
import { getPermanentPermitExpiryDate } from '@lib/utils/permit-expiry';

type RequestHeaderProps = {
Expand Down Expand Up @@ -85,7 +85,7 @@ export default function RequestHeader({
</Flex>
<HStack spacing={3} marginTop={3}>
<Text textStyle="caption" as="p">
Received on {formatDateYYYYMMDD(createdAt)} at{' '}
Received on {formatDateYYYYMMDDLocal(createdAt)} at{' '}
{createdAt.toLocaleTimeString('en-CA')}
</Text>
</HStack>
Expand Down
4 changes: 2 additions & 2 deletions components/admin/requests/reason-for-replacement/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Box, Text, SimpleGrid, Button } from '@chakra-ui/react'; // Chakra UI
import PermitHolderInfoCard from '@components/admin/LayoutCard'; // Custom Card Component
import EditReasonForReplacementModal from '@components/admin/requests/reason-for-replacement/EditModal'; // Edit modal
import { reasonForReplacementFormSchema } from '@lib/applications/validation';
import { formatDateYYYYMMDD } from '@lib/utils/date';
import { formatDateYYYYMMDDLocal } from '@lib/utils/date';
import {
GetReasonForReplacementRequest,
GetReasonForReplacementResponse,
Expand Down Expand Up @@ -97,7 +97,7 @@ export default function ReasonForReplacementCard(props: ReplacementProps) {
<InfoSection title={`Cause`}>{titlecase(reason)}</InfoSection>
{lostTimestamp && (
<InfoSection title={`Event Timestamp`}>
{formatDateYYYYMMDD(new Date(lostTimestamp), true)}
{formatDateYYYYMMDDLocal(new Date(lostTimestamp), true)}
</InfoSection>
)}
{lostLocation && <InfoSection title={`Location Lost`}>{lostLocation}</InfoSection>}
Expand Down
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: "3.7"

services:
db:
container_name: rcd_db
image: postgres:12-alpine
ports:
- 5432:5432
volumes:
- postgres_data:/var/lib/postgresql/data/
env_file:
- ./.env
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5

volumes:
postgres_data:
8 changes: 6 additions & 2 deletions lib/reports/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import {
} from '@lib/graphql/types';
import { SortOrder } from '@tools/types';
import { formatFullName, formatPhoneNumber, formatPostalCode } from '@lib/utils/format'; // Formatting utils
import { formatDateTimeYYYYMMDDHHMMSS, formatDateYYYYMMDD } from '@lib/utils/date'; // Formatting utils
import {
formatDateTimeYYYYMMDDHHMMSS,
formatDateYYYYMMDD,
formatDateYYYYMMDDLocal,
} from '@lib/utils/date'; // Formatting utils
import { APPLICATIONS_COLUMNS, PERMIT_HOLDERS_COLUMNS } from '@tools/admin/reports';
import { Prisma } from '@prisma/client';
import { getSignedUrlForS3, serverUploadToS3 } from '@lib/utils/s3-utils';
Expand Down Expand Up @@ -264,7 +268,7 @@ export const generateApplicationsReport: Resolver<
...application,
id: applicant?.id,
dateOfBirth: dateOfBirth && formatDateYYYYMMDD(dateOfBirth),
applicationDate: createdAt ? formatDateYYYYMMDD(createdAt, true) : null,
applicationDate: createdAt ? formatDateYYYYMMDDLocal(createdAt, true) : null,
applicantName: formatFullName(firstName, middleName, lastName),
processingFee: `$${processingFee}`,
donationAmount: `$${donationAmount}`,
Expand Down
11 changes: 11 additions & 0 deletions lib/utils/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ export const formatDateYYYYMMDD = (d: Date, withTime = false): string => {
return moment.utc(d).format(formatString);
};

/**
* Format date to be in YYYY-MM-DD format and in local time zone
* @param {Date} date date to be formatted
* @param {boolean} withTime whether to include time in formatted date
* @returns {string} formatted date
*/
export const formatDateYYYYMMDDLocal = (d: Date, withTime = false): string => {
const formatString = withTime ? 'YYYY-MM-DD, hh:mm a' : 'YYYY-MM-DD';
return moment(d).format(formatString);
};

/**
* Format date to be in written in the following format: Sep 11 2021, 03:07 pm not converting to the local timezone
* @param {Date} date date to be formatted
Expand Down
4 changes: 2 additions & 2 deletions pages/admin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { ApplicationStatus, ApplicationType, PermitType } from '@lib/graphql/typ
import useDebounce from '@tools/hooks/useDebounce'; // Debounce hook
import { Column } from 'react-table';
import { formatFullName } from '@lib/utils/format'; // String formatter util
import { formatDateYYYYMMDD } from '@lib/utils/date'; // Date Formatter Util
import { formatDateYYYYMMDDLocal } from '@lib/utils/date'; // Date Formatter Util
import GenerateReportModal from '@components/admin/requests/reports/GenerateModal'; // Generate report modal
import EmptyMessage from '@components/EmptyMessage';

Expand Down Expand Up @@ -82,7 +82,7 @@ const COLUMNS: Column<ApplicationRow>[] = [
width: 240,
sortDescFirst: true,
Cell: ({ value }) => {
return <Text>{formatDateYYYYMMDD(value, true)}</Text>;
return <Text>{formatDateYYYYMMDDLocal(value, true)}</Text>;
},
},
{
Expand Down
20 changes: 20 additions & 0 deletions prisma/dev-seed-utils/employees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,26 @@ const employees = [
lastName: 'Tsai',
email: 'carelynntsai+employee@uwblueprint.org',
},
{
firstName: 'Leo',
lastName: 'Huang',
email: 'leohuang+employee@uwblueprint.org',
},
{
firstName: 'Sherry',
lastName: 'Li',
email: 'sherryli+employee@uwblueprint.org',
},
{
firstName: 'Chinemerem',
lastName: 'Chigbo',
email: 'chinemeremchigbo+employee@uwblueprint.org',
},
{
firstName: 'Adil',
lastName: 'Kapadia',
email: 'adilkapadia+employee@uwblueprint.org',
},
];

/**
Expand Down

0 comments on commit 3f2d160

Please sign in to comment.