Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
eeeae5181a
commit
002f4d00f0
+187
-2
@@ -12,7 +12,15 @@ import { Route as rootRouteImport } from './routes/__root'
|
||||
import { Route as AuthRouteImport } from './routes/auth'
|
||||
import { Route as AuthenticatedRouteRouteImport } from './routes/_authenticated/route'
|
||||
import { Route as IndexRouteImport } from './routes/index'
|
||||
import { Route as AuthenticatedStudentsRouteImport } from './routes/_authenticated/students'
|
||||
import { Route as AuthenticatedMessagesRouteImport } from './routes/_authenticated/messages'
|
||||
import { Route as AuthenticatedLedgerRouteImport } from './routes/_authenticated/ledger'
|
||||
import { Route as AuthenticatedFormsRouteImport } from './routes/_authenticated/forms'
|
||||
import { Route as AuthenticatedDashboardRouteImport } from './routes/_authenticated/dashboard'
|
||||
import { Route as AuthenticatedCalendarRouteImport } from './routes/_authenticated/calendar'
|
||||
import { Route as AuthenticatedAttendanceRouteImport } from './routes/_authenticated/attendance'
|
||||
import { Route as AuthenticatedAdminRouteImport } from './routes/_authenticated/admin'
|
||||
import { Route as AuthenticatedStudentsIdRouteImport } from './routes/_authenticated/students.$id'
|
||||
|
||||
const AuthRoute = AuthRouteImport.update({
|
||||
id: '/auth',
|
||||
@@ -28,40 +36,134 @@ const IndexRoute = IndexRouteImport.update({
|
||||
path: '/',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const AuthenticatedStudentsRoute = AuthenticatedStudentsRouteImport.update({
|
||||
id: '/students',
|
||||
path: '/students',
|
||||
getParentRoute: () => AuthenticatedRouteRoute,
|
||||
} as any)
|
||||
const AuthenticatedMessagesRoute = AuthenticatedMessagesRouteImport.update({
|
||||
id: '/messages',
|
||||
path: '/messages',
|
||||
getParentRoute: () => AuthenticatedRouteRoute,
|
||||
} as any)
|
||||
const AuthenticatedLedgerRoute = AuthenticatedLedgerRouteImport.update({
|
||||
id: '/ledger',
|
||||
path: '/ledger',
|
||||
getParentRoute: () => AuthenticatedRouteRoute,
|
||||
} as any)
|
||||
const AuthenticatedFormsRoute = AuthenticatedFormsRouteImport.update({
|
||||
id: '/forms',
|
||||
path: '/forms',
|
||||
getParentRoute: () => AuthenticatedRouteRoute,
|
||||
} as any)
|
||||
const AuthenticatedDashboardRoute = AuthenticatedDashboardRouteImport.update({
|
||||
id: '/dashboard',
|
||||
path: '/dashboard',
|
||||
getParentRoute: () => AuthenticatedRouteRoute,
|
||||
} as any)
|
||||
const AuthenticatedCalendarRoute = AuthenticatedCalendarRouteImport.update({
|
||||
id: '/calendar',
|
||||
path: '/calendar',
|
||||
getParentRoute: () => AuthenticatedRouteRoute,
|
||||
} as any)
|
||||
const AuthenticatedAttendanceRoute = AuthenticatedAttendanceRouteImport.update({
|
||||
id: '/attendance',
|
||||
path: '/attendance',
|
||||
getParentRoute: () => AuthenticatedRouteRoute,
|
||||
} as any)
|
||||
const AuthenticatedAdminRoute = AuthenticatedAdminRouteImport.update({
|
||||
id: '/admin',
|
||||
path: '/admin',
|
||||
getParentRoute: () => AuthenticatedRouteRoute,
|
||||
} as any)
|
||||
const AuthenticatedStudentsIdRoute = AuthenticatedStudentsIdRouteImport.update({
|
||||
id: '/$id',
|
||||
path: '/$id',
|
||||
getParentRoute: () => AuthenticatedStudentsRoute,
|
||||
} as any)
|
||||
|
||||
export interface FileRoutesByFullPath {
|
||||
'/': typeof IndexRoute
|
||||
'/auth': typeof AuthRoute
|
||||
'/admin': typeof AuthenticatedAdminRoute
|
||||
'/attendance': typeof AuthenticatedAttendanceRoute
|
||||
'/calendar': typeof AuthenticatedCalendarRoute
|
||||
'/dashboard': typeof AuthenticatedDashboardRoute
|
||||
'/forms': typeof AuthenticatedFormsRoute
|
||||
'/ledger': typeof AuthenticatedLedgerRoute
|
||||
'/messages': typeof AuthenticatedMessagesRoute
|
||||
'/students': typeof AuthenticatedStudentsRouteWithChildren
|
||||
'/students/$id': typeof AuthenticatedStudentsIdRoute
|
||||
}
|
||||
export interface FileRoutesByTo {
|
||||
'/': typeof IndexRoute
|
||||
'/auth': typeof AuthRoute
|
||||
'/admin': typeof AuthenticatedAdminRoute
|
||||
'/attendance': typeof AuthenticatedAttendanceRoute
|
||||
'/calendar': typeof AuthenticatedCalendarRoute
|
||||
'/dashboard': typeof AuthenticatedDashboardRoute
|
||||
'/forms': typeof AuthenticatedFormsRoute
|
||||
'/ledger': typeof AuthenticatedLedgerRoute
|
||||
'/messages': typeof AuthenticatedMessagesRoute
|
||||
'/students': typeof AuthenticatedStudentsRouteWithChildren
|
||||
'/students/$id': typeof AuthenticatedStudentsIdRoute
|
||||
}
|
||||
export interface FileRoutesById {
|
||||
__root__: typeof rootRouteImport
|
||||
'/': typeof IndexRoute
|
||||
'/_authenticated': typeof AuthenticatedRouteRouteWithChildren
|
||||
'/auth': typeof AuthRoute
|
||||
'/_authenticated/admin': typeof AuthenticatedAdminRoute
|
||||
'/_authenticated/attendance': typeof AuthenticatedAttendanceRoute
|
||||
'/_authenticated/calendar': typeof AuthenticatedCalendarRoute
|
||||
'/_authenticated/dashboard': typeof AuthenticatedDashboardRoute
|
||||
'/_authenticated/forms': typeof AuthenticatedFormsRoute
|
||||
'/_authenticated/ledger': typeof AuthenticatedLedgerRoute
|
||||
'/_authenticated/messages': typeof AuthenticatedMessagesRoute
|
||||
'/_authenticated/students': typeof AuthenticatedStudentsRouteWithChildren
|
||||
'/_authenticated/students/$id': typeof AuthenticatedStudentsIdRoute
|
||||
}
|
||||
export interface FileRouteTypes {
|
||||
fileRoutesByFullPath: FileRoutesByFullPath
|
||||
fullPaths: '/' | '/auth' | '/dashboard'
|
||||
fullPaths:
|
||||
| '/'
|
||||
| '/auth'
|
||||
| '/admin'
|
||||
| '/attendance'
|
||||
| '/calendar'
|
||||
| '/dashboard'
|
||||
| '/forms'
|
||||
| '/ledger'
|
||||
| '/messages'
|
||||
| '/students'
|
||||
| '/students/$id'
|
||||
fileRoutesByTo: FileRoutesByTo
|
||||
to: '/' | '/auth' | '/dashboard'
|
||||
to:
|
||||
| '/'
|
||||
| '/auth'
|
||||
| '/admin'
|
||||
| '/attendance'
|
||||
| '/calendar'
|
||||
| '/dashboard'
|
||||
| '/forms'
|
||||
| '/ledger'
|
||||
| '/messages'
|
||||
| '/students'
|
||||
| '/students/$id'
|
||||
id:
|
||||
| '__root__'
|
||||
| '/'
|
||||
| '/_authenticated'
|
||||
| '/auth'
|
||||
| '/_authenticated/admin'
|
||||
| '/_authenticated/attendance'
|
||||
| '/_authenticated/calendar'
|
||||
| '/_authenticated/dashboard'
|
||||
| '/_authenticated/forms'
|
||||
| '/_authenticated/ledger'
|
||||
| '/_authenticated/messages'
|
||||
| '/_authenticated/students'
|
||||
| '/_authenticated/students/$id'
|
||||
fileRoutesById: FileRoutesById
|
||||
}
|
||||
export interface RootRouteChildren {
|
||||
@@ -93,6 +195,34 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof IndexRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/_authenticated/students': {
|
||||
id: '/_authenticated/students'
|
||||
path: '/students'
|
||||
fullPath: '/students'
|
||||
preLoaderRoute: typeof AuthenticatedStudentsRouteImport
|
||||
parentRoute: typeof AuthenticatedRouteRoute
|
||||
}
|
||||
'/_authenticated/messages': {
|
||||
id: '/_authenticated/messages'
|
||||
path: '/messages'
|
||||
fullPath: '/messages'
|
||||
preLoaderRoute: typeof AuthenticatedMessagesRouteImport
|
||||
parentRoute: typeof AuthenticatedRouteRoute
|
||||
}
|
||||
'/_authenticated/ledger': {
|
||||
id: '/_authenticated/ledger'
|
||||
path: '/ledger'
|
||||
fullPath: '/ledger'
|
||||
preLoaderRoute: typeof AuthenticatedLedgerRouteImport
|
||||
parentRoute: typeof AuthenticatedRouteRoute
|
||||
}
|
||||
'/_authenticated/forms': {
|
||||
id: '/_authenticated/forms'
|
||||
path: '/forms'
|
||||
fullPath: '/forms'
|
||||
preLoaderRoute: typeof AuthenticatedFormsRouteImport
|
||||
parentRoute: typeof AuthenticatedRouteRoute
|
||||
}
|
||||
'/_authenticated/dashboard': {
|
||||
id: '/_authenticated/dashboard'
|
||||
path: '/dashboard'
|
||||
@@ -100,15 +230,70 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof AuthenticatedDashboardRouteImport
|
||||
parentRoute: typeof AuthenticatedRouteRoute
|
||||
}
|
||||
'/_authenticated/calendar': {
|
||||
id: '/_authenticated/calendar'
|
||||
path: '/calendar'
|
||||
fullPath: '/calendar'
|
||||
preLoaderRoute: typeof AuthenticatedCalendarRouteImport
|
||||
parentRoute: typeof AuthenticatedRouteRoute
|
||||
}
|
||||
'/_authenticated/attendance': {
|
||||
id: '/_authenticated/attendance'
|
||||
path: '/attendance'
|
||||
fullPath: '/attendance'
|
||||
preLoaderRoute: typeof AuthenticatedAttendanceRouteImport
|
||||
parentRoute: typeof AuthenticatedRouteRoute
|
||||
}
|
||||
'/_authenticated/admin': {
|
||||
id: '/_authenticated/admin'
|
||||
path: '/admin'
|
||||
fullPath: '/admin'
|
||||
preLoaderRoute: typeof AuthenticatedAdminRouteImport
|
||||
parentRoute: typeof AuthenticatedRouteRoute
|
||||
}
|
||||
'/_authenticated/students/$id': {
|
||||
id: '/_authenticated/students/$id'
|
||||
path: '/$id'
|
||||
fullPath: '/students/$id'
|
||||
preLoaderRoute: typeof AuthenticatedStudentsIdRouteImport
|
||||
parentRoute: typeof AuthenticatedStudentsRoute
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface AuthenticatedStudentsRouteChildren {
|
||||
AuthenticatedStudentsIdRoute: typeof AuthenticatedStudentsIdRoute
|
||||
}
|
||||
|
||||
const AuthenticatedStudentsRouteChildren: AuthenticatedStudentsRouteChildren = {
|
||||
AuthenticatedStudentsIdRoute: AuthenticatedStudentsIdRoute,
|
||||
}
|
||||
|
||||
const AuthenticatedStudentsRouteWithChildren =
|
||||
AuthenticatedStudentsRoute._addFileChildren(
|
||||
AuthenticatedStudentsRouteChildren,
|
||||
)
|
||||
|
||||
interface AuthenticatedRouteRouteChildren {
|
||||
AuthenticatedAdminRoute: typeof AuthenticatedAdminRoute
|
||||
AuthenticatedAttendanceRoute: typeof AuthenticatedAttendanceRoute
|
||||
AuthenticatedCalendarRoute: typeof AuthenticatedCalendarRoute
|
||||
AuthenticatedDashboardRoute: typeof AuthenticatedDashboardRoute
|
||||
AuthenticatedFormsRoute: typeof AuthenticatedFormsRoute
|
||||
AuthenticatedLedgerRoute: typeof AuthenticatedLedgerRoute
|
||||
AuthenticatedMessagesRoute: typeof AuthenticatedMessagesRoute
|
||||
AuthenticatedStudentsRoute: typeof AuthenticatedStudentsRouteWithChildren
|
||||
}
|
||||
|
||||
const AuthenticatedRouteRouteChildren: AuthenticatedRouteRouteChildren = {
|
||||
AuthenticatedAdminRoute: AuthenticatedAdminRoute,
|
||||
AuthenticatedAttendanceRoute: AuthenticatedAttendanceRoute,
|
||||
AuthenticatedCalendarRoute: AuthenticatedCalendarRoute,
|
||||
AuthenticatedDashboardRoute: AuthenticatedDashboardRoute,
|
||||
AuthenticatedFormsRoute: AuthenticatedFormsRoute,
|
||||
AuthenticatedLedgerRoute: AuthenticatedLedgerRoute,
|
||||
AuthenticatedMessagesRoute: AuthenticatedMessagesRoute,
|
||||
AuthenticatedStudentsRoute: AuthenticatedStudentsRouteWithChildren,
|
||||
}
|
||||
|
||||
const AuthenticatedRouteRouteWithChildren =
|
||||
|
||||
@@ -105,8 +105,11 @@ function ClassesTab() {
|
||||
const { data: teachers } = useQuery({
|
||||
queryKey: ["teachers"],
|
||||
queryFn: async () => {
|
||||
const { data } = await supabase.from("user_roles").select("user_id, profiles(id, full_name, email)").eq("role", "teacher");
|
||||
return (data ?? []).map((d) => d.profiles as { id: string; full_name: string; email: string }).filter(Boolean);
|
||||
const { data: r } = await supabase.from("user_roles").select("user_id").eq("role", "teacher");
|
||||
const ids = (r ?? []).map((x) => x.user_id);
|
||||
if (ids.length === 0) return [];
|
||||
const { data } = await supabase.from("profiles").select("id, full_name, email").in("id", ids);
|
||||
return data ?? [];
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user