-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial commit with importing file; creating server structure; adding…
… docker-compose.yml
- Loading branch information
0 parents
commit 2cb338d
Showing
33 changed files
with
9,538 additions
and
0 deletions.
There are no files selected for viewing
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,7 @@ | ||
Dockerfile | ||
.dockerignore | ||
|
||
node_modules | ||
npm-debug.log | ||
|
||
dist |
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,10 @@ | ||
HTTP_PORT=3000 | ||
|
||
#DB_HOST=postgres # for running in docker-compose | ||
DB_HOST=localhost | ||
DB_PORT=5432 | ||
DB_USERNAME=curex | ||
DB_PASSWORD=dbpassword | ||
DB_NAME=curex-db | ||
DB_SYNCHRONIZE=true # todo: add more controll on this env var (on prod) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# compiled output | ||
/dist | ||
/node_modules | ||
|
||
# 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 | ||
|
||
.run/* |
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,5 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"printWidth": 120 | ||
} |
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,27 @@ | ||
ARG NODE_VERSION="18.17-alpine" | ||
ARG WORK_DIR="/curex-app" | ||
|
||
FROM node:${NODE_VERSION} as dev | ||
ARG NODE_VERSION | ||
ARG WORK_DIR | ||
WORKDIR ${WORK_DIR} | ||
|
||
COPY package*.json ./ | ||
RUN npm ci | ||
COPY . . | ||
|
||
FROM dev as build | ||
ENV NODE_ENV production | ||
|
||
RUN npm run build | ||
RUN npm ci --only=production && npm cache clean --force | ||
|
||
FROM node:${NODE_VERSION} as prod | ||
ARG WORK_DIR | ||
USER node | ||
|
||
COPY --from=build ${WORK_DIR}/node_modules ./node_modules | ||
COPY --from=build ${WORK_DIR}/dist ./dist | ||
COPY --from=build ${WORK_DIR}/imports ./imports | ||
|
||
CMD [ "node", "./dist/main.js" ] |
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,48 @@ | ||
|
||
## Description | ||
A test tasks for AYA (parser) | ||
|
||
## Installation | ||
|
||
```bash | ||
$ npm install | ||
``` | ||
|
||
## Running the app | ||
|
||
```bash | ||
# import data from /imports/import.txt into Postgres DB | ||
npm run start:import | ||
|
||
# watch mode | ||
$ npm run start:dev | ||
|
||
# production mode | ||
$ npm run start:prod | ||
``` | ||
|
||
## Env vars (.env) | ||
|
||
```bash | ||
HTTP_PORT=3000 | ||
DB_HOST=localhost | ||
DB_PORT=5432 | ||
DB_USERNAME=curex | ||
DB_PASSWORD=dbpassword | ||
DB_NAME=curex-db | ||
DB_SYNCHRONIZE=true | ||
``` | ||
|
||
|
||
## Test | ||
|
||
```bash | ||
# unit tests | ||
$ npm run test | ||
|
||
# e2e tests | ||
$ npm run test:e2e | ||
|
||
# test coverage | ||
$ npm run test:cov | ||
``` |
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,47 @@ | ||
version: "3.8" | ||
|
||
services: | ||
curex-app: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
target: prod | ||
restart: always | ||
# command: npm run start:dev | ||
ports: | ||
- "127.0.0.1:3000:${HTTP_PORT}" | ||
env_file: .env | ||
volumes: | ||
- .:/curex-app | ||
depends_on: | ||
- postgres | ||
networks: | ||
- curex-net | ||
|
||
postgres: | ||
image: postgres:14.1-alpine | ||
restart: always | ||
environment: | ||
- POSTGRES_USER=${DB_USERNAME} | ||
- POSTGRES_PASSWORD=${DB_PASSWORD} | ||
- POSTGRES_DB=${DB_NAME} | ||
ports: | ||
- "${DB_PORT}:5432" | ||
volumes: | ||
- pgData:/var/lib/postgresql/data | ||
networks: | ||
- curex-net | ||
|
||
adminer: | ||
image: adminer | ||
restart: always | ||
ports: | ||
- "8080:8080" | ||
networks: | ||
- curex-net | ||
|
||
networks: | ||
curex-net: | ||
|
||
volumes: | ||
pgData: |
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,47 @@ | ||
exchange-offices | ||
exchange-office | ||
id = 1 | ||
name = Exchanger 1 | ||
country = UKR | ||
exchanges | ||
exchange | ||
from = EUR | ||
to = USD | ||
ask = 110 | ||
date = 2023-04-24 22:55:33 | ||
exchange | ||
from = USD | ||
to = UAH | ||
ask = 400 | ||
date = 2023-04-24 22:55:33 | ||
rates | ||
rate | ||
from = EUR | ||
to = USD | ||
in = 1.1 | ||
out = 1 | ||
reserve = 120000 | ||
date = 2023-04-24 22:55:33 | ||
rate | ||
from = USD | ||
to = UAH | ||
in = 1 | ||
out = 40 | ||
reserve = 150000 | ||
date = 2023-04-24 22:55:33 | ||
exchange-office | ||
id = 2 | ||
name = Exchanger 2 | ||
country = UKR | ||
rates | ||
rate | ||
from = AUD | ||
to = CAD | ||
in = 1 | ||
out = 2 | ||
reserve = 150000 | ||
date = 2023-04-24 22:55:33 | ||
countries | ||
country | ||
code = UKR | ||
name = Ukraine |
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,9 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/nest-cli", | ||
"collection": "@nestjs/schematics", | ||
"sourceRoot": "src", | ||
"compilerOptions": { | ||
"deleteOutDir": true | ||
}, | ||
"assets": ["**/db/file-importer/*.txt"] | ||
} |
Oops, something went wrong.