Round 13b: Report Scheduling, Multi-School District Support

This commit is contained in:
Mustafa Cetin committed 2026-07-29 10:39:24 +00:00
1 parent ff4dd670d4
commit d325984786
4 files changed
+27 -3

No files matched your search

-1
View File
@@ -12,7 +12,6 @@ export async function GET(
where: { id, deletedAt: null }, where: { id, deletedAt: null },
include: { include: {
schools: { schools: {
where: { deletedAt: null },
select: { select: {
id: true, id: true,
name: true, name: true,
+1 -1
View File
@@ -17,7 +17,7 @@ export async function GET(
} }
const schools = await db.school.findMany({ const schools = await db.school.findMany({
where: { districtId: id, deletedAt: null }, where: { districtId: id },
include: { include: {
_count: { _count: {
select: { students: true, classGroups: true, users: true }, select: { students: true, classGroups: true, users: true },
-1
View File
@@ -8,7 +8,6 @@ export async function GET() {
where: { deletedAt: null }, where: { deletedAt: null },
include: { include: {
schools: { schools: {
where: { deletedAt: null },
select: { id: true, name: true, schoolType: true, country: true }, select: { id: true, name: true, schoolType: true, country: true },
}, },
}, },
+26
View File
@@ -1,5 +1,31 @@
# CompetenceTrack — Project Worklog # CompetenceTrack — Project Worklog
---
Task ID: 14
Agent: reports-scheduling-multi-school
Task: Report Scheduling + Multi-School District Support
Work Log:
- Verified existing ReportSchedule Prisma model (already present in schema with all required fields: schoolId, classGroupId, template, frequency, dayOfWeek, dayOfMonth, monthOfYear, recipients, includeStudents, includeGrades, includeAttendance, includeBehavior, includeCompetencies, isActive, lastRunAt, nextRunAt, isDemo, deletedAt)
- Verified SchoolDistrict Prisma model (already present with name, code, region, country, adminEmail, isActive, deletedAt)
- Verified School model has districtId and district relation to SchoolDistrict
- Verified ClassGroup model has reportSchedules relation to ReportSchedule
- Verified API routes for report-schedules: GET/POST /api/report-schedules, GET/PUT/DELETE /api/report-schedules/[id], POST /api/report-schedules/[id]/run
- Verified API routes for districts: GET/POST /api/districts, GET/PUT/DELETE /api/districts/[id], GET/POST /api/districts/[id]/schools
- Fixed districts API routes: removed `deletedAt: null` filter on School model (School model has no deletedAt field) in districts/route.ts, districts/[id]/route.ts, and districts/[id]/schools/route.ts
- Verified reports-view.tsx has complete Schedules tab with: create/edit dialog, frequency/class/template selection, include options checkboxes, schedule list with status/next run/toggle, manual trigger button, delete confirmation, visual timeline with progress bars
- Verified settings-view.tsx has complete District tab (SUPER_ADMIN only) with: district CRUD, school assignment, cross-school comparison, district create/edit dialog, delete confirmation
- Verified API client functions in src/lib/api.ts: fetchReportSchedules, createReportSchedule, updateReportSchedule, deleteReportSchedule, runReportSchedule, fetchDistricts, createDistrict, updateDistrict, deleteDistrict, fetchDistrictSchools, assignSchoolToDistrict
- Verified i18n keys for both schedules and district in DE and EN (35+ keys each)
- Ran bun run lint: no errors
- Ran bun run db:push: schema already in sync
Stage Summary:
- All Report Scheduling features already implemented from previous agent: Prisma model, API routes, UI with Schedules tab, i18n keys
- All Multi-School District Support features already implemented from previous agent: Prisma model, API routes, UI with District tab, i18n keys
- Bug fix: removed invalid `deletedAt: null` filter on School model in 3 district API route files
- Current status: Round 13 complete
--- ---
Task ID: 12 Task ID: 12
Agent: behavior-audit Agent: behavior-audit