Skip to content

Commit

Permalink
merging develop
Browse files Browse the repository at this point in the history
  • Loading branch information
swoopertr committed Dec 10, 2024
1 parent 73b86fe commit aab2c35
Show file tree
Hide file tree
Showing 64 changed files with 14,387 additions and 594 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
check-latest: true

# Clear npm cache
- name: Clear npm cache
Expand Down Expand Up @@ -87,14 +88,13 @@ jobs:
working-directory: ./frontend
run: npm run build --if-present

# Uncomment the following lines to run tests
# - name: Run tests for backend
# working-directory: ./backend
# run: npm test
- name: Run tests for backend
working-directory: ./backend
run: npm test

- name: Run tests for frontend
working-directory: ./frontend
run: npm test

- name: Run Docker container
run: docker compose up --build -d
run: docker compose up --build -d
4 changes: 2 additions & 2 deletions backend/.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ NODE_ENV=development
DEV_DB_USERNAME=user123
DEV_DB_PASSWORD=password123
DEV_DB_NAME=onboarding_db
DEV_DB_HOST=localhost
DEV_DB_HOST=db
DEV_DB_PORT=5432

EMAIL_ENABLE=false
Expand All @@ -15,6 +15,6 @@ JWT_SECRET="NKrbO2lpCsOpVAlqAPsjZ0tZXzIoKru7gAmYZ7XlHn0=qqwqeq"

TEST_DB_USERNAME=user123
TEST_DB_PASSWORD=password123
TEST_DB_NAME=onboarding_db
TEST_DB_NAME=onboarding_db_test
TEST_DB_HOST=localhost
TEST_DB_PORT=5432
10 changes: 7 additions & 3 deletions backend/.env.test
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# Test Environment Configuration

# Database Configuration
TEST_DB_USERNAME=test_user
TEST_DB_PASSWORD=test_password
TEST_DB_NAME=test_db
TEST_DB_USERNAME=user123
TEST_DB_PASSWORD=password123
TEST_DB_NAME=onboarding_db_test
TEST_DB_HOST=localhost
TEST_DB_PORT=5432

POSTGRES_USER=user123
POSTGRES_PASSWORD=password123
POSTGRES_DB=onboarding_db_test

# JWT Secret Key
JWT_SECRET=your_test_jwt_secret_key_here
1 change: 1 addition & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules/
.env
logs/
dist/
.nyc_output
6 changes: 4 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
FROM node:22
FROM node:22-alpine3.21

RUN apk update && apk add bash && rm -rf /var/cache/apk/*

WORKDIR /app

COPY package*.json ./

RUN npm install
RUN rm -rf package-lock.json && npm install

COPY . .

Expand Down
69 changes: 1 addition & 68 deletions backend/index.js
Original file line number Diff line number Diff line change
@@ -1,71 +1,4 @@
const express = require('express');
const cors = require('cors');
const helmet = require('helmet');
const dotenv = require('dotenv');
const bodyParser = require('body-parser');
const jsonErrorMiddleware = require('./src/middleware/jsonError.middleware');
const fileSizeValidator = require('./src/middleware/fileSizeValidator.middleware');
const { MAX_FILE_SIZE } = require('./src/utils/constants.helper');

// Load environment variables from .env file
dotenv.config();

const authRoutes = require('./src/routes/auth.routes');
const userRoutes = require('./src/routes/user.routes');
const mocks = require('./src/routes/mocks.routes');
const popup = require('./src/routes/popup.routes');
const guide_log = require('./src/routes/guidelog.routes');
const banner = require('./src/routes/banner.routes');
const onboardRoutes = require('./src/routes/onboard.routes');
// const scriptRoutes = require('./src/routes/script.routes');
const teamRoutes = require('./src/routes/team.routes');
const hint = require('./src/routes/hint.routes');
const tourRoutes = require('./src/routes/tour.routes');
const linkRoutes = require('./src/routes/link.routes');
const helperLinkRoutes = require('./src/routes/helperLink.routes');
const guideRoutes = require('./src/routes/guide.routes');

const app = express();

app.use(cors());
app.use(helmet());
app.use(bodyParser.json({ limit: MAX_FILE_SIZE }));
app.use(jsonErrorMiddleware);
// app.use(fileSizeValidator);

const { sequelize } = require("./src/models");

sequelize
.authenticate()
.then(() => console.log('Database connected...'))
.catch((err) => console.log('Error: ' + err));

sequelize
.sync({ force: false })
.then(() => console.log("Models synced with the database..."))
.catch((err) => console.log("Error syncing models: " + err));

app.use('/api/auth', authRoutes);
app.use('/api/users', userRoutes);
app.use('/api/mock/', mocks);
app.use('/api/popup', popup);
app.use('/api/guide_log', guide_log);
app.use('/api/banner', banner);

app.use('/api/onboard', onboardRoutes);
// app.use('/api/scripts', scriptRoutes);
app.use('/api/team', teamRoutes);
app.use('/api/guide', guideRoutes);
app.use('/api/hint', hint);
app.use('/api/tour', tourRoutes);
app.use('/api/link', linkRoutes);
app.use('/api/helper-link', helperLinkRoutes);


app.use((err, req, res, next) => {
console.error(err.stack);
res.status(500).json({ message: 'Internal Server Error' });
});
const app = require("./src/server");

const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
Expand Down
Loading

0 comments on commit aab2c35

Please sign in to comment.