Skip to content
Draft
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ venv/

.vscode/

scripts/
scripts/*
!scripts/seed-event-demo.js
.env*
.flaskenv*
!.env.project
Expand Down
12 changes: 8 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,23 @@ Meridian (formerly Study Compass) is a full-stack web app for university campus
```
- **Fallback (stub mode)**: If you do NOT have access to the private repo, you can create minimal stubs so the server starts (but events functionality will not work):
1. Remove the symlink: `rm backend/events`
2. Create the directory: `mkdir -p backend/events/schemas`
2. Create the directory: `mkdir -p backend/events/schemas backend/events/utilities backend/events/routes`
3. Create `backend/events/index.js` exporting an Express router
4. Create stub Mongoose schemas in `backend/events/schemas/` for: `rssFeed`, `approvalFlowDefinition`, `approvalInstance`, `event`, `form`, `formResponse`, `eventAnalytics`, `eventSystemConfig`, `stakeholderRole`, `domain`, `analyticsEvent`, `eventQR`
- **Note**: The stubs allow the server to start but all events-related API endpoints will be non-functional. Full development requires the actual Events-Backend repo.
4. Create `backend/events/backendRoot.js` exporting `{ require: (...args) => require(...args) }`
5. Create stub Mongoose schemas in `backend/events/schemas/` for: `rssFeed`, `approvalFlowDefinition`, `approvalInstance`, `event`, `form`, `formResponse`, `eventAnalytics`, `eventSystemConfig`, `stakeholderRole`, `domain`, `analyticsEvent`, `eventQR` (each exports `new mongoose.Schema({}, { strict: false })`)
6. Create `backend/events/utilities/workflowUtilities.js` with `getDomainSpaceGovernance` and `scopeMatchesEventContext` functions (see existing stubs for reference)
7. Create `backend/events/routes/analyticsDashboardRoutes.js` with stub analytics dashboard routes (see existing stubs for reference)
- **Note**: The stubs allow the server to start and backend tests to pass, but all events-related API endpoints will be non-functional. Full development requires the actual Events-Backend repo.
- **`.env` file** is needed in both `/workspace/.env` and `/workspace/backend/.env` with at minimum: `JWT_SECRET`, `MONGO_URI_RPI` (or `MONGODB_URI`), `NODE_ENV=development`.
- **ESLint** for the frontend requires `NODE_ENV` to be set: `NODE_ENV=development npx eslint src/`
- The frontend test suite (`npm test` in `frontend/`) has a pre-existing failure in `App.test.js` related to analytics imports. This is not caused by environment setup.
- The frontend test suite (`CI=true npm test` in `frontend/`) passes all tests (5 suites, 16 tests). The worker process may report a force-exit warning due to open handles — this is benign.

### Lint / test / build commands

See `README.md` for standard setup instructions. Quick reference:
- **Lint frontend**: `cd frontend && NODE_ENV=development npx eslint src/`
- **Test frontend**: `cd frontend && CI=true npm test`
- **Build frontend**: `cd frontend && npm run build`
- **Test backend**: `cd backend && NODE_ENV=test npx jest --runInBand` (uses mongodb-memory-server, no running mongod needed)
- **Backend health check**: `curl http://localhost:5001/health`
- **Backend greet**: `curl http://localhost:5001/api/greet`
15 changes: 11 additions & 4 deletions backend/routes/orgEventManagementRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@ const ExternalRoomSyncService = require('../services/externalRoomSyncService');
const { resolveAnonymousEmail, resolveAnonymousName } = require('../services/eventAnnouncementService');
const { getEffectivePolicy, assertOrgAllowsEventCreation, assertEventReservationReady } = require('../services/atlasPolicyService');

const buildOrgEventScope = (orgId) => ([
{ hostingId: orgId },
{ collaboratorOrgs: { $elemMatch: { orgId, status: 'active' } } }
]);
const mongoose = require('mongoose');
const toObjectId = (id) => {
try { return new mongoose.Types.ObjectId(String(id)); } catch { return id; }
};
const buildOrgEventScope = (orgId) => {
const oid = toObjectId(orgId);
return [
{ hostingId: oid },
{ collaboratorOrgs: { $elemMatch: { orgId: oid, status: 'active' } } }
];
};

const buildScopedEventQuery = (orgId, eventId) => ({
_id: eventId,
Expand Down
Loading