Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portal frontend 50 #59

Merged
merged 28 commits into from
Sep 10, 2024
Merged
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"✅ Do add `devDependencies` below that are `peerDependencies` in the CFL package."
],
"dependencies": {
"codeforlife": "github:ocadotechnology/codeforlife-package-javascript#v2.3.1",
"codeforlife": "github:ocadotechnology/codeforlife-package-javascript#v2.3.2",
"crypto-js": "^4.2.0"
},
"devDependencies": {
Expand Down
19 changes: 16 additions & 3 deletions src/api/student.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@ import {
type BulkDestroyResult,
type BulkUpdateArg,
type BulkUpdateResult,
type Result,
tagData,
} from "codeforlife/utils/api"
import { type Student, type User, urls } from "codeforlife/api"

import api from "."

export type CreateStudentsResult = BulkCreateResult<Student>
export type CreateStudentsResult = BulkCreateResult<
Student,
"auto_gen_password",
{
user: Result<User, "password">
}
>
export type CreateStudentsArg = BulkCreateArg<
Student,
"klass",
Expand Down Expand Up @@ -42,13 +49,19 @@ export type TransferStudentsArg = BulkUpdateArg<
}
>

export type ResetStudentsPasswordResult = BulkUpdateResult<Student>
export type ResetStudentsPasswordResult = BulkUpdateResult<
Student,
"auto_gen_password",
{
user: Result<User, "password">
}
>
export type ResetStudentsPasswordArg = BulkUpdateArg<
Student,
never,
never,
{
user: Arg<User, never, "password">
user?: Arg<User, never, "password">
}
>

Expand Down
6 changes: 6 additions & 0 deletions src/app/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@
// for importing and re-exporting the typed versions of hooks.
/* eslint-disable @typescript-eslint/no-restricted-imports */
import { useDispatch, useSelector } from "react-redux"
import { useParams } from "codeforlife/hooks"

import type { AppDispatch, RootState } from "./store"
import { classIdSchema } from "./schemas"

// Use throughout your app instead of plain `useDispatch` and `useSelector`
export const useAppDispatch = useDispatch.withTypes<AppDispatch>()
export const useAppSelector = useSelector.withTypes<RootState>()

export function useClassIdParam() {
return useParams({ classId: classIdSchema().required() })

Check warning on line 18 in src/app/hooks.ts

View check run for this annotation

Codecov / codecov/patch

src/app/hooks.ts#L17-L18

Added lines #L17 - L18 were not covered by tests
}
Loading