Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ MINIO_CONSOLE_PORT=9001
# pgAdmin (optional)
PGADMIN_DEFAULT_EMAIL=admin@fixpoint.local
PGADMIN_DEFAULT_PASSWORD=admin
PGADMIN_PORT=8080
PGADMIN_PORT=8080

# JWT Configuration
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production-min-32-chars
JWT_EXPIRES_IN=7d
52 changes: 30 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"license": "ISC",
"type": "module",
"dependencies": {
"bcryptjs": "^2.4.3",
"cors": "^2.8.5",
"dotenv": "^17.2.3",
"express": "^5.1.0",
"express-validator": "^7.2.1",
Expand All @@ -36,6 +38,8 @@
},
"overrides": {
"inflight": "npm:@isaacs/inflight@^1.0.6",
"glob": "^10.0.0"
"glob": "10.5.0",
"validator": "13.15.20",
"js-yaml": "3.14.2"
}
}
}
15 changes: 8 additions & 7 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import 'dotenv/config';
import express from 'express';
import http from "http";
import cors from 'cors';
import { initializeDatabase, initializeStorage } from './src/services/connectionService.js';
import healthRoutes from './src/routes/health.js';
import { setupSocket } from './src/socket/socket.js';
import issueRoutes from './src/routes/issues.js';
import userRoutes from './src/routes/users.js';
import messageRoutes from './src/routes/messages.js';
import messageRoutes from './src/routes/messages.js';
import branchRoutes from './src/routes/branch.js';
import thirdPartiesRoutes from './src/routes/thirdparties.js';
import cashRequestRoutes from './src/routes/cashRequestRoutes.js';
import authRoutes from './src/routes/auth.js';

const app = express();
const server = http.createServer(app);
Expand All @@ -22,13 +24,12 @@ setupSocket(server);
app.use(express.json());
app.use(express.urlencoded({ extended: true }));

// Middleware
app.use(express.json()); // Parse JSON request bodies
app.use(express.urlencoded({ extended: true })); // Parse URL-encoded bodies
// Enable CORS
app.use(cors({ origin: '*' }));

// Routes
app.use('/api/health', healthRoutes);

app.use('/api/v1/auth', authRoutes);
app.use('/api/v1/cash-requests', cashRequestRoutes);
app.use('/api/v1/issues', issueRoutes);
app.use('/api/v1/users', userRoutes);
Expand Down Expand Up @@ -60,7 +61,7 @@ async function startServer() {
console.log('Initializing MinIO storage...');
await initializeStorage();

// Start the server
// Start server
server.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
console.log(`Server URL: http://localhost:${PORT}`);
Expand All @@ -76,4 +77,4 @@ async function startServer() {
}

// Start the server
startServer();
startServer();
17 changes: 11 additions & 6 deletions src/database/seeders/20251011000000-demo-users.cjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
'use strict';

const bcrypt = require('bcryptjs');

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
// Hash the password once for all users (they all use the same password)
const hashedPassword = await bcrypt.hash('password123', 10);

await queryInterface.bulkInsert('Users', [
{
name: 'John Technician',
email: 'john.tech@dominoslk.com',
password: 'password123',
password: hashedPassword,
role: 'technician',
phone: '0771234567',
profilePicture: null,
Expand All @@ -18,7 +23,7 @@ module.exports = {
{
name: 'Sarah Technician',
email: 'sarah.tech@dominoslk.com',
password: 'password123',
password: hashedPassword,
role: 'technician',
phone: '0772345678',
profilePicture: null,
Expand All @@ -29,7 +34,7 @@ module.exports = {
{
name: 'Mike Manager',
email: 'mike.manager@dominoslk.com',
password: 'password123',
password: hashedPassword,
role: 'branch_manager',
phone: '0773456789',
profilePicture: null,
Expand All @@ -40,7 +45,7 @@ module.exports = {
{
name: 'Lisa Manager',
email: 'lisa.manager@dominoslk.com',
password: 'password123',
password: hashedPassword,
role: 'branch_manager',
phone: '0774567890',
profilePicture: null,
Expand All @@ -51,7 +56,7 @@ module.exports = {
{
name: 'David Executive',
email: 'david.exec@dominoslk.com',
password: 'password123',
password: hashedPassword,
role: 'maintenance_executive',
phone: '0775678901',
profilePicture: null,
Expand All @@ -62,7 +67,7 @@ module.exports = {
{
name: 'Emma Executive',
email: 'emma.exec@dominoslk.com',
password: 'password123',
password: hashedPassword,
role: 'maintenance_executive',
phone: '0776789012',
profilePicture: null,
Expand Down
Loading