Skip to content

Commit

Permalink
Add user to the staff list on the frontend instead of the backend (#266)
Browse files Browse the repository at this point in the history
* Add user to the staff list on the frontend instead of the backend

* [Closes #221] Update dependencies, resolve all npm audit warnings (#259)

* Ran npm audit fix

* Remove deprecated @next/font

* Replace mockery with rewiremock

* Bump nextjs version

* Bump typed-css-modules version

* Staff page (#269)

Co-authored-by: Brandon Cruz-Youll <[email protected]>

* Add breadcrumbs (#268)

* changed placeholder to defaultValue on forms for edit student and edit staff (#276)

* added placeholder files and instruction documentation for Design System components and their css modules (#275)

* Update button module to override MUI styling and apply to all button instances  (#277)

* fix secondary button styling on button module and apply to edit button on student page

* add button folder with button module to components

* change imports for button module

* fix edit, cancel, and save buttons on student page

* replace button module file in design system button folder and delete previous button folder

* replace import statements for button module

* change subgoal button to inherit button module styling instead of goal module styling

* change assign staff button styling in subgoal to inherit button module styling

* update buttons on subgoal assignment modal to inherit button module styling

* update border radius and secondary border color in button module

* change all button stylings on staff page

* changes to button module

* prettier fix

* update primary variable hex in global css file and update button color to be in accordance with DS

* fix prettier in globalcss

* remove sx from line 43 of staff/[user_id] and remove all instances of home.bold styling in buttons

---------

* Fix cm student id page (#280)

* add Goal and Iep components and css from feat-cm-edit-goal

* remove css class in Goal.module.css for removed controlCarat class

* add flexWrap: wrap to div containing benchmark info in goal to avoid pushing ArrowForwardIosIcon into Add Goal form

* run prettier

* remove additional unused code and imports from components/goal/Goal

* Fix type error

---------

Co-authored-by: Francis Li <[email protected]>
Co-authored-by: Brett Austin Eastman <[email protected]>
Co-authored-by: Brandon Cruz-Youll <[email protected]>
Co-authored-by: Hieu Ngo <[email protected]>
Co-authored-by: Brandon Cruz-Youll <[email protected]>
Co-authored-by: Tessa Thornberry <[email protected]>
Co-authored-by: Hannah McGowan <[email protected]>
Co-authored-by: KCCPMG <[email protected]>
  • Loading branch information
9 people authored Feb 14, 2024
1 parent c6914db commit 0013907
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/backend/routers/case_manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ test("getMyParas", async (t) => {
});

let myParas = await trpc.case_manager.getMyParas.query();
t.is(myParas.length, 1);
t.is(myParas.length, 0);

await db
.insertInto("paras_assigned_to_case_manager")
Expand All @@ -197,7 +197,7 @@ test("getMyParas", async (t) => {
.execute();

myParas = await trpc.case_manager.getMyParas.query();
t.is(myParas.length, 2);
t.is(myParas.length, 1);
});

test("addPara", async (t) => {
Expand All @@ -206,14 +206,14 @@ test("addPara", async (t) => {
});

let myParas = await trpc.case_manager.getMyParas.query();
t.is(myParas.length, 1);
t.is(myParas.length, 0);

await trpc.case_manager.addPara.mutate({
para_id: seed.para.user_id,
});

myParas = await trpc.case_manager.getMyParas.query();
t.is(myParas.length, 2);
t.is(myParas.length, 1);
});

test("removePara", async (t) => {
Expand All @@ -230,12 +230,12 @@ test("removePara", async (t) => {
.execute();

let myParas = await trpc.case_manager.getMyParas.query();
t.is(myParas.length, 2);
t.is(myParas.length, 1);

await trpc.case_manager.removePara.mutate({
para_id: seed.para.user_id,
});

myParas = await trpc.case_manager.getMyParas.query();
t.is(myParas.length, 1);
t.is(myParas.length, 0);
});
8 changes: 1 addition & 7 deletions src/backend/routers/case_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,6 @@ export const case_manager = router({
getMyParas: authenticatedProcedure.query(async (req) => {
const { userId } = req.ctx.auth;

const me = await req.ctx.db
.selectFrom("user")
.where("user_id", "=", userId)
.selectAll()
.executeTakeFirst();

const result = await req.ctx.db
.selectFrom("user")
.innerJoin(
Expand All @@ -158,7 +152,7 @@ export const case_manager = router({
.selectAll()
.execute();

return [me, ...result];
return result;
}),

addPara: authenticatedProcedure
Expand Down
2 changes: 2 additions & 0 deletions src/components/subgoal/Subgoal-Assignment-Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ interface ParaProps {
first_name: string;
last_name: string;
email: string;
para_id: string;
case_manager_id: string;
user_id: string;
email_verified_at: Date | null;
image_url: string | null;
Expand Down
3 changes: 2 additions & 1 deletion src/pages/staff/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import PersonTable, { Para, ParaHeadCell } from "@/components/table/table";
const Staff = () => {
const utils = trpc.useContext();
const { data: paras, isLoading } = trpc.case_manager.getMyParas.useQuery();
const { data: me } = trpc.user.getMe.useQuery();

const createPara = trpc.para.createPara.useMutation({
onSuccess: async (data) => {
Expand Down Expand Up @@ -59,7 +60,7 @@ const Staff = () => {

return (
<PersonTable
people={paras as Para[]}
people={[...(me ? [me] : []), ...(paras ?? [])] as Para[]}
onSubmit={handleSubmit}
headCells={headCells}
type="Staff"
Expand Down

0 comments on commit 0013907

Please sign in to comment.