-
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): migrated database from mongodb to postgres
- Loading branch information
Showing
36 changed files
with
221 additions
and
436 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -u | ||
|
||
function create_user_and_database() { | ||
local database=$1 | ||
local username=$2 | ||
local password=$3 | ||
echo " Creating user '$username' and database '$database'" | ||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL | ||
CREATE ROLE $username WITH PASSWORD '$password' NOSUPERUSER LOGIN; | ||
CREATE DATABASE $database; | ||
GRANT ALL PRIVILEGES ON DATABASE $database TO $username; | ||
EOSQL | ||
} | ||
|
||
if [ -n "$COCKPIT_POSTGRES_DB" ]; then | ||
create_user_and_database $COCKPIT_POSTGRES_DB $COCKPIT_POSTGRES_USER $COCKPIT_POSTGRES_PASSWORD | ||
fi | ||
if [ -n "$KEYCLOAK_POSTGRES_DB" ]; then | ||
create_user_and_database $KEYCLOAK_POSTGRES_DB $KEYCLOAK_POSTGRES_USER $KEYCLOAK_POSTGRES_PASSWORD | ||
fi |
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,11 @@ | ||
-- Keycloak table creation | ||
-- Keycloak database Creation | ||
|
||
-- Create access role for keycloak | ||
CREATE ROLE keycloak WITH PASSWORD 'keycloak123' NOSUPERUSER LOGIN; | ||
|
||
-- Create database for keycloak | ||
CREATE DATABASE keycloak; | ||
|
||
-- Grant all permissions to user keycloak | ||
GRANT ALL ON DATABASE keycloak TO keycloak; |
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,18 @@ | ||
module.exports = { | ||
name: 'api-e2e', | ||
testRegex: '.spec.ts$', | ||
transform: { | ||
'^.+\\.(ts|js|html)$': 'jest-preset-angular/preprocessor.js', | ||
}, | ||
moduleFileExtensions: ['js', 'json', 'ts'], | ||
collectCoverage: true, | ||
coverageReporters: ['html'], | ||
testEnvironment: 'node', | ||
coverageDirectory: '../../coverage/apps/api-e2e', | ||
globals: { | ||
'ts-jest': { | ||
tsConfig: "./tsconfig.e2e.json" | ||
} | ||
} | ||
}; | ||
|
5 changes: 4 additions & 1 deletion
5
apps/api/e2e/app.e2e-spec.ts → apps/api-e2e/src/app.e2e-spec.ts
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,10 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc/apps/api-e2e", | ||
"module": "commonjs", | ||
"target": "es6", | ||
"types": ["jest", "node"] | ||
}, | ||
"include": ["**/*.ts"] | ||
} |
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,30 @@ | ||
{ | ||
"defaultSeverity": "error", | ||
"extends": ["tslint:recommended"], | ||
"jsRules": { | ||
"no-unused-expression": true | ||
}, | ||
"rules": { | ||
"eofline": false, | ||
"quotemark": [true, "single"], | ||
"indent": false, | ||
"member-access": [false], | ||
"ordered-imports": [false], | ||
"max-line-length": [true, 150], | ||
"member-ordering": [false], | ||
"curly": false, | ||
"interface-name": [false], | ||
"array-type": [false], | ||
"no-console": false, | ||
"no-empty-interface": false, | ||
"no-empty": false, | ||
"arrow-parens": false, | ||
"object-literal-sort-keys": false, | ||
"no-unused-expression": false, | ||
"max-classes-per-file": [false], | ||
"variable-name": [false], | ||
"one-line": [false], | ||
"one-variable-per-declaration": [false] | ||
}, | ||
"rulesDirectory": [] | ||
} |
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
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,5 +1,5 @@ | ||
module.exports = { | ||
name: 'api', | ||
preset: '../../jest.config.nest.js', | ||
"coverageDirectory": "../../coverage/apps/api", | ||
preset: '../../jest.config.js', | ||
coverageDirectory: '../../coverage/apps/api' | ||
}; |
Oops, something went wrong.