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

Feat/288 mock api #298

Merged
merged 44 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
3e4ed6e
Added type to createPost()
Monstarrrr Jul 30, 2024
b92b39e
Merge branch 'main' into feat/5_rebuttals-submission to remain up-to-…
Monstarrrr Jul 30, 2024
0134097
Saving progress to switch branch
Monstarrrr Aug 5, 2024
8b02dc7
[WIP] Mock API connection to DB and endpoints
Monstarrrr Aug 11, 2024
ed0618d
Fixed packages
Monstarrrr Aug 11, 2024
9781e6e
Uncommented code that was temporarily commented for testing
Monstarrrr Aug 11, 2024
b854ccf
install ts-node-dev and add dev script
ndharmateja Aug 11, 2024
5d57038
add prettier rc
ndharmateja Aug 11, 2024
69620b0
install express-async-errors
ndharmateja Aug 11, 2024
76b75ab
add routers
ndharmateja Aug 11, 2024
e8ea16c
add middleware
ndharmateja Aug 11, 2024
a333723
refactor registerUser controller into a separate fn
ndharmateja Aug 11, 2024
57a75e3
create express app
ndharmateja Aug 11, 2024
031a73c
clean index.ts
ndharmateja Aug 11, 2024
09a8381
add custom error
ndharmateja Aug 11, 2024
4c7929d
add config
ndharmateja Aug 11, 2024
6b73357
refactor imports
ndharmateja Aug 11, 2024
0a7513d
install @types/node
ndharmateja Aug 11, 2024
06a9000
rename authenticator middleware
ndharmateja Aug 11, 2024
66778db
add logger fns
ndharmateja Aug 11, 2024
57aa1bc
refactor route exports
ndharmateja Aug 11, 2024
3f49363
add not found and logger mws
ndharmateja Aug 11, 2024
7723cfa
add mws to the app
ndharmateja Aug 11, 2024
918086e
fix bug in authentication mw order
ndharmateja Aug 11, 2024
0fc7e8a
remove log and update error message
ndharmateja Aug 11, 2024
bad0c0e
Merge branch 'main' into feat/288_mock-api
ndharmateja Aug 11, 2024
c603d2d
cleanup config
ndharmateja Aug 11, 2024
556883d
add missing export statement
ndharmateja Aug 11, 2024
06b3262
install node-pre-gyp
ndharmateja Aug 11, 2024
8020d4d
uninstall node-pre-gyp
ndharmateja Aug 11, 2024
14d08fc
uninstall bcrypt
ndharmateja Aug 11, 2024
8c7cd71
change return responses to json
ndharmateja Aug 11, 2024
99fad64
remove unnecessary export
ndharmateja Aug 11, 2024
46384d9
refactor auth jwt controllers
ndharmateja Aug 11, 2024
e6b694c
refactor posts controllers
ndharmateja Aug 11, 2024
b3d2d88
add comments describing the exact route
ndharmateja Aug 12, 2024
55206c1
Updated prettier hook to include all files (except yaml because yaml …
Monstarrrr Aug 12, 2024
6bb3f81
uppercase fix for Bearer
Monstarrrr Aug 12, 2024
ad0d874
Cleanup logs
Monstarrrr Aug 12, 2024
a310392
prettier update with prettierrc local config
Monstarrrr Aug 12, 2024
a859f2b
Merge branch 'feat/288_mock-api' into feat/300_cors
Monstarrrr Aug 13, 2024
a4d6dc9
Enabled cors
Monstarrrr Aug 13, 2024
73fc351
Removed deprecated import
Monstarrrr Aug 13, 2024
57adcc0
Merge pull request #304 from Monstarrrr/feat/300_cors
Monstarrrr Aug 13, 2024
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
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/decision.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
name: Decision
about: To open a discussion and documentation for a key decision about the project's
about:
To open a discussion and documentation for a key decision about the project's
repository.
title: Decide on <TOPIC>
labels: decision
assignees: ''

---

- **Impact**:
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Add a default Issue
title: ''
labels: ''
assignees: ''

---

## Problem
Expand Down
88 changes: 44 additions & 44 deletions .github/workflows/backend_ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Backend CI
on:
on:
push:
branches: ['main']
paths: ['backend/**']
Expand All @@ -11,59 +11,59 @@ jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend
run:
working-directory: ./backend

strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
- '3.10'
- '3.11'
- '3.12'

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt

- name: Write dummy .env
run: |
cp .template-env .env
sed -i 's/^DJANGO_SECRET_KEY=$/DJANGO_SECRET_KEY=abc123/' .env
sed -i 's/^EMAIL_PORT=$/EMAIL_PORT=587/' .env
sed -i 's/^DJANGO_SECURE_HSTS_SECONDS=$/DJANGO_SECURE_HSTS_SECONDS=60/' .env
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt

- name: Run ruff
run: |
ruff check .
- name: Write dummy .env
run: |
cp .template-env .env
sed -i 's/^DJANGO_SECRET_KEY=$/DJANGO_SECRET_KEY=abc123/' .env
sed -i 's/^EMAIL_PORT=$/EMAIL_PORT=587/' .env
sed -i 's/^DJANGO_SECURE_HSTS_SECONDS=$/DJANGO_SECURE_HSTS_SECONDS=60/' .env

- name: Run tests
run: pytest --junit-xml report.xml
- name: Run ruff
run: |
ruff check .

- name: Generate OpenAPI
run: python manage.py spectacular --file schema.yml
- name: Run tests
run: pytest --junit-xml report.xml

- name: Upload OpenAPI Schema
if: ${{ matrix.python-version == '3.11' }}
uses: actions/upload-artifact@v4
with:
name: schema
path: backend/schema.yml
if-no-files-found: error

- name: Upload Backend Test Results
if: ${{ matrix.python-version == '3.11' }}
uses: actions/upload-artifact@v4
with:
name: report
path: backend/report.xml
if-no-files-found: error
- name: Generate OpenAPI
run: python manage.py spectacular --file schema.yml

- name: Upload OpenAPI Schema
if: ${{ matrix.python-version == '3.11' }}
uses: actions/upload-artifact@v4
with:
name: schema
path: backend/schema.yml
if-no-files-found: error

- name: Upload Backend Test Results
if: ${{ matrix.python-version == '3.11' }}
uses: actions/upload-artifact@v4
with:
name: report
path: backend/report.xml
if-no-files-found: error
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# No package should be installed in the root directory
package-lock.json
package.json
./package-lock.json
./package.json

# Python
.venv
Expand Down
16 changes: 15 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,28 @@ repos:
"
stages: [pre-commit]
# Apply to all files in the frontend directory
files: 'frontend/.*'
# files: 'frontend/.*'
args:
[
# ⚠️ If you modify any of these values
# make sure to update the .prettierrc file as well
# to keep the configuration consistent ⚠️
'--use-tabs',
'--tab-width',
'2',
'--single-quote',
'--no-semi',
'--jsx-single-quote',
'--print-width',
'82',
'--arrow-parens',
'always',
'--bracket-spacing',
'true',
'--end-of-line',
'lf',
'--bracket-same-line',
'false',
'--quote-props',
'consistent',
]
4 changes: 2 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Backend is ignored by prettier as we use ruff for formatting & linting the backend code
/backend
# Yaml files are ignored because prettier errors on them are :poop:
*.yaml
15 changes: 15 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
# ⚠️ If you modify any of these values make sure to
# update the prettier hook config in .pre-commit-config.yaml as well
# to keep the configuration consistent ⚠️
useTabs: false
tabWidth: 2
singleQuote: true
semi: false
jsxSingleQuote: true
printWidth: 82
arrowParens: always
bracketSpacing: true
endOfLine: lf
bracketSameLine: false
quoteProps: consistent
7 changes: 7 additions & 0 deletions backend-mock/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.idea/
.vscode/
node_modules/
build/
tmp/
temp/
database-mock.sqlite
7 changes: 7 additions & 0 deletions backend-mock/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Awesome Project Build with TypeORM

Steps to run this project:

1. Run `npm i` command
2. Setup database settings inside `data-source.ts` file
3. Run `npm start` command
Loading