Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 04db3f7

Browse filesBrowse files
committed
Merge branch 'molleer-relative-path' into production
2 parents 120a577 + 8acaa13 commit 04db3f7
Copy full SHA for 04db3f7

File tree

131 files changed

+579
-385
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner

131 files changed

+579
-385
lines changed

‎.eslintignore

Copy file name to clipboardExpand all lines: .eslintignore
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ node_modules
22
build
33

44
jest.config.js
5+
jest.dev.config.js
56
jest.build.config.js

‎.eslintrc.js

Copy file name to clipboard
+48-51Lines changed: 48 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,51 @@
11
module.exports = {
2-
env: {
3-
browser: true,
4-
es2021: true,
5-
jest: true,
6-
},
7-
extends: [
8-
'airbnb-base',
9-
],
10-
parser: '@typescript-eslint/parser',
11-
parserOptions: {
12-
ecmaVersion: 12,
13-
},
14-
plugins: [
15-
'@typescript-eslint',
16-
],
2+
env: {
3+
browser: true,
4+
es2021: true,
5+
jest: true,
6+
},
7+
extends: ["airbnb-base"],
8+
parser: "@typescript-eslint/parser",
9+
parserOptions: {
10+
ecmaVersion: 12,
11+
},
12+
plugins: ["@typescript-eslint"],
1713

18-
rules: {
19-
'class-methods-use-this': ['off'],
20-
'import/extensions': [
21-
'error',
22-
'ignorePackages',
23-
{
24-
js: 'never',
25-
jsx: 'never',
26-
ts: 'never',
27-
tsx: 'never',
28-
},
29-
],
30-
'import/no-extraneous-dependencies': [
31-
'error',
32-
{ devDependencies: true },
33-
],
34-
'import/order': ['error', {
35-
groups: [
36-
['external', 'builtin'],
37-
['internal', 'index', 'sibling', 'parent'],
38-
],
39-
'newlines-between': 'always',
40-
}],
41-
'no-shadow': 'off',
42-
'@typescript-eslint/no-shadow': 'error',
43-
'no-unused-vars': 'off',
44-
'@typescript-eslint/no-unused-vars': 'error',
45-
},
46-
settings: {
47-
'import/resolver': {
48-
node: {
49-
extensions: ['.js', '.jsx', '.ts', '.tsx'],
50-
moduleDirectory: ['node_modules', 'src/'],
51-
},
52-
},
53-
},
14+
rules: {
15+
"class-methods-use-this": ["off"],
16+
"import/extensions": [
17+
"error",
18+
"ignorePackages",
19+
{
20+
js: "never",
21+
jsx: "never",
22+
ts: "never",
23+
tsx: "never",
24+
},
25+
],
26+
"import/no-extraneous-dependencies": ["error", { devDependencies: true }],
27+
"import/order": [
28+
"error",
29+
{
30+
groups: [
31+
["external", "builtin"],
32+
["internal", "index", "sibling", "parent"],
33+
],
34+
"newlines-between": "always",
35+
},
36+
],
37+
"no-shadow": "off",
38+
"@typescript-eslint/no-shadow": "error",
39+
"no-unused-vars": "off",
40+
"@typescript-eslint/no-unused-vars": "error",
41+
},
42+
settings: {
43+
"import/resolver": {
44+
node: {
45+
extensions: [".js", ".jsx", ".ts", ".tsx"],
46+
moduleDirectory: ["node_modules", "src/"],
47+
paths: [""],
48+
},
49+
},
50+
},
5451
};

‎.travis.yml

Copy file name to clipboardExpand all lines: .travis.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ install:
1414
- yarn db migration:run
1515
- yarn db:seeding seed
1616
script:
17-
- yarn test --roots build/tests
1817
- yarn test
18+
- yarn prod:test
1919
- yarn eslint
2020
- yarn ejslint
2121
notifications:

‎README.md

Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ mutation {
3939
Before to send a PR please do it:
4040
- Run `yarn test` to run the test in dev environment.
4141
- Run `yarn build` to ensure build is working.
42-
- Run `yarn test --roots build/tests` to run the test in with the js files.
42+
- Run `yarn prod:test` to run the test in with the js files.
4343
- Run `yarn eslint --fix` to validate the code style.
4444
- Run `yarn ejslint --fix` to validate the ejs files.
4545

‎dev.Dockerfile

Copy file name to clipboard
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM node:lts
2+
WORKDIR /usr
3+
COPY package.json yarn.lock ./
4+
RUN yarn
5+
COPY . .
6+
ENTRYPOINT [ "yarn", "start" ]

‎docker-compose.yml

Copy file name to clipboard
+52Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
version: "3"
2+
networks:
3+
backend:
4+
5+
services:
6+
#backend:
7+
# build:
8+
# context: ./
9+
# dockerfile: dev.Dockerfile
10+
# environment:
11+
# PORT: 5000
12+
# NODE_ENV: development
13+
#
14+
# APP_URL: http://localhost:4000/
15+
# FRONTEND_URL: http://localhost:3000
16+
# CORS_ORIGIN: http://localhost:3000,http://192.168.1.8:3000,https://codesandbox.io
17+
#
18+
# # db configuration
19+
# DB_USER: albert
20+
# DB_PASSWORD: 1234
21+
# DB_HOST: db
22+
# DB_PORT: 5432
23+
# DB_NAME: node
24+
#
25+
# # mail configuration
26+
# MAIL_HOST: localhost
27+
# MAIL_PORT: 1025
28+
# MAIL_USERNAME: project.1
29+
# MAIL_PASSWORD: secret.1
30+
# MAIL_FROM_ADDRESS: me@albertcito.com
31+
# MAIL_FROM_NAME: "Albert Tjornehoj"
32+
# UNIVERSAL_TO: me@albertcito.com
33+
#
34+
# # Report Error
35+
# BUGSNAG_API_KEY: 3e34070a24af2d643b1ea24d1218d4b9
36+
# depends_on:
37+
# - db
38+
# networks:
39+
# - backend
40+
# volumes:
41+
# - ./:/usr
42+
# ports:
43+
# - 5000:5000
44+
45+
db:
46+
image: postgres
47+
environment:
48+
POSTGRES_USER: albert
49+
POSTGRES_DB: node
50+
POSTGRES_PASSWORD: 1234
51+
ports:
52+
- 5432:5432

‎jest.dev.config.js

Copy file name to clipboard
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// For a detailed explanation regarding each configuration property, visit:
2+
// https://jestjs.io/docs/en/configuration.html
3+
4+
const { pathsToModuleNameMapper } = require('ts-jest/utils');
5+
const { compilerOptions } = require('./tsconfig');
6+
const jestConfig = require('./jest.config');
7+
8+
module.exports = {
9+
...jestConfig,
10+
moduleNameMapper: pathsToModuleNameMapper(
11+
compilerOptions.paths ,
12+
{ prefix: '<rootDir>/src' },
13+
),
14+
};

‎package.json

Copy file name to clipboardExpand all lines: package.json
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"build": "rm -rf build/ && tsc && cp -R src/resources build/resources",
8-
"start": "ts-node src/index.ts",
9-
"dev": "nodemon --exec ts-node src/index.ts",
7+
"build": "rm -rf build/ && tsc && tscpaths -p tsconfig.json -s ./src -o ./build && cp -R src/resources build/resources",
8+
"dev": "nodemon --exec ts-node -r tsconfig-paths/register src/index.ts",
9+
"test": "jest --config ./jest.dev.config.js --roots src/tests",
1010
"eslint": "eslint --ext=jsx,ts,tsx 'src/**/*.{ts,tsx}'",
11-
"test": "jest --config ./jest.config.js",
1211
"ejslint": "ejslint src/resources/view/*",
1312
"typeorm": "ts-node ./node_modules/typeorm/cli.js --config src/init/db/connectionOptions.ts",
1413
"seeding": "ts-node ./node_modules/typeorm-seeding/dist/cli.js --configName src/init/db/connectionOptions.ts",
14+
"prod:test": "jest --config ./jest.config.js --roots build/tests",
1515
"db": "node ./node_modules/typeorm/cli.js --config build/init/db/connectionOptions.js",
1616
"db:seeding": "node ./node_modules/typeorm-seeding/dist/cli.js --configName build/init/db/connectionOptions.js"
1717
},
@@ -41,6 +41,8 @@
4141
"jest": "^26.4.2",
4242
"supertest": "6.0.1",
4343
"ts-jest": "^26.4.1",
44+
"tsconfig-paths": "^3.9.0",
45+
"tscpaths": "^0.0.9",
4446
"typescript": "^4.0.3"
4547
},
4648
"dependencies": {

‎src/controllers/langs/LangController.ts

Copy file name to clipboardExpand all lines: src/controllers/langs/LangController.ts
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import {
33
Controller, Param, Get, Authorized,
44
} from 'routing-controllers';
55

6-
import Lang from '../../db/entities/Lang';
7-
import Paginate from '../../util/db/paginate';
8-
import MessageError from '../../util/exceptions/MessageError';
9-
import roles from '../../logic/role/role.enum';
6+
import Lang from 'src/db/entities/Lang';
7+
import Paginate from 'src/util/db/paginate';
8+
import MessageError from 'src/util/exceptions/MessageError';
9+
import roles from 'src/logic/role/role.enum';
1010

1111
@Controller()
1212
export default class LangController {

‎src/db/entities/BaseEntity.ts

Copy file name to clipboardExpand all lines: src/db/entities/BaseEntity.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
CreateDateColumn, BeforeInsert, BeforeUpdate, BaseEntity,
66
} from 'typeorm';
77

8-
import Auth from '../../util/session/Auth';
8+
import Auth from 'src/util/session/Auth';
99

1010
@ObjectType()
1111
class BaseDataEntity extends BaseEntity {

‎src/db/entities/Role.ts

Copy file name to clipboardExpand all lines: src/db/entities/Role.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import {
55
Entity, PrimaryColumn, Column, getManager,
66
} from 'typeorm';
77

8+
import roles from 'src/logic/role/role.enum';
89
import BaseEntity from './BaseEntity';
910
import VText from './VText';
10-
import roles from '../../logic/role/role.enum';
1111

1212
@ObjectType()
1313
@Entity({ name: 'role' })

‎src/db/entities/UserStatus.ts

Copy file name to clipboardExpand all lines: src/db/entities/UserStatus.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import {
55
Entity, PrimaryColumn, Column, getManager,
66
} from 'typeorm';
77

8+
import userStatus from 'src/logic/userStatus/userStatus.enum';
89
import BaseEntity from './BaseEntity';
910
import VText from './VText';
10-
import userStatus from '../../logic/userStatus/userStatus.enum';
1111

1212
@ObjectType()
1313
@Entity({ name: 'user_status' })

‎src/db/entities/UserStatusReason.ts

Copy file name to clipboardExpand all lines: src/db/entities/UserStatusReason.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Field, ObjectType, Int } from 'type-graphql';
22
import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';
33

4+
import userStatus from 'src/logic/userStatus/userStatus.enum';
45
import BaseEntity from './BaseEntity';
5-
import userStatus from '../../logic/userStatus/userStatus.enum';
66

77
@ObjectType()
88
@Entity({ name: 'user_status_reason' })

‎src/db/factories/user.factory.ts

Copy file name to clipboardExpand all lines: src/db/factories/user.factory.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as faker from 'faker';
22
import { define } from 'typeorm-seeding';
33

4+
import userStatus from 'src/logic/userStatus/userStatus.enum';
45
import User from '../entities/User';
5-
import userStatus from '../../logic/userStatus/userStatus.enum';
66

77
const getFakerUser = (password: string = '123456') => {
88
const email = `faker@${faker.random.uuid()}.com`;

‎src/db/migrations/1601324674382-UserStatus.ts

Copy file name to clipboardExpand all lines: src/db/migrations/1601324674382-UserStatus.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import {
22
MigrationInterface, QueryRunner, Table, TableForeignKey,
33
} from 'typeorm';
44

5+
import userStatus from 'src/logic/userStatus/userStatus.enum';
56
import columns from './BaseTableColumns/columns';
67
import UserStatus from '../entities/UserStatus';
7-
import userStatus from '../../logic/userStatus/userStatus.enum';
88
import saveTranslation from '../util/saveTranslation';
99

1010
export default class UserStatus1601324674982 implements MigrationInterface {

‎src/db/migrations/1601324674982-User.ts

Copy file name to clipboardExpand all lines: src/db/migrations/1601324674982-User.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import {
22
MigrationInterface, QueryRunner, Table, TableForeignKey,
33
} from 'typeorm';
44

5+
import userStatus from 'src/logic/userStatus/userStatus.enum';
56
import columns from './BaseTableColumns/columns';
67
import User from '../entities/User';
78
import dbUsers from '../util/dbUser';
8-
import userStatus from '../../logic/userStatus/userStatus.enum';
99

1010
class User1601324674982 implements MigrationInterface {
1111
private readonly tableName = 'user';

‎src/db/migrations/1601324674992-Role.ts

Copy file name to clipboardExpand all lines: src/db/migrations/1601324674992-Role.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import {
22
MigrationInterface, QueryRunner, Table, TableForeignKey,
33
} from 'typeorm';
44

5+
import roles from 'src/logic/role/role.enum';
56
import columns from './BaseTableColumns/columns';
67
import Role from '../entities/Role';
7-
import roles from '../../logic/role/role.enum';
88
import saveTranslation from '../util/saveTranslation';
99

1010
export default class Role1601324674992 implements MigrationInterface {

‎src/db/migrations/1601324675000-UserRole.ts

Copy file name to clipboardExpand all lines: src/db/migrations/1601324675000-UserRole.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import {
22
MigrationInterface, QueryRunner, Table, TableForeignKey, TableUnique,
33
} from 'typeorm';
44

5+
import roles from 'src/logic/role/role.enum';
56
import columns from './BaseTableColumns/columns';
6-
import roles from '../../logic/role/role.enum';
77
import UserRole from '../entities/UserRole';
88

99
export default class UserRole1601324675000 implements MigrationInterface {

‎src/db/seeds/translation.seed.ts

Copy file name to clipboardExpand all lines: src/db/seeds/translation.seed.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { getConnection } from 'typeorm';
22
import { Seeder } from 'typeorm-seeding';
33
import * as faker from 'faker';
44

5-
import TranslationCreate from '../../logic/translation/TranslationCreate';
5+
import TranslationCreate from 'src/logic/translation/TranslationCreate';
66

77
const createTranslation = async () => {
88
const translationCreate = new TranslationCreate([{

‎src/db/seeds/userStatusReasons.seed.ts

Copy file name to clipboardExpand all lines: src/db/seeds/userStatusReasons.seed.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as faker from 'faker';
22
import { Factory, Seeder } from 'typeorm-seeding';
33

4+
import userStatusEnum from 'src/logic/userStatus/userStatus.enum';
45
import User from '../entities/User';
5-
import userStatusEnum from '../../logic/userStatus/userStatus.enum';
66
import UserStatusReason from '../entities/UserStatusReason';
77

88
const createUserStatusReasons = async (userID: number, userStatusID: userStatusEnum) => {

‎src/graphql/resolvers/lang/create.ts

Copy file name to clipboardExpand all lines: src/graphql/resolvers/lang/create.ts
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import {
55
} from 'type-graphql';
66
import { getManager } from 'typeorm';
77

8-
import MessageResponse from '../../type/MessageResponse';
9-
import MessageType from '../../type/MessageType.enum';
10-
import Lang from '../../../db/entities/Lang';
11-
import isAuth from '../../../util/graphql/isAuth';
12-
import Validate from '../../../util/validatorjs/validateGraphQL';
8+
import MessageResponse from 'src/graphql/type/MessageResponse';
9+
import MessageType from 'src/graphql/type/MessageType.enum';
10+
import Lang from 'src/db/entities/Lang';
11+
import isAuth from 'src/util/graphql/isAuth';
12+
import Validate from 'src/util/validatorjs/validateGraphQL';
1313

1414
@ObjectType()
1515
class LangCreateResponse extends MessageResponse(Lang) {}

‎src/graphql/resolvers/lang/delete.ts

Copy file name to clipboardExpand all lines: src/graphql/resolvers/lang/delete.ts
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import {
33
Resolver, Mutation, Arg, UseMiddleware,
44
} from 'type-graphql';
55

6-
import Lang from '../../../db/entities/Lang';
7-
import MessageError from '../../../util/exceptions/MessageError';
8-
import isAuth from '../../../util/graphql/isAuth';
9-
import Validate from '../../../util/validatorjs/validateGraphQL';
6+
import Lang from 'src/db/entities/Lang';
7+
import MessageError from 'src/util/exceptions/MessageError';
8+
import isAuth from 'src/util/graphql/isAuth';
9+
import Validate from 'src/util/validatorjs/validateGraphQL';
1010

1111
@Resolver()
1212
class LangDeleteResolver {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.