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

Backend: Begin porting to Prisma ORM, migration to TypeScript, use of static analysis (ESLint, Prettier) #102

Merged
merged 33 commits into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d1e749c
Setup prisma ORM
Lhwhatever Mar 18, 2023
198f207
Rewrite backend/src/util.js in TS
Lhwhatever Mar 18, 2023
8c9a872
Setup eslint, prettier, typescript for backend
Lhwhatever Mar 18, 2023
7ecc5d6
Setup typescript and ts-node
Lhwhatever Mar 18, 2023
3537acf
Fix requires issues
Lhwhatever Mar 18, 2023
936a201
Setup npm scripts for prisma schema validation and migrations
Lhwhatever Mar 25, 2023
640763b
Setup nodemon to watch typescript files
Lhwhatever Mar 25, 2023
4146e16
Rewrite first endpoint (/course) with prisma in TS
Lhwhatever Mar 25, 2023
066340b
Rewrite /courses with prisma in TS
Lhwhatever Mar 25, 2023
f6a9411
Fix missing files
Lhwhatever Mar 26, 2023
530134f
Port fetchAllCourses to Prisma
Lhwhatever Apr 1, 2023
a4bc47a
Remove commented old mongodb queries from courses.ts
Lhwhatever Apr 1, 2023
84b27c4
Port fce queries
Lhwhatever Apr 1, 2023
c1a82bd
Fix module resolution issues
Lhwhatever Apr 1, 2023
34d21c2
Add build/ to gitignore
Lhwhatever Apr 1, 2023
ec31253
Add typescript CI check for backend
Lhwhatever Apr 1, 2023
112bb06
Make fce typings consistent
Lhwhatever Apr 1, 2023
056762f
Remove obsolete mongoose models
Lhwhatever Apr 8, 2023
2724051
Remove mongoose as dependency
Lhwhatever Apr 8, 2023
93c82e0
Fix /search endpoint not emulating mongoose paginate
Lhwhatever Apr 8, 2023
1eb638d
Hoist common packages up to the top level
Lhwhatever Apr 8, 2023
e11231c
Update dependencies to fix security vulnerabilities
Lhwhatever May 28, 2023
a5a9150
Fix lint workflow not using hoisted packages
Lhwhatever May 28, 2023
f7090e6
Fix backend lint issues
Lhwhatever May 28, 2023
efe43fe
Add db-validate and db-generate commands to lint.yml
Lhwhatever May 28, 2023
769b33e
Remove dependency on doppler in workflow
Lhwhatever May 28, 2023
9d2f134
formatting
Lhwhatever Sep 7, 2023
ed43020
use dotenv
Lhwhatever Sep 7, 2023
4f8ae03
setup changes for bootcamp
Lhwhatever Sep 7, 2023
ffb3a4f
hoist prettierrc to common
Lhwhatever Sep 7, 2023
c0d4580
use morgan for logging backend requests
Lhwhatever Sep 7, 2023
350a80d
gitignore .env
Lhwhatever Sep 7, 2023
5aa850e
fix backend url in .env.template
Lhwhatever Sep 8, 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
1 change: 1 addition & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BACKEND_URL="https://backend-production-a08a.up.railway.app"
16 changes: 10 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies (Frontend)
working-directory: ./frontend
- name: Install dependencies
working-directory: .
run: npm i
shell: bash
- name: Generate prisma client
working-directory: .
run: npm run db-generate
shell: bash
- name: Check TypeScript (Frontend)
working-directory: ./frontend
run: npx tsc --noEmit
Expand All @@ -18,11 +22,11 @@ jobs:
working-directory: ./frontend
run: npm run lint
shell: bash
- name: Install dependencies (Backend)
working-directory: ./backend
run: npm i
shell: bash
- name: Run ESLint (Backend)
working-directory: ./backend
run: npm run lint
shell: bash
- name: Check TypeScript (Backend)
working-directory: ./backend
run: npx tsc --noEmit
shell: bash
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.idea
.env

# Local Netlify folder
.netlify

node_modules/
2 changes: 1 addition & 1 deletion backend/.prettierrc → .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ trailingComma: "es5"
tabWidth: 2
semi: true
singleQuote: false
printWidth: 80
printWidth: 120
28 changes: 11 additions & 17 deletions backend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,21 @@
"node": true,
"es2021": true
},
"extends": "eslint:recommended",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
]
"indent": ["error", 2],
"linebreak-style": ["error", "unix"],
"quotes": ["error", "double"],
"semi": ["error", "always"]
}
}
3 changes: 2 additions & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ data
.env
dist
*.csv
keys
keys
build
4 changes: 2 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
WORKDIR /home/node/app
COPY package*.json ./
USER node
RUN npm install
RUN npm install --omit=dev && npm run build
COPY --chown=node:node . .
ENTRYPOINT ["doppler", "run", "--"]
EXPOSE 3000
CMD ["node", "src/app.js"]
CMD ["node", "src/app.ts"]
6 changes: 6 additions & 0 deletions backend/nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"execMap": {
"ts": "ts-node-esm"
},
"ext": "js,ts,json"
}
Loading
Loading