feat(parent): add attention banner, export button, and grade detail
- Add parent-attention-banner for highlighting items needing attention - Add parent-export-button for data export capability - Add child-grade-detail component for detailed grade viewing - Update existing child-card, child-detail-header, child-grade-summary, child-schedule-card - Update parent-children-data-page and data-access
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import "server-only"
|
||||
|
||||
import { cache } from "react"
|
||||
import { and, asc, eq } from "drizzle-orm"
|
||||
import { and, asc, eq, inArray } from "drizzle-orm"
|
||||
|
||||
import { db } from "@/shared/db"
|
||||
import { parentStudentRelations } from "@/shared/db/schema"
|
||||
@@ -267,3 +267,19 @@ export const getChildNameList = cache(
|
||||
}))
|
||||
},
|
||||
)
|
||||
|
||||
/**
|
||||
* v4-P1-5: 批量查询多个学生的家长 userId 列表。
|
||||
* 用于通知场景:报告/成绩发布时同步通知所有相关家长。
|
||||
* 返回去重后的 parentId 数组。
|
||||
*/
|
||||
export const getParentIdsByStudentIds = cache(
|
||||
async (studentIds: string[]): Promise<string[]> => {
|
||||
if (studentIds.length === 0) return []
|
||||
const rows = await db
|
||||
.select({ parentId: parentStudentRelations.parentId })
|
||||
.from(parentStudentRelations)
|
||||
.where(inArray(parentStudentRelations.studentId, studentIds))
|
||||
return Array.from(new Set(rows.map((r) => r.parentId)))
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user