Skip to content

Commit

Permalink
Merge branch 'develop' into d02ev/issue#332
Browse files Browse the repository at this point in the history
  • Loading branch information
d02ev committed Dec 14, 2024
2 parents 55c9865 + a758ca4 commit 6247039
Show file tree
Hide file tree
Showing 85 changed files with 14,847 additions and 961 deletions.
Binary file modified .DS_Store
Binary file not shown.
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
Binary file added backend/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion backend/.env
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ API_KEY_ENCRYPTION_KEY="\wd?jqf7o5*v;[{/s$9_u3`h+i4r2(^ymt'#|kn-@~!x1ea6pb"

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,12 +1,16 @@
# 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

Expand Down
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
8 changes: 6 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
FROM node:22-alpine3.20
FROM node:22-alpine3.21

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

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
63 changes: 1 addition & 62 deletions backend/index.js
Original file line number Diff line number Diff line change
@@ -1,65 +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 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/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 6247039

Please sign in to comment.