With permission, here are samples of my work done on API Live for American Digital Diversity Initiative. Other colleagues content will generally be commented out and noted as so. Files are organized into React, .NET, & SQL folders. Brief summary of work done:
- Login component pushes currentUser info as state via react router's props.history.push() to a higher AppRoutes component where it updates currentUser state via getDerivedStateFromProps:
static getDerivedStateFromProps(nextProps, prevState) {
const type = nextProps.location.state ? nextProps.location.state.type : "";
switch (type) {
case "login":
return nextProps.location.state.user.id !== prevState.currentUser.id
? {
currentUser: {
isLoggedIn: true,
...nextProps.location.state.user
}
}
: {};
default:
return prevState.currentUser.isLoggedIn
? {
currentUser: {
...prevState.currentUser
}
}
: {};
}
}
- Dashboards: every dashboard's Main.jsx relies on the subroute to display the component of interest when its respective button is clicked
- Multi-step event form components located under components/admin/organizationDashboard/event/eventform. Individual step components are imported into EventForm.jsx
- BaseApiController created by Project Lead but is provided here for reference
- AdvertisementDocumentService.cs generally standard CRUD
- Login service methods located under UserService.cs
- EventService.cs's Insert method contains handling of the various related table entities that are needed in order to insert an event record. DataTable types are used to handle the user defined table types in SQL
- Users_Insert.sql connects to registration methods in .Net
- Users_GetPaginatedByUserRole.sql contains paginated example combined with separate set for related multiple users' roles
- Events_Insert.sql utilizes transaction to rollback any insertions done due to having to insert various table entities
- Rest are generally standard CRUD stored procedures