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
8 changes: 5 additions & 3 deletions .github/workflows/build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
branches: [ "**" ]

jobs:
validate-and-build:
Expand Down Expand Up @@ -32,11 +32,13 @@ jobs:
run: npm run lint --if-present

- name: Validate Prisma Schema
# Ensures the database relationships and syntax are correct
env:
DATABASE_URL: "postgresql://dummy:dummy@localhost:5432/dummy"
run: npx prisma validate --schema=backend/prisma/schema.prisma

- name: Test Prisma Client Generation
# Ensures Prisma can successfully build the client from the schema
env:
DATABASE_URL: "postgresql://dummy:dummy@localhost:5432/dummy"
run: npx prisma generate --schema=backend/prisma/schema.prisma

- name: Build Frontend
Expand Down
10 changes: 6 additions & 4 deletions backend/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ const eventsRoutes = require('./modules/events/events.routes');
function createApp() {
const app = express();

app.use(cors({
origin: process.env.FRONTEND_URL || 'http://localhost:5173',
credentials: true,
}));
app.use(
cors({
origin: process.env.FRONTEND_URL || 'http://localhost:5173',
credentials: true,
}),
);
app.use(express.json());
app.use(cookieParser());
app.use(attachUser);
Expand Down
4 changes: 1 addition & 3 deletions backend/src/modules/auth/auth.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ router.post('/google/token', async (req, res, next) => {
return res.status(400).json({ error: 'Missing credential' });
}

const infoRes = await fetch(
`https://oauth2.googleapis.com/tokeninfo?id_token=${credential}`,
);
const infoRes = await fetch(`https://oauth2.googleapis.com/tokeninfo?id_token=${credential}`);
const info = await infoRes.json();

if (!infoRes.ok || info.error_description) {
Expand Down
13 changes: 8 additions & 5 deletions backend/src/modules/matches/matches.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ async function findMatchesForIntent(intent) {
async function getMatchesForUser(userId) {
const matches = await prisma.match.findMany({
where: {
OR: [
{ ride: { posterId: userId } },
{ intent: { userId: userId } },
],
OR: [{ ride: { posterId: userId } }, { intent: { userId: userId } }],
},
include: {
ride: {
Expand Down Expand Up @@ -238,4 +235,10 @@ async function rejectMatch(matchId, userId) {
return { ok: true };
}

module.exports = { findMatchesForRide, findMatchesForIntent, getMatchesForUser, confirmMatch, rejectMatch };
module.exports = {
findMatchesForRide,
findMatchesForIntent,
getMatchesForUser,
confirmMatch,
rejectMatch,
};
9 changes: 8 additions & 1 deletion backend/src/modules/rides/rides.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ const express = require('express');
const { requireAuth } = require('../../middleware/auth');
const { rideCreateLimiter } = require('../../middleware/rate-limit');
const { createRideSchema } = require('./rides.schema');
const { createRide, getRideById, cancelRide, joinRide, leaveRide, getMyActiveRides } = require('./rides.service');
const {
createRide,
getRideById,
cancelRide,
joinRide,
leaveRide,
getMyActiveRides,
} = require('./rides.service');

const router = express.Router();

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import './index.css';
ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<App />
</React.StrictMode>
</React.StrictMode>,
);
17 changes: 8 additions & 9 deletions frontend/src/pages/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ export default function Login() {
}
},
});
window.google.accounts.id.renderButton(
document.getElementById('google-signin-btn'),
{ theme: 'outline', size: 'large', width: 280 },
);
window.google.accounts.id.renderButton(document.getElementById('google-signin-btn'), {
theme: 'outline',
size: 'large',
width: 280,
});
}

if (window.google?.accounts?.id) {
Expand All @@ -60,9 +61,7 @@ export default function Login() {
<p className="text-gray-500 mb-8 text-sm">A better way to share autos out of campus.</p>

{googleError && (
<p className="text-red-600 text-sm mb-5 bg-red-50 rounded-md px-3 py-2">
{googleError}
</p>
<p className="text-red-600 text-sm mb-5 bg-red-50 rounded-md px-3 py-2">{googleError}</p>
)}

{GOOGLE_CLIENT_ID ? (
Expand All @@ -71,8 +70,8 @@ export default function Login() {
</div>
) : (
<p className="text-sm text-gray-400 border border-dashed border-gray-300 rounded-md px-4 py-3">
Google sign-in not configured.{' '}
<span className="font-mono">VITE_GOOGLE_CLIENT_ID</span> is missing.
Google sign-in not configured. <span className="font-mono">VITE_GOOGLE_CLIENT_ID</span>{' '}
is missing.
</p>
)}

Expand Down
3 changes: 1 addition & 2 deletions frontend/src/pages/PostIntent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ export default function PostIntent() {

<div>
<label htmlFor="maxFare" className="block text-sm font-medium text-gray-700 mb-1">
Max Fare (₹){' '}
<span className="text-gray-400 font-normal">(optional)</span>
Max Fare (₹) <span className="text-gray-400 font-normal">(optional)</span>
</label>
<input
id="maxFare"
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/pages/PostRide.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,7 @@ export default function PostRide() {

<div>
<label htmlFor="notes" className="block text-sm font-medium text-gray-700 mb-1">
Notes{' '}
<span className="text-gray-400 font-normal">
(optional, {notes.length}/200)
</span>
Notes <span className="text-gray-400 font-normal">(optional, {notes.length}/200)</span>
</label>
<textarea
id="notes"
Expand Down
27 changes: 21 additions & 6 deletions package-lock.json

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

Loading