Skip to content

Commit

Permalink
Merge pull request #17 from kevinunger/dev
Browse files Browse the repository at this point in the history
i18n and fixes
  • Loading branch information
kevinunger authored Nov 20, 2023
2 parents f375ecb + 544e44d commit 01839a4
Show file tree
Hide file tree
Showing 43 changed files with 986 additions and 318 deletions.
39 changes: 30 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,47 @@
# GPSportPlaner

## Frontend
Angular

setup:
`npm install`

develop with
`npm run dev` or `npm run hostdev` (to be able to access it from your phone)

## Backend
Express with Typescript and Mongoose

setup:

`npm install`

develop with:

`npm run dev`

#### local mongodb setup
`docker run -d -p 27017:27017 --name gpsmongo -e MONGO_INITDB_ROOT_USERNAME=gpsbackend -e MONGO_INITDB_ROOT_PASSWORD=gpstest mongo:latest`
run tests with:

`npm run test` or `npm run testwatch`


### local mongodb setup
```bash
docker run -d -p 27017:27017 --name gpsmongo -e MONGO_INITDB_ROOT_USERNAME=gpsbackend -e MONGO_INITDB_ROOT_PASSWORD=gpstest mongo:latest
```

send POST to http://localhost:3000/auth/setInitialPw with
```json
{
"role": "user",
"newPassword": "pw"
}
```
to set user pw and set pws for all other roles (admin and master)

to set user pw

and set pws for all other roles (admin and master)

### run
### run mongodb docker

`start gpsmongo`
``
`npm run start:db`


### Deployment to VPS
Expand Down
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"test": "cross-env NODE_ENV=test concurrently \"echo \\$NODE_ENV\" \"jest --detectOpenHandles\"",
"testWatch": "cross-env NODE_ENV=test concurrently \"echo \\$NODE_ENV\" \"jest --clearCache\" \"jest --watchAll\"",
"testwatch": "cross-env NODE_ENV=test concurrently \"echo \\$NODE_ENV\" \"jest --clearCache\" \"jest --watchAll\"",
"build": "npx tsc",
"start": "node dist/backend/src/index.js",
"dev": "cross-env NODE_ENV=development concurrently \"npx tsc --watch\" \"nodemon -q dist/backend/src/index.js\"",
Expand Down
6 changes: 4 additions & 2 deletions backend/src/db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export default async function connectMongo() {
.connect(MONGO_CONNECTION_STRING)
.then(() => {
const db_name = mongoose.connection.name;
console.log(`connected to mongo db: ${db_name}`);
console.log(
`connected to mongo db: ${db_name} with connection string: ${MONGO_CONNECTION_STRING}`
);
})
.catch((err: any) => {
console.error(err);
Expand All @@ -44,7 +46,7 @@ const mongod = new MongoMemoryServer();

// connect to test db
export async function connectMongoTest() {
await mongod.start(); // Add this line to start the MongoMemoryServer
await mongod.start();
const uri = await mongod.getUri();
const mongoOpts = {
useNewUrlParser: true,
Expand Down
1 change: 1 addition & 0 deletions backend/src/tests/bookings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const admin_password_hashed = bcrypt.hashSync('admin_password', 10);
const master_password_hashed = bcrypt.hashSync('master_password', 10);

beforeAll(async () => {
console.log('env: ', process.env.NODE_ENV);
await connectMongoTest();
await createUsers();
// Set up users with their passwords
Expand Down
4 changes: 2 additions & 2 deletions frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
"maximumError": "40kb"
}
],
"fileReplacements": [
Expand Down
Loading

0 comments on commit 01839a4

Please sign in to comment.