Skip to content

Commit 31c3862

Browse files
Time Booking Project Complete
2 parents d17e7b6 + ddb3b55 commit 31c3862

283 files changed

Lines changed: 29423 additions & 13979 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@ MAILHOG_SMTP_PORT=1025
2424
MAILHOG_UI_PORT=8025
2525

2626
# Database Connection String for Prisma
27-
DATABASE_URL="postgresql://postgres:password@localhost:5432/time_booking?schema=public"
27+
DATABASE_URL="postgresql://postgres:password@db:5432/lab_booking?schema=public"
28+
29+
REFRESH_TOKEN_SECRET=yourRealSecretValueHere

.github/OneDrive - Personal.lnk

748 Bytes
Binary file not shown.

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"files.autoSave": "onFocusChange",
2+
"files.autoSave": "afterDelay",
33
"workbench.colorTheme": "Visual Studio Dark",
44
"code-runner.runInTerminal": true,
55

backend-tree.txt

2.43 KB
Binary file not shown.

backend/.env

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
DATABASE_URL="postgresql://postgres:password@localhost:5432/time_booking?schema=public"
1+
DATABASE_URL=postgresql://postgres:password@localhost:5432/lab_booking
2+
JWT_SECRET=dev_jwt_secret
3+
REFRESH_TOKEN_SECRET=dev_refresh_secret
4+
REDIS_URL=redis://localhost:6379
5+
NODE_ENV=development
6+
CORS_ORIGIN=http://localhost:3000,http://localhost:4000
7+
EMAIL_USER=tiwaripratyush2005@gmail.com
8+
EMAIL_PASS=rocfyqtvrcnzjrnh
9+
FRONTEND_URL=http://localhost:3000
10+

backend/.env.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
DATABASE_URL=postgresql://postgres:password@localhost:5432/lab_booking_test
2+
JWT_SECRET=test_jwt_secret
3+
REFRESH_TOKEN_SECRET=test_refresh_secret
4+
REDIS_URL=redis://localhost:6379
5+
NODE_ENV=test
6+
CORS_ORIGIN=http://localhost:3000,http://localhost:4000
7+

backend/Dockerfile.dev

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
11
# filepath: /workspaces/Time-Booking-Application/backend/Dockerfile.dev
2+
23
FROM node:20-alpine AS builder
34

45
WORKDIR /app
56

6-
# Install dependencies first (taking advantage of Docker caching)
7+
# ✅ Install Python and build tools needed for bcrypt (Alpine-compatible)
8+
RUN apk add --no-cache \
9+
python3 \
10+
py3-pip \
11+
make \
12+
g++
13+
14+
# Install dependencies first
715
COPY package.json ./
816
COPY tsconfig.json ./
917
COPY prisma ./prisma/
1018
COPY .env* ./
1119
RUN npm install
1220

13-
# Copy Prisma schema to generate client
21+
# Generate Prisma client
1422
COPY prisma ./prisma/
15-
COPY .env* ./
1623
RUN npx prisma generate
1724

1825
# Copy the rest of the application
1926
COPY . .
2027

21-
# Expose port for the application
2228
EXPOSE 4000
2329

24-
# Run development server with hot reload
25-
CMD ["npm", "run", "dev"]
30+
# Start dev server
31+
CMD ["npm", "run", "dev"]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// __mocks__/@prisma/client.ts
2+
3+
export enum LabStatus {
4+
ACTIVE = 'ACTIVE',
5+
INACTIVE = 'INACTIVE',
6+
}
7+
8+
// Create mock functions for all lab operations
9+
const labMocks = {
10+
findMany: jest.fn(),
11+
findUnique: jest.fn(),
12+
create: jest.fn(),
13+
update: jest.fn(),
14+
delete: jest.fn(),
15+
};
16+
17+
// Export the mock object for use in tests
18+
export const mocks = {
19+
lab: labMocks,
20+
};
21+
22+
// PrismaClient mock returns the above mocked lab model
23+
export class PrismaClient {
24+
lab = labMocks;
25+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// __mocks__/ioredis.ts
2+
export default jest.fn().mockImplementation(() => ({
3+
get: jest.fn(),
4+
set: jest.fn(),
5+
del: jest.fn(),
6+
on: jest.fn(),
7+
connect: jest.fn(),
8+
disconnect: jest.fn(),
9+
}));

backend/docker-compose.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
version: '3.8'
2+
3+
services:
4+
backend:
5+
container_name: time-booking-backend
6+
build:
7+
context: .
8+
dockerfile: Dockerfile.dev
9+
# platform: linux/amd64
10+
ports:
11+
- "4000:4000"
12+
volumes:
13+
- .:/app
14+
- /app/node_modules
15+
environment:
16+
- NODE_ENV=development
17+
- REDIS_HOST=redis
18+
- REDIS_PORT=6379
19+
command: npm run dev
20+
depends_on:
21+
- db
22+
- redis # Added Redis dependency
23+
24+
db:
25+
image: postgres:15
26+
restart: always
27+
container_name: lab_booking_db
28+
environment:
29+
POSTGRES_USER: postgres
30+
POSTGRES_PASSWORD: password
31+
POSTGRES_DB: lab_booking
32+
ports:
33+
- "5432:5432"
34+
volumes:
35+
- db_data:/var/lib/postgresql/data
36+
37+
redis: # 🔥 Redis Service Added
38+
image: redis:7
39+
container_name: lab_booking_redis
40+
ports:
41+
- "6379:6379"
42+
43+
volumes:
44+
db_data:

0 commit comments

Comments
 (0)