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

Fixing our build #239

Merged
merged 35 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e2a1f88
progress
ermish Apr 28, 2023
b9492e1
fix(deps): update dependency firebase-admin to v11.6.0 (#182)
renovate[bot] May 4, 2023
6680f48
got build and queries working again! (#181)
ermish Jun 2, 2023
d6fcc80
fix(deps): update dependency csv-parse to v5.3.8 (#183)
renovate[bot] Jun 2, 2023
8958a59
chore(deps): update yarn to v3.5.1 (#190)
renovate[bot] Jun 2, 2023
810a0c8
fix(deps): update dependency @apollo/server to v4.7.0 (#185)
renovate[bot] Jun 2, 2023
3b5d481
chore(deps): update dependency eslint to v8.40.0 (#179)
renovate[bot] Jun 6, 2023
80ed2ca
chore(deps): update dependency firebase-tools to v11.28.0 (#184)
renovate[bot] Jun 6, 2023
49a2d44
fix(deps): update dependency firebase to v9.22.0 (#186)
renovate[bot] Jun 6, 2023
7ee4576
chore(deps): update typescript-eslint monorepo to v5.62.0 (#187)
renovate[bot] Aug 1, 2023
4f5fe68
chore(deps): update dependency @types/chai to v4.3.5 (#188)
renovate[bot] Aug 1, 2023
cec108d
chore(deps): update dependency all-contributors-cli to v6.26.1 (#189)
renovate[bot] Aug 1, 2023
0acee55
fix(deps): update dependency csv-parse to v5.4.0 (#193)
renovate[bot] Aug 1, 2023
2f05c00
fix: add firebase service account key to env variable (#204)
evan-desu Aug 5, 2023
f51ef65
chore(deps): update graphqlcodegenerator monorepo to v4 (#194)
renovate[bot] Aug 5, 2023
5a53afe
chore(deps): update dependency node to v18.17.0 (#197)
renovate[bot] Aug 5, 2023
191a7b6
fix(deps): update dependency firebase to v10 (#210)
renovate[bot] Aug 7, 2023
41762c7
chore(deps): update dependency firebase-tools to v12 (#192)
renovate[bot] Aug 7, 2023
d938aa2
feat: add Submission type and input (#208)
evan-desu Aug 8, 2023
515d8d2
feat: add mutations for addFacility and addHealthcareProfessional (#203)
theyokohamalife Aug 8, 2023
9c839a7
chore(deps): update reviewdog/action-eslint action to v1.19.2 (#205)
renovate[bot] Aug 8, 2023
3ab1233
Remove codeowners until the repo goes public (#228)
theyokohamalife Aug 21, 2023
06575b0
chore: set renovate confidence to high (#215)
theyokohamalife Aug 21, 2023
177be29
Refactor FacilityService and HealthcareProfessionalService (#223)
theyokohamalife Aug 21, 2023
de67a48
chore(deps): update node.js to v18.17.1 (#216)
renovate[bot] Aug 21, 2023
d04eb6e
chore(deps): update dependency @graphql-codegen/cli to v5 (#217)
renovate[bot] Aug 21, 2023
14d0bfa
:busts_in_silhouette: Add @evan-desu as a contributor (#231)
theyokohamalife Aug 24, 2023
9456f3e
feat: add a submissionService file and Submission type definitions (#…
evan-desu Aug 24, 2023
07d27a0
feat: add a submissionService file and Submission type definitions (#…
evan-desu Aug 26, 2023
05acbb9
feat: implement end-to-end testing with Jest and Supertest (#227)
theyokohamalife Aug 27, 2023
dc6ec9d
upgraded to node 20 and relevant packages
ermish Aug 28, 2023
4b9186b
got build working!
ermish Aug 28, 2023
407c64b
Merge branch 'main' into ermish/cicd
ermish Aug 28, 2023
e8f3ee7
merge fixes. build works again
ermish Aug 28, 2023
5281252
commenting out in progress workflows
ermish Aug 29, 2023
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
18 changes: 18 additions & 0 deletions .github/workflows/buildandtest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build Docker Image

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag find-a-doc-api:$(date +%s)
18 changes: 18 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build Docker Image

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag find-a-doc-api:$(date +%s)
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ yarn-error.log
eslint-results.sarif

# App specific
src/typeDefs/gqlTypes.ts
.env*
!.env.sample
!.env.dev
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.17.0
20.5.1
481 changes: 241 additions & 240 deletions .yarn/releases/yarn-3.5.1.cjs → .yarn/releases/yarn-3.6.3.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.5.1.cjs
yarnPath: .yarn/releases/yarn-3.6.3.cjs
2 changes: 1 addition & 1 deletion docker/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18.17.1
FROM node:20.5.1

# Create app directore
WORKDIR /usr/src/app
Expand Down
30 changes: 16 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"generate": "graphql-codegen --config ./src/typesgeneratorconfig.ts",
"lint": "eslint . --ext .js,.ts,.json",
"lint:check": "eslint . --ext .js,.ts,.json",
"lint:ci": "eslint . --ext .js,.ts,.json"
"lint:ci": "eslint . --ext .js,.ts,.json",
"preprod": "yarn generate",
"predev": "yarn generate"
},
"repository": {
"type": "git",
Expand All @@ -32,11 +34,11 @@
"homepage": "https://github.com/ourjapanlife/findadoc-server#readme",
"devDependencies": {
"@graphql-codegen/cli": "^5.0.0",
"@graphql-codegen/typescript": "^4.0.0",
"@graphql-codegen/typescript-resolvers": "^4.0.0",
"@graphql-codegen/typescript": "^4.0.1",
"@graphql-codegen/typescript-resolvers": "^4.0.1",
"@jest/globals": "^29.6.2",
"@types/jest": "^29.5.3",
"@types/node": "^20.5.1",
"@types/jest": "^29.5.4",
"@types/node": "^20.5.7",
"@types/supertest": "^2.0.12",
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.31.0",
Expand All @@ -46,26 +48,26 @@
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-json": "^3.1.0",
"firebase-tools": "^12.0.0",
"firebase-tools": "^12.5.2",
"husky": "^8.0.1",
"jest": "^29.6.2",
"jest": "^29.6.4",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"ts-node-dev": "^2.0.0",
"typescript": "^5.0.0"
"typescript": "^5.2.2"
},
"dependencies": {
"@apollo/server": "^4.3.2",
"@apollo/server": "^4.9.2",
"@graphql-tools/mock": "^9.0.0",
"@graphql-tools/schema": "^10.0.0",
"csv-parse": "^5.3.3",
"dotenv": "^16.3.1",
"firebase": "^10.0.0",
"firebase-admin": "^11.5.0",
"graphql": "^16.6.0",
"firebase": "^10.3.0",
"firebase-admin": "^11.10.1",
"graphql": "^16.8.0",
"graphql-import-node": "^0.0.5",
"graphql-tag": "^2.12.6",
"supertest": "^6.3.0"
"supertest": "^6.3.3"
},
"packageManager": "yarn@3.5.1"
"packageManager": "yarn@3.6.3"
}
25 changes: 9 additions & 16 deletions src/databaseSeedTool.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { initializeDb } from './database'
import { addHealthcareProfessional } from './services/healthcareProfessionalService'
import { addFacility } from './services/facilityService'

import { fakeHealthcareProfessionals } from './fakeData/healthcareProfessional'
import { fakeHealthcareProfessionals } from './fakeData/healthcareProfessionals'
import { fakeFacilities } from './fakeData/facilities'
Copy link
Collaborator

@theyokohamalife theyokohamalife Aug 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to use mock data that's autogenerated instead of seed files that will have to be updated and maintained when schema changes are made. What are your thoughts?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for tests, yes, but we're likely going to want initial seed data to have the site functional beyond testing a single endpoint. So basically, we'll want both.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should use real examples then?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's what these are 😆


import { getFirestore } from 'firebase-admin/firestore'

export const seedDatabase = () => {
export const seedDatabase = async () => {
const args = process.argv

// initializeDb()
Expand All @@ -16,22 +15,16 @@ export const seedDatabase = () => {

const healthcareProfessionals = fakeHealthcareProfessionals()
const facilities = fakeFacilities()

const healthcareProfessionalForFacility = healthcareProfessionals[0]

facilities[0].healthcareProfessionals = [healthcareProfessionalForFacility]

async function test() {
// const hpRef = db.collection('healthcareProfessionals')

await healthcareProfessionals.forEach(hp => {
addHealthcareProfessional(hp)
})
facilities[0].healthcareProfessionals = [healthcareProfessionalForFacility]

const facilitiesRef = db.collection('facilities')
for await (const hp of healthcareProfessionals) {
await addHealthcareProfessional(hp)
}

await facilities.forEach(facility => {
addFacility(facility)
})
for await (const facility of facilities) {
await addFacility(facility)
}
}
26 changes: 26 additions & 0 deletions src/fakeData/facilities.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Facility } from '../typeDefs/gqlTypes'

export const fakeFacilities = () => {
const facility : Facility = {
nameEn: 'Zoo',
nameJa: '動物園',
contact: {
address: {
// generate fake data from type PhysicalAddress in gqlTypes.ts file
addressLine1En: '1-1-1',
addressLine2En: 'Ueno',
cityEn: 'Taito',
prefectureEn: 'Tokyo',
postalCode: '100-0000'
},
email: '[email protected]',
phone: '08000000000',
website: 'https://zoo.test.com',
mapsLink: ''
},
healthcareProfessionalIds: [],
healthcareProfessionals: []
}

return [facility]
}
Comment on lines +1 to +26
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was removed in #227 because it wasn't being used. Is there a reason we need to reintroduce the fake data?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we want fake data.

  1. this will be used for when we want to test endpoints by adding data, updating it, then deleting it.
  2. we will also want seed data for when we load up a fake/test database so the site isn't empty.

Keep in mind this is just a starting point and we'll need to update this iteratively.

80 changes: 80 additions & 0 deletions src/fakeData/healthcareProfessionals.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { HealthcareProfessional, Locale, LocaleName, Degree,
Specialty, SpecialtyName, SpokenLanguage, Insurance } from '../typeDefs/gqlTypes'

export const fakeHealthcareProfessionals = () => {
const doctorDoctor : LocaleName = {
lastName: 'Doctor',
firstName: 'Doctor',
middleName: 'MD',
locale: Locale.English
}
const medicalDegree : Degree = {
nameJa: 'メヂカル',
nameEn: 'Medical',
abbreviation: 'MD'
}

const japanese : SpokenLanguage = {
iso639_3: 'ja',
nameJa: '日本語',
nameEn: 'Japanese',
nameNative: 'Japanese'
}

const neurologyEn : SpecialtyName = {
name: 'Neurology',
locale: Locale.English
}

const neurology : Specialty = {
names: [neurologyEn]
}

const healthcareProfessionalOne : HealthcareProfessional = {
names: [doctorDoctor],
degrees: [medicalDegree],
spokenLanguages: [japanese],
specialties: [neurology],
acceptedInsurance: [Insurance.InternationalHealthInsurance],
isDeleted: false
}

const name : LocaleName = {
lastName: 'チェ',
firstName: 'ジェイコブ',
middleName: 'ベイヤード',
locale: Locale.Japanese
}
const englishDegree : Degree = {
nameJa: '英語',
nameEn: 'English',
abbreviation: 'En'
}

const english : SpokenLanguage = {
iso639_3: 'en-US',
nameJa: '英語',
nameEn: 'English',
nameNative: 'English'
}

const specialtyName : SpecialtyName = {
name: 'Pandas',
locale: Locale.English
}

const pandaSpecialty : Specialty = {
names: [specialtyName]
}

const healthcareProfessionalTwo : HealthcareProfessional = {
names: [name],
degrees: [englishDegree],
spokenLanguages: [english],
specialties: [pandaSpecialty],
acceptedInsurance: [Insurance.InternationalHealthInsurance],
isDeleted: false
}

return [healthcareProfessionalOne, healthcareProfessionalTwo]
}
Comment on lines +1 to +80
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was also removed in #227

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I realized that we removed it. We shouldn't have 😅

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ermish I asked this in the issue, but I'll ask it again here. What can this fake data do that auto-mocking from the schema can't? It seems like extra work to manually seed the db with files that will have to be updated and maintained.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

answered in the previous comment:

yes, we want fake data.
this will be used for when we want to test endpoints by adding data, updating it, then deleting it.
we will also want seed data for when we load up a fake/test database so the site isn't empty.
Keep in mind this is just a starting point and we'll need to update this iteratively.

2 changes: 1 addition & 1 deletion src/services/facilityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function addFacility(input: gqlTypes.Facility) {
&& input.healthcareProfessionals !== undefined
&& input.healthcareProfessionals.length > 0) {
addHealthcareProfessional(
healthcareProfessionalRef, input.healthcareProfessionals[0] as gqlTypes.HealthcareProfessional
input.healthcareProfessionals[0] as gqlTypes.HealthcareProfessional, healthcareProfessionalRef
)
}

Expand Down
13 changes: 8 additions & 5 deletions src/services/healthcareProfessionalService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ export async function getHealthcareProfessionalById(id: string) {
return convertedEntity
}

export async function addHealthcareProfessional(
healthcareProfessionalRef:
FirebaseFirestore.DocumentReference<firebase.DocumentData>,
input: typeDefs.HealthcareProfessional
export async function addHealthcareProfessional(
input: typeDefs.HealthcareProfessional, healthcareProfessionalRef:
FirebaseFirestore.DocumentReference<firebase.DocumentData>
) {
if (!healthcareProfessionalRef) {
healthcareProfessionalRef = db.collection('healthcareProfessionals').doc()
}

const newHealthcareProfessional = {
id: healthcareProfessionalRef.id,
acceptedInsurance: mapAndValidateInsurance(input.acceptedInsurance as []),
acceptedInsurance: mapAndValidateInsurance(input.acceptedInsurance as typeDefs.Insurance[]),
degrees: mapAndValidateDegrees(input.degrees as typeDefs.Degree[]),
names: mapAndValidateNames(input.names as typeDefs.LocaleName[]),
specialties: mapAndValidateSpecialties(input.specialties as typeDefs.Specialty[]),
Expand Down
Loading
Loading