Skip to content

Commit e6753c3

Browse files
committed
Initial commit
0 parents  commit e6753c3

25 files changed

+6495
-0
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
indent_style = space
6+
indent_size = 2
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/*.js
2+
node_modules
3+
dist

.eslintrc.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"env": {
3+
"es6": true,
4+
"node": true,
5+
"jest": true
6+
},
7+
"extends": [
8+
"airbnb-base",
9+
"plugin:@typescript-eslint/recommended",
10+
"prettier/@typescript-eslint",
11+
"plugin:prettier/recommended"
12+
],
13+
"globals": {
14+
"Atomics": "readonly",
15+
"SharedArrayBuffer": "readonly"
16+
},
17+
"parser": "@typescript-eslint/parser",
18+
"parserOptions": {
19+
"ecmaVersion": 2018,
20+
"sourceType": "module"
21+
},
22+
"plugins": [
23+
"@typescript-eslint",
24+
"prettier"
25+
],
26+
"rules": {
27+
"no-underscore-dangle": "off",
28+
"prettier/prettier": "error",
29+
"class-methods-use-this": "off",
30+
"@typescript-eslint/camelcase": "off",
31+
"@typescript-eslint/no-unused-vars": ["error", {
32+
"argsIgnorePattern": "_"
33+
}],
34+
"import/extensions": [
35+
"error",
36+
"ignorePackages",
37+
{
38+
"ts": "never"
39+
}
40+
]
41+
},
42+
"settings": {
43+
"import/resolver": {
44+
"typescript": {}
45+
}
46+
}
47+
}

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.idea/
2+
.vscode/
3+
node_modules/
4+
build/
5+
temp/
6+
7+
tmp/*
8+
!tmp/.gitkeep

jest.config.js

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
module.exports = {
2+
// All imported modules in your tests should be mocked automatically
3+
// automock: false,
4+
5+
// Stop running tests after `n` failures
6+
// bail: 0,
7+
8+
// Respect "browser" field in package.json when resolving modules
9+
// browser: false,
10+
11+
// The directory where Jest should store its cached dependency information
12+
// cacheDirectory: "/private/var/folders/qv/s8ph22xx2fnfxdh3pq14t4d40000gn/T/jest_dx",
13+
14+
// Automatically clear mock calls and instances between every test
15+
clearMocks: true,
16+
17+
// Indicates whether the coverage information should be collected while executing the test
18+
// collectCoverage: false,
19+
20+
// An array of glob patterns indicating a set of files for which coverage information should be collected
21+
// collectCoverageFrom: undefined,
22+
23+
// The directory where Jest should output its coverage files
24+
// coverageDirectory: undefined,
25+
26+
// An array of regexp pattern strings used to skip coverage collection
27+
// coveragePathIgnorePatterns: [
28+
// "/node_modules/"
29+
// ],
30+
31+
// A list of reporter names that Jest uses when writing coverage reports
32+
// coverageReporters: [
33+
// "json",
34+
// "text",
35+
// "lcov",
36+
// "clover"
37+
// ],
38+
39+
// An object that configures minimum threshold enforcement for coverage results
40+
// coverageThreshold: undefined,
41+
42+
// A path to a custom dependency extractor
43+
// dependencyExtractor: undefined,
44+
45+
// Make calling deprecated APIs throw helpful error messages
46+
// errorOnDeprecated: false,
47+
48+
// Force coverage collection from ignored files using an array of glob patterns
49+
// forceCoverageMatch: [],
50+
51+
// A path to a module which exports an async function that is triggered once before all test suites
52+
// globalSetup: undefined,
53+
54+
// A path to a module which exports an async function that is triggered once after all test suites
55+
// globalTeardown: undefined,
56+
57+
// A set of global variables that need to be available in all test environments
58+
// globals: {},
59+
60+
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
61+
// maxWorkers: "50%",
62+
63+
// An array of directory names to be searched recursively up from the requiring module's location
64+
// moduleDirectories: [
65+
// "node_modules"
66+
// ],
67+
68+
// An array of file extensions your modules use
69+
// moduleFileExtensions: [
70+
// "js",
71+
// "json",
72+
// "jsx",
73+
// "ts",
74+
// "tsx",
75+
// "node"
76+
// ],
77+
78+
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
79+
// moduleNameMapper: {},
80+
81+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
82+
// modulePathIgnorePatterns: [],
83+
84+
// Activates notifications for test results
85+
// notify: false,
86+
87+
// An enum that specifies notification mode. Requires { notify: true }
88+
// notifyMode: "failure-change",
89+
90+
// A preset that is used as a base for Jest's configuration
91+
preset: 'ts-jest',
92+
93+
// Run tests from one or more projects
94+
// projects: undefined,
95+
96+
// Use this configuration option to add custom reporters to Jest
97+
// reporters: undefined,
98+
99+
// Automatically reset mock state between every test
100+
// resetMocks: false,
101+
102+
// Reset the module registry before running each individual test
103+
// resetModules: false,
104+
105+
// A path to a custom resolver
106+
// resolver: undefined,
107+
108+
// Automatically restore mock state between every test
109+
// restoreMocks: false,
110+
111+
// The root directory that Jest should scan for tests and modules within
112+
// rootDir: undefined,
113+
114+
// A list of paths to directories that Jest should use to search for files in
115+
// roots: [
116+
// "<rootDir>"
117+
// ],
118+
119+
// Allows you to use a custom runner instead of Jest's default test runner
120+
// runner: "jest-runner",
121+
122+
// The paths to modules that run some code to configure or set up the testing environment before each test
123+
// setupFiles: [],
124+
125+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
126+
// setupFilesAfterEnv: [],
127+
128+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
129+
// snapshotSerializers: [],
130+
131+
// The test environment that will be used for testing
132+
testEnvironment: 'node',
133+
134+
// Options that will be passed to the testEnvironment
135+
// testEnvironmentOptions: {},
136+
137+
// Adds a location field to test results
138+
// testLocationInResults: false,
139+
140+
// The glob patterns Jest uses to detect test files
141+
// testMatch: [
142+
// "**/__tests__/**/*.[jt]s?(x)",
143+
// "**/?(*.)+(spec|test).[tj]s?(x)"
144+
// ],
145+
146+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
147+
// testPathIgnorePatterns: [
148+
// "/node_modules/"
149+
// ],
150+
151+
// The regexp pattern or array of patterns that Jest uses to detect test files
152+
// testRegex: [],
153+
154+
// This option allows the use of a custom results processor
155+
// testResultsProcessor: undefined,
156+
157+
// This option allows use of a custom test runner
158+
// testRunner: "jasmine2",
159+
160+
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
161+
// testURL: "http://localhost",
162+
163+
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
164+
// timers: "real",
165+
166+
// A map from regular expressions to paths to transformers
167+
// transform: undefined,
168+
169+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
170+
// transformIgnorePatterns: [
171+
// "/node_modules/"
172+
// ],
173+
174+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
175+
// unmockedModulePathPatterns: undefined,
176+
177+
// Indicates whether each individual test should be reported during the run
178+
// verbose: undefined,
179+
180+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
181+
// watchPathIgnorePatterns: [],
182+
183+
// Whether to use watchman for file crawling
184+
// watchman: true,
185+
};

ormconfig.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"type": "postgres",
3+
"host": "localhost",
4+
"port": 5432,
5+
"username": "postgres",
6+
"password": "docker",
7+
"database": "gostack_desafio06",
8+
"entities": ["./src/models/*.ts"],
9+
"migrations": ["./src/database/migrations/*.ts"],
10+
"cli": {
11+
"migrationsDir": "./src/database/migrations"
12+
}
13+
}

package.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "desafio-06",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"license": "MIT",
6+
"scripts": {
7+
"build": "tsc",
8+
"dev:server": "ts-node-dev --inspect --transpileOnly --ignore-watch node_modules src/server.ts",
9+
"start": "ts-node src/index.ts",
10+
"typeorm": "ts-node-dev ./node_modules/typeorm/cli.js",
11+
"test": "cross-env NODE_ENV=test jest"
12+
},
13+
"dependencies": {
14+
"@types/csv-parse": "^1.2.2",
15+
"csv-parse": "^4.8.8",
16+
"dotenv": "^8.2.0",
17+
"express": "^4.17.1",
18+
"express-async-errors": "^3.1.1",
19+
"multer": "^1.4.2",
20+
"pg": "^8.3.0",
21+
"reflect-metadata": "^0.1.13",
22+
"typeorm": "^0.2.24"
23+
},
24+
"devDependencies": {
25+
"@types/express": "4.17.3",
26+
"@types/express-serve-static-core": "4.17.2",
27+
"@types/jest": "^25.2.1",
28+
"@types/multer": "^1.4.2",
29+
"@types/supertest": "^2.0.8",
30+
"@typescript-eslint/eslint-plugin": "^2.27.0",
31+
"@typescript-eslint/parser": "^2.27.0",
32+
"cross-env": "^7.0.2",
33+
"eslint": "^6.8.0",
34+
"eslint-config-airbnb-base": "^14.1.0",
35+
"eslint-config-prettier": "^6.10.1",
36+
"eslint-import-resolver-typescript": "^2.0.0",
37+
"eslint-plugin-import": "^2.20.1",
38+
"eslint-plugin-prettier": "^3.1.2",
39+
"jest": "^25.3.0",
40+
"prettier": "^2.0.4",
41+
"supertest": "^4.0.2",
42+
"ts-jest": "^25.3.1",
43+
"ts-node": "3.3.0",
44+
"ts-node-dev": "^1.0.0-pre.44",
45+
"typescript": "^3.8.3"
46+
}
47+
}

prettier.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
singleQuote: true,
3+
trailingComma: "all",
4+
arrowParens: "avoid",
5+
};

0 commit comments

Comments
 (0)