-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate project to NestJS. (#149)
* feat: migrate project to NestJS. * feat: update github-actions - lint project - update tests - update github-actions * fix: fix scripts * fix: update script permissions * fix: make scripts executable * chore: add docs and test permissions * feat: add tests for location search * feat: add Dockerfile * feat: add e2e tests * fix: fix tests * fix: fix scripts and Dockerfile Signed-off-by: 35C4n0r <jaykumar20march@gmail.com> * fix: fix city.service.spec.ts test. Signed-off-by: 35C4n0r <jaykumar20march@gmail.com> --------- Signed-off-by: 35C4n0r <jaykumar20march@gmail.com>
- Loading branch information
Showing
69 changed files
with
24,447 additions
and
1,578 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
tsconfigRootDir: __dirname, | ||
sourceType: 'module', | ||
}, | ||
plugins: ['@typescript-eslint/eslint-plugin'], | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
root: true, | ||
env: { | ||
node: true, | ||
jest: true, | ||
}, | ||
ignorePatterns: ['.eslintrc.js'], | ||
rules: { | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
# name: Download and Commit File | ||
|
||
# on: | ||
# schedule: | ||
# - cron: '0 12 * * 0' # This will run the action daily at midnight | ||
# workflow_dispatch: # This allows manual triggering | ||
|
||
# jobs: | ||
# download-and-commit: | ||
# runs-on: ubuntu-latest | ||
|
||
# permissions: | ||
# # Give the default GITHUB_TOKEN write permission to commit and push the | ||
# # added or changed files to the repository. | ||
# contents: write | ||
|
||
# steps: | ||
# - name: Checkout Repository | ||
# uses: actions/checkout@v2 | ||
# - name: Download File | ||
# run: | | ||
# sudo apt install wget2 -y | ||
# wget2 -O server/db.mmdb https://mmdbcdn.posthog.net | ||
|
||
# - name: Commit and Push | ||
# uses: stefanzweifel/git-auto-commit-action@v5 | ||
# with: | ||
# commit_message: Update db.mmdb | ||
#name: Download and Commit File | ||
# | ||
#on: | ||
# schedule: | ||
# - cron: '0 12 * * 0' # This will run the action daily at midnight | ||
# workflow_dispatch: # This allows manual triggering | ||
# | ||
#jobs: | ||
# download-and-commit: | ||
# runs-on: ubuntu-latest | ||
# | ||
# permissions: | ||
# # Give the default GITHUB_TOKEN write permission to commit and push the | ||
# # added or changed files to the repository. | ||
# contents: write | ||
# | ||
# steps: | ||
# - name: Checkout Repository | ||
# uses: actions/checkout@v2 | ||
# | ||
# - name: Download File | ||
# run: | | ||
# sudo apt install wget2 -y | ||
# wget2 -O server/db.mmdb https://mmdbcdn.posthog.net | ||
# | ||
# - name: Commit and Push | ||
# uses: stefanzweifel/git-auto-commit-action@v5 | ||
# with: | ||
# commit_message: Update db.mmdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,51 @@ | ||
node_modules | ||
# compiled output | ||
/dist | ||
/node_modules | ||
|
||
src/config/env | ||
src/geojson-data/indian_village_boundaries | ||
src/geojson-data/*json | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
pnpm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# OS | ||
.DS_Store | ||
|
||
# Tests | ||
/coverage | ||
/.nyc_output | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
|
||
.idea | ||
.DS_store | ||
server/.DS_Store | ||
/server/geojson-data/indian_village_boundaries | ||
/server/geojson-data/*json | ||
/server/parsed_geojson | ||
/server/scripts/combined.log | ||
/server/scripts/error.log | ||
/server/combined.log | ||
src/.DS_Store | ||
/src/parsed_geojson | ||
/src/scripts/combined.log | ||
/src/scripts/error.log | ||
/src/combined.log | ||
/src/geojson-data/ | ||
/src/geoquery.in.data/ | ||
db.mmdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#FROM node:18.16.1-alpine | ||
# | ||
#COPY setup.sh | ||
# | ||
#RUN apk add --no-cache bash | ||
#RUN npm i -g @nestjs/cli typescript ts-node | ||
# | ||
#COPY package*.json /tmp/app/ | ||
#RUN cd /tmp/app && npm install | ||
# | ||
#COPY . /usr/src/app | ||
#RUN cp -a /tmp/app/node_modules /usr/src/app | ||
#COPY ./wait-for-it.sh /opt/wait-for-it.sh | ||
#COPY ./startup.dev.sh /opt/startup.dev.sh | ||
#RUN sed -i 's/ | ||
#//g' /opt/wait-for-it.sh | ||
#RUN sed -i 's/ | ||
#//g' /opt/startup.dev.sh | ||
# | ||
#WORKDIR /usr/src/app | ||
#RUN cp env-example .env | ||
#RUN npx prisma generate | ||
#RUN npm run build | ||
# | ||
#CMD ["/opt/startup.dev.sh"] | ||
# | ||
#EXPOSE 3000 | ||
|
||
|
||
#FROM node:18.16.1-alpine | ||
# | ||
#WORKDIR /usr/src/app | ||
# | ||
#COPY . . | ||
# | ||
#RUN apt-get update && apt-get install -y curl && apt-get install -y git | ||
#CMD /bin/bash | ||
#COPY ./package*.json ./ | ||
#RUN ./setup.sh | ||
# | ||
#ENV NODE_ENV production | ||
#CMD ["npm", "i"] | ||
#CMD [ "npm", "run", "start:dev" ] | ||
# | ||
#EXPOSE 3000 | ||
|
||
|
||
FROM node:20.11.0-alpine | ||
|
||
# Set the working directory | ||
WORKDIR /usr/src/app | ||
|
||
# Install curl and git using apk | ||
RUN apk update && apk add --no-cache curl git | ||
|
||
RUN #npm config set registry http://registry.npmjs.org/ | ||
|
||
# Copy package files first for better caching of npm install | ||
COPY ./package*.json ./ | ||
|
||
# Install dependencies | ||
RUN npm install | ||
|
||
# Copy the rest of the application code | ||
COPY . . | ||
|
||
# Run any additional setup script | ||
RUN chmod +x ./setup.sh | ||
RUN ./setup.sh | ||
|
||
# Set environment variable | ||
ENV NODE_ENV production | ||
|
||
# Expose the application port | ||
EXPOSE 3000 | ||
|
||
# Start the application | ||
CMD ["npm", "run", "start:dev"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM node:18.16.1-alpine | ||
|
||
RUN apk add --no-cache bash | ||
RUN npm i -g @nestjs/cli typescript ts-node | ||
|
||
COPY package*.json /tmp/app/ | ||
RUN cd /tmp/app && npm install | ||
|
||
COPY . /usr/src/app | ||
RUN cp -a /tmp/app/node_modules /usr/src/app | ||
COPY ./wait-for-it.sh /opt/wait-for-it.sh | ||
COPY ./startup.dev.sh /opt/startup.dev.sh | ||
RUN sed -i 's/\r//g' /opt/wait-for-it.sh | ||
RUN sed -i 's/\r//g' /opt/startup.dev.sh | ||
|
||
WORKDIR /usr/src/app | ||
RUN cp env-example.devcontainer .env | ||
RUN npx prisma generate | ||
RUN npm run build | ||
|
||
CMD ["/opt/startup.dev.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
services: | ||
postgres: | ||
image: postgres:15.3-alpine | ||
expose: | ||
- 5432:5432 | ||
environment: | ||
POSTGRES_USER: ${DATABASE_USERNAME} | ||
POSTGRES_PASSWORD: ${DATABASE_PASSWORD} | ||
POSTGRES_DB: ${DATABASE_NAME} | ||
|
||
shadow-postgres: | ||
image: postgres:15.3-alpine | ||
expose: | ||
- 5431:5432 | ||
environment: | ||
POSTGRES_USER: ${SHADOW_DATABASE_USERNAME} | ||
POSTGRES_PASSWORD: ${SHADOW_DATABASE_PASSWORD} | ||
POSTGRES_DB: ${SHADOW_DATABASE_NAME} | ||
|
||
api: | ||
build: | ||
context: . | ||
dockerfile: e2e.Dockerfile |
Oops, something went wrong.