mirror of
https://github.com/Sea-Haven-Industries/proposal-system.git
synced 2026-09-30 22:53:13 +00:00
Some checks are pending
Deploy / Deploy to AWS (push) Waiting to run
Adds a managed pricing library so admins can seed/curate reference priced items
directly, instead of the corpus being populated only by ingesting Sent proposals.
v1 PR5.
API:
- PricingLibraryItem entity + migration; /api/pricing-library CRUD (admin), with
GET {id} reachable by internal Lambda callers (admins role via internal key).
- Create/update publish an ADDITIVE library-ingest SQS job {pricingLibraryItemId},
wrapped so a publish failure never rolls back the save.
Lambda (library-ingest):
- Additive event-shape branch: pricingLibraryItemId -> fetch item, format markdown,
upload to pricing-library/{category}/{id}.md, trigger KB sync. The existing
proposalId path is byte-for-byte unchanged. Explicit error when neither id present;
warns when both present.
Web:
- Pricing Library management page (/admin/pricing-library): list / create / edit / delete.
GPT-4.1 cross-review on the event-shape change: no BLOCK (neither/both-id handling
applied). Verified: api 159 tests; web tsc + 26 tests; lambdas ruff + 37 pytest.
87 lines
4.3 KiB
TypeScript
87 lines
4.3 KiB
TypeScript
import { Routes, Route, Navigate } from 'react-router-dom';
|
|
import { Box, Button, Card, CardContent, Toolbar, Typography } from '@mui/material';
|
|
import PeopleIcon from '@mui/icons-material/People';
|
|
import ProtectedRoute, { RoleGuard } from './components/ProtectedRoute';
|
|
import Topbar from './components/Topbar';
|
|
import Sidebar from './components/Sidebar';
|
|
import LoginPage from './pages/auth/LoginPage';
|
|
import AuthCallback from './pages/auth/AuthCallback';
|
|
import Dashboard from './pages/dashboard/Dashboard';
|
|
import ProposalFormPage from './pages/proposals/form/ProposalFormPage';
|
|
import ProposalDetailPage from './pages/proposals/detail/ProposalDetailPage';
|
|
import ProposalListPage from './pages/proposals/list/ProposalListPage';
|
|
import AdminDashboard from './pages/admin/dashboard/AdminDashboard';
|
|
import AdminWorkspace from './pages/admin/workspace/AdminWorkspace';
|
|
import CustomerManagementPage from './pages/admin/customers/CustomerManagementPage';
|
|
import PricingLibraryPage from './pages/admin/pricing-library/PricingLibraryPage';
|
|
|
|
export default function App() {
|
|
return (
|
|
<Routes>
|
|
<Route path="/login" element={<LoginPage />} />
|
|
<Route path="/callback" element={<AuthCallback />} />
|
|
|
|
<Route
|
|
path="/*"
|
|
element={
|
|
<ProtectedRoute>
|
|
<Box sx={{ display: 'flex' }}>
|
|
<Topbar />
|
|
<Sidebar />
|
|
<Box
|
|
component="main"
|
|
sx={{
|
|
flexGrow: 1,
|
|
minWidth: 0,
|
|
p: 1.25,
|
|
minHeight: '100vh',
|
|
}}
|
|
>
|
|
<Toolbar sx={{ minHeight: 64 }} />
|
|
<Routes>
|
|
<Route path="/" element={<Dashboard />} />
|
|
<Route path="/proposals" element={<ProposalListPage />} />
|
|
<Route path="/proposals/new" element={<ProposalFormPage />} />
|
|
<Route path="/proposals/:id" element={<ProposalDetailPage />} />
|
|
|
|
{/* Admin Routes */}
|
|
<Route path="/admin" element={<RoleGuard roles={['Admin', 'SysAdmin']}><AdminDashboard defaultStatus="InReview" /></RoleGuard>} />
|
|
<Route path="/admin/proposals" element={<RoleGuard roles={['Admin', 'SysAdmin']}><AdminDashboard /></RoleGuard>} />
|
|
<Route path="/admin/proposals/:id" element={<RoleGuard roles={['Admin', 'SysAdmin']}><AdminWorkspace /></RoleGuard>} />
|
|
<Route path="/admin/customers" element={<RoleGuard roles={['Admin', 'SysAdmin']}><CustomerManagementPage /></RoleGuard>} />
|
|
<Route path="/admin/pricing-library" element={<RoleGuard roles={['Admin', 'SysAdmin']}><PricingLibraryPage /></RoleGuard>} />
|
|
<Route path="/admin/users" element={
|
|
<RoleGuard roles={['SysAdmin']}>
|
|
<Box sx={{ display: 'flex', justifyContent: 'center', pt: 6 }}>
|
|
<Card sx={{ maxWidth: 520, p: 4, textAlign: 'center' }}>
|
|
<CardContent>
|
|
<PeopleIcon sx={{ fontSize: 48, color: '#94A3B8', mb: 2 }} />
|
|
<Typography variant="h5" sx={{ mb: 1 }}>User Management</Typography>
|
|
<Typography variant="body1" color="text.secondary" sx={{ mb: 3 }}>
|
|
Users and roles are currently managed in AWS Cognito. Contact the system administrator to update access.
|
|
</Typography>
|
|
<Button
|
|
variant="outlined"
|
|
size="large"
|
|
href="https://us-east-1.console.aws.amazon.com/cognito/v2/idp/user-pools?region=us-east-1"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
>
|
|
Manage in Cognito
|
|
</Button>
|
|
</CardContent>
|
|
</Card>
|
|
</Box>
|
|
</RoleGuard>
|
|
} />
|
|
|
|
<Route path="*" element={<Navigate to="/" replace />} />
|
|
</Routes>
|
|
</Box>
|
|
</Box>
|
|
</ProtectedRoute>
|
|
}
|
|
/>
|
|
</Routes>
|
|
);
|
|
}
|