Skip to content

Commit

Permalink
Postgresql (#11)
Browse files Browse the repository at this point in the history
* typeorm, postgresql

* auth with email and password logic

* cryptService, eslint, exceptions

* refactoring

* workflow
  • Loading branch information
vmozharov authored Nov 2, 2023
1 parent 3c77d69 commit 6edf471
Show file tree
Hide file tree
Showing 99 changed files with 2,526 additions and 2,558 deletions.
39 changes: 37 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ JWT_SECRET_TOKEN=
# Description: JWT access token expiration time
# Type: string
# Example: "2d", "10h", "60s"
# Default: 15d
JWT_ACCESS_TOKEN_EXPIRES_IN=15d
# Default: 1h
JWT_ACCESS_TOKEN_EXPIRES_IN=1h

# Description: JWT refresh secret token
# Type: string
Expand All @@ -70,3 +70,38 @@ GRAPHQL_AUTO_SCHEMA_BUILD=false
# Min: 1
# Default: 100
GRAPHQL_COMPLEXITY_LIMIT=100

# Description: PostgreSQL username
# Type: string
# Required: true
POSTGRES_USERNAME=

# Description: PostgreSQL password
# Type: string
# Required: true
POSTGRES_PASSWORD=

# Description: PostgreSQL host
# Type: string
# Required: true
POSTGRES_HOST=

# Description: PostgreSQL port
# Type: number
# Required: true
POSTGRES_PORT=5432

# Description: PostgreSQL database name
# Type: string
# Required: true
POSTGRES_DATABASE=

# Description: PostgreSQL synchronize. Not for production!
# Type: boolean
# Default: false
POSTGRES_SYNCHRONIZE=false

# Description: PostgreSQL migrations run. Not for production!
# Type: boolean
# Default: false
POSTGRES_MIGRATIONS_RUN=false
11 changes: 9 additions & 2 deletions .env.test
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
NODE_ENV=test
JWT_SECRET_TOKEN=VrdWi58a8taiugDqLyefgSC7UkTx32sV9B8JRsv7mf7xtqDGYvyGJQv9Msr6yt9J6CEhCoY4zi8kiSF5xwZybnxUR4NRAHwg6yb3u5vPpSupVPCX4YXBzxBhYf8VFDWL
JWT_ACCESS_TOKEN_EXPIRES_IN=60s
JWT_ACCESS_TOKEN_EXPIRES_IN=10s
JWT_REFRESH_SECRET_TOKEN=fzeDYxqAwapb3GPWPn2hsPBKrDHDyQsKuGcLdikFhznnY6efbxpYSyWD6BxqTkSVpQTDH5XgD4q4qahUxDNaiFZsV4j2Vyy9HmPFNMBDJURxv5rvTTaw2zcTvQWtenz4
JWT_REFRESH_TOKEN_EXPIRES_IN=1d
JWT_REFRESH_TOKEN_EXPIRES_IN=20s
GRAPHQL_AUTO_SCHEMA_BUILD=true
GRAPHQL_COMPLEXITY_LIMIT=20
POSTGRES_USERNAME=waisy
POSTGRES_PASSWORD=1234
POSTGRES_DATABASE=waisy
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_SYNCHRONIZE=true
POSTGRES_MIGRATIONS_RUN=false
10 changes: 8 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ module.exports = {
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-function-return-type': [
'warn',
{
allowExpressions: true,
allowHigherOrderFunctions: true,
allowConciseArrowFunctionExpressionsStartingWithVoid: true,
},
],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': ['warn'],
Expand Down
25 changes: 21 additions & 4 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Node.js CI

on:
push:
on: push

env:
NODE_ENV: test
Expand All @@ -13,12 +12,27 @@ jobs:
strategy:
matrix:
node-version: [18.18]
postgres-version: [16.0]

services:
postgres:
image: postgres:${{ matrix.postgres-version }}
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: 1234
POSTGRES_USER: waisy
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
Expand All @@ -32,6 +46,9 @@ jobs:
- name: Check for linting
run: npm run lint:check

- name: GraphQL generate schema
run: npm run graphql:generate-schema

- name: Run tests
run: npm test

Expand Down
Loading

0 comments on commit 6edf471

Please sign in to comment.