Gradebook: classes, weighted grading, assignments, grades, student role

- Migration: student role, students.user_id, grade_categories/grade_scale
  (school defaults + per-class override), assignments, grades + RLS
- Classes area (nav): list/create classes, class page with Gradebook / Roster /
  Grading setup tabs; teachers see their classes, admins all
- Weighted-category grade calc -> letter scale (shared helper)
- Roster assignment (admin), assignment + grade entry (teacher/admin)
- Student profile: view-only Grades tab (parents/students)
- Portal access: create parent OR student logins linked to the student

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-19 16:57:27 -04:00
co-authored by Claude Opus 4.8
parent 73a4e70f0b
commit 8fe6ad00f4
12 changed files with 901 additions and 20 deletions
+164 -2
View File
@@ -39,6 +39,54 @@ export type Database = {
}
public: {
Tables: {
assignments: {
Row: {
category_id: string | null
class_id: string
created_at: string
created_by: string | null
date: string | null
id: string
max_points: number
name: string
}
Insert: {
category_id?: string | null
class_id: string
created_at?: string
created_by?: string | null
date?: string | null
id?: string
max_points?: number
name: string
}
Update: {
category_id?: string | null
class_id?: string
created_at?: string
created_by?: string | null
date?: string | null
id?: string
max_points?: number
name?: string
}
Relationships: [
{
foreignKeyName: "assignments_category_id_fkey"
columns: ["category_id"]
isOneToOne: false
referencedRelation: "grade_categories"
referencedColumns: ["id"]
},
{
foreignKeyName: "assignments_class_id_fkey"
columns: ["class_id"]
isOneToOne: false
referencedRelation: "classes"
referencedColumns: ["id"]
},
]
}
attendance: {
Row: {
created_at: string
@@ -282,6 +330,115 @@ export type Database = {
}
Relationships: []
}
grade_categories: {
Row: {
class_id: string | null
created_at: string
id: string
name: string
sort_order: number
weight: number
}
Insert: {
class_id?: string | null
created_at?: string
id?: string
name: string
sort_order?: number
weight?: number
}
Update: {
class_id?: string | null
created_at?: string
id?: string
name?: string
sort_order?: number
weight?: number
}
Relationships: [
{
foreignKeyName: "grade_categories_class_id_fkey"
columns: ["class_id"]
isOneToOne: false
referencedRelation: "classes"
referencedColumns: ["id"]
},
]
}
grade_scale: {
Row: {
class_id: string | null
created_at: string
id: string
letter: string
min_percent: number
}
Insert: {
class_id?: string | null
created_at?: string
id?: string
letter: string
min_percent: number
}
Update: {
class_id?: string | null
created_at?: string
id?: string
letter?: string
min_percent?: number
}
Relationships: [
{
foreignKeyName: "grade_scale_class_id_fkey"
columns: ["class_id"]
isOneToOne: false
referencedRelation: "classes"
referencedColumns: ["id"]
},
]
}
grades: {
Row: {
assignment_id: string
created_at: string
id: string
points: number | null
student_id: string
updated_at: string
}
Insert: {
assignment_id: string
created_at?: string
id?: string
points?: number | null
student_id: string
updated_at?: string
}
Update: {
assignment_id?: string
created_at?: string
id?: string
points?: number | null
student_id?: string
updated_at?: string
}
Relationships: [
{
foreignKeyName: "grades_assignment_id_fkey"
columns: ["assignment_id"]
isOneToOne: false
referencedRelation: "assignments"
referencedColumns: ["id"]
},
{
foreignKeyName: "grades_student_id_fkey"
columns: ["student_id"]
isOneToOne: false
referencedRelation: "students"
referencedColumns: ["id"]
},
]
}
ledger_entries: {
Row: {
amount_cents: number
@@ -581,6 +738,7 @@ export type Database = {
primary_physician: string | null
special_needs: string | null
updated_at: string
user_id: string | null
}
Insert: {
agreement_signed_by?: string | null
@@ -613,6 +771,7 @@ export type Database = {
primary_physician?: string | null
special_needs?: string | null
updated_at?: string
user_id?: string | null
}
Update: {
agreement_signed_by?: string | null
@@ -645,6 +804,7 @@ export type Database = {
primary_physician?: string | null
special_needs?: string | null
updated_at?: string
user_id?: string | null
}
Relationships: [
{
@@ -720,11 +880,13 @@ export type Database = {
Returns: boolean
}
is_parent_of: { Args: { _student: string }; Returns: boolean }
is_student_account: { Args: { _student: string }; Returns: boolean }
is_thread_participant: { Args: { _thread: string }; Returns: boolean }
teaches_class: { Args: { _class: string }; Returns: boolean }
teaches_student: { Args: { _student: string }; Returns: boolean }
}
Enums: {
app_role: "admin" | "teacher" | "parent"
app_role: "admin" | "teacher" | "parent" | "student"
attendance_status: "present" | "absent" | "late" | "excused"
ledger_category: "tuition" | "late_pickup" | "activity" | "other"
ledger_kind: "charge" | "payment"
@@ -858,7 +1020,7 @@ export const Constants = {
},
public: {
Enums: {
app_role: ["admin", "teacher", "parent"],
app_role: ["admin", "teacher", "parent", "student"],
attendance_status: ["present", "absent", "late", "excused"],
ledger_category: ["tuition", "late_pickup", "activity", "other"],
ledger_kind: ["charge", "payment"],