Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
27b806b
refactor: isolate database logic and models (#86)
natalierobbins Oct 10, 2025
dcfe97b
server: Survey Collection Refactor (#87)
natalierobbins Oct 20, 2025
28e03dd
fix: make surveyCode uniqueness checks async (#94)
natalierobbins Oct 22, 2025
637283d
server: Seed, Location, & User Collections Refactor (#93)
natalierobbins Oct 27, 2025
ae11dc6
feat: define new RBAC rules in CASL
natalierobbins Oct 28, 2025
5b56835
chore: update auth middleware to support new RBAC rules
natalierobbins Oct 28, 2025
081ba92
chore: update routes to use new RBAC rules
natalierobbins Oct 28, 2025
b785c4a
fix: remove default values from zod validators to avoid permission fa…
natalierobbins Oct 28, 2025
11f9556
chore: update race-condition and nullish op lints
natalierobbins Oct 28, 2025
7f3b15c
chore: add test suite
natalierobbins Oct 28, 2025
2abd762
fix: investigate endpoint debug
natalierobbins Oct 28, 2025
74c9cd2
chore: update constants
natalierobbins Oct 29, 2025
272af08
chore: update custom permissions
natalierobbins Oct 29, 2025
07f5a74
refactor: rm sparse utils file
natalierobbins Oct 29, 2025
c0a98cc
fix: delayed auth rejection for custom permissions
natalierobbins Oct 29, 2025
2ab6704
feat: add super admin + incorporate into seed/loc routes
natalierobbins Oct 29, 2025
b7ff7fd
refactor: type jwt payload
anantmittal Oct 29, 2025
bf563ea
refactor: add todo to old models file
anantmittal Oct 29, 2025
177eb78
fix: update user signup to match new schemas
anantmittal Oct 29, 2025
1a3e61f
refactor: send user role to ability builder directly
anantmittal Oct 29, 2025
6516767
refactor: minor type edits
anantmittal Oct 29, 2025
8d236cc
Merge pull request #98 from natalierobbins/feat/expanded-rbac
natalierobbins Oct 29, 2025
591fe03
feat: udpate survey code generation (#99)
natalierobbins Oct 29, 2025
38c4449
fix: copilot reviews
anantmittal Oct 29, 2025
ab4d580
Merge branch 'feat/expanded-rbac' into server-refactor
anantmittal Oct 29, 2025
1342e94
chore: compound index for latest survey by user
natalierobbins Oct 29, 2025
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
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,28 @@ server/ # Backend code
├── __tests__/ # Backend tests
│ ├── database.test.js
│ └── server.test.js
├── database/ # Database layer
│ ├── __tests__/ # Database tests
│ │ └── index.test.ts
│ ├── survey/ # Survey domain module
│ │ ├── mongoose/ # Mongoose models and hooks
│ │ │ ├── __tests__/
│ │ │ ├── survey.hooks.ts
│ │ │ └── survey.model.ts
│ │ ├── zod/ # Zod validation schemas
│ │ │ ├── __tests__/
│ │ │ ├── survey.base.ts
│ │ │ └── survey.validator.ts
│ │ ├── survey.controller.ts # Route operations
│ │ └── survey.utils.ts # Utility functions
│ ├── user/ # User domain module (same structure as survey)
│ │ └── ...
│ ├── seed/ # Seed domain module (same structure as survey)
│ │ └── ...
│ ├── utils/ # Database utilities
│ │ ├── constants.ts
│ │ └── errors.ts
│ └── index.ts # Database module exports
├── models/ # Mongoose schemas
│ └── __tests__/ # Models tests
│ ├── Survey.test.js
Expand All @@ -127,8 +149,7 @@ server/ # Backend code
│ ├── __tests__/ # Utils tests
│ │ └── generateReferralCode.test.js
│ └── generateReferralCode.js # Utility to generate unique referral codes
├── database.js # Mongoose DB connection init
├── index.js # Main entry point for Express backend
├── index.ts # Main entry point for Express backend
├── .gitignore # Specifies files to ignore in Git
├── package.json # Backend dependencies and scripts
└── package-lock.json # Lockfile for backend dependencies
Expand Down
41 changes: 37 additions & 4 deletions client/src/pages/Signup/Signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,32 @@ export default function Signup() {
lastName: '',
email: '',
phone: '',
role: ''
role: '',
locationObjectId: ''
});
const [otp, setOtp] = useState('');
const [otpSent, setOtpSent] = useState(false);
const [errorMessage, setErrorMessage] = useState('');
const [countdown, setCountdown] = useState(0);
const [locations, setLocations] = useState<
Array<{ _id: string; hubName: string }>
>([]);

useEffect(() => {
const fetchLocations = async () => {
try {
const response = await fetch('/api/v2/locations');
if (response.ok) {
const data = await response.json();
console.log('Fetched locations:', data);
setLocations(data.data);
}
} catch (error) {
console.error('Failed to fetch locations:', error);
}
};
fetchLocations();
}, []);

useEffect(() => {
let timer: string | number | NodeJS.Timeout | undefined;
Expand Down Expand Up @@ -124,16 +144,29 @@ export default function Signup() {
onChange={handlePhoneChange}
required
/>
<select
name="locationObjectId"
value={userData.locationObjectId}
onChange={handleChange}
required
>
<option value="">--Select Location--</option>
{locations.map(location => (
<option key={location._id} value={location._id}>
{location.hubName}
</option>
))}
</select>
<select
name="role"
value={userData.role}
onChange={handleChange}
required
>
<option value="">--Select Role--</option>
<option value="Volunteer">Volunteer</option>
<option value="Manager">Manager</option>
<option value="Admin">Admin</option>
<option value="VOLUNTEER">VOLUNTEER</option>
<option value="MANAGER">MANAGER</option>
<option value="ADMIN">ADMIN</option>
</select>
<button onClick={sendOtp}>Send OTP</button>
<p className="switch-auth">
Expand Down
3 changes: 2 additions & 1 deletion server/.env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
MONGODB_URI=
NODE_ENV=development
MONGO_URI=
TWILIO_ACCOUNT_SID=""
TWILIO_AUTH_TOKEN=""
# TWILIO_VERIFY_SID
Expand Down
Loading
Loading