Repository navigation
feat(TeacherPresentation): Add API endpoints for config - #362
Open
hirokiterashima wants to merge 5 commits into
Open
hirokiterashima wants to merge 5 commits into
hirokiterashima wants to merge 5 commits into
Conversation
… handling and configuration methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Notes
If WISE-API doesn't start up for you, it might be a flyway database issue. (you might already have a V2 from reviewing email_verification, which has not been merged yet). Try removing the row from the
flyway_schema_historytable (delete from flyway_schema_history where version = 2;) and restart WISE-API.Summary
Adds backend persistence and REST APIs for the TeacherPresentation feature. This allows teachers to configure and save which student work items (e.g. discussion posts and comments) should be presented to the classroom, configure student name display settings (
show,hide,anonymize), and specify an optional customized presentation prompt for each run, period, and component.(Note: Teacher reflection questions have been decoupled from this feature and will be implemented in a dedicated standalone feature branch).
Changes
1. Database Migration
V2__create_teacher_presentation_tables.sql:teacher_presentation_configtable:id(bigint auto-increment).runIdreferencesruns(id),periodIdreferences`groups`(id),updatedByWorkgroupIdreferencesworkgroups(id).(runId, periodId, nodeId, componentId).componentType(varchar),items(text storing JSON array ofstudentWorkIds),studentNamesDisplay(varchar, default'hide'),prompt(text),createdAtandupdatedAt.2. Domain Model & Entities
org.wise.vle.domain.teacherpresentation.TeacherPresentationConfig:teacher_presentation_config.NAMES_SHOW,NAMES_HIDE, andNAMES_ANONYMIZE.3. DAO Layer
TeacherPresentationConfigDaoandHibernateTeacherPresentationConfigDao:getConfig(run, period, nodeId, componentId): Retrieves the saved presentation config for a given component and period.AbstractHibernateDao<TeacherPresentationConfig>for standard CRUD operations.4. Service Layer
TeacherPresentationConfigServiceandTeacherPresentationConfigServiceImpl:getConfig(...): Fetches presentation configuration.getStudentWorkIds(config): Deserializes the JSONitemsarray into student work IDs.saveConfig(...): Validates input parameters (validatesstudentNamesDisplay, prompt length <= 1000, max 500 items, and verifies allstudentWorkIds belong to the target run and period), deduplicates IDs, and persists configuration with the teacher's workgroup and timestamp.5. Controller & REST Endpoints
TeacherPresentationConfigAPIController(/api/teacher/presentation-config):ROLE_TEACHERand verifies teacher permissions against the run.GET /api/teacher/presentation-config: Fetches presentation config forrunId,periodId,nodeId, andcomponentId. Returns default values (studentNamesDisplay: 'hide', empty items) if none has been saved yet.PUT /api/teacher/presentation-config: Saves or updates presentation config.Testing & Verification
HibernateTeacherPresentationConfigDaoTest: Verifies persistence, unique key constraints, retrieval, and deletion.TeacherPresentationConfigServiceImplTest: Verifies validation (max items, prompt length, invalid student names display, cross-period/cross-run student work validation, item deduplication, and defaults).TeacherPresentationConfigAPIControllerTest: Verifies authorization, permission checks, bad request handling, and response serialization../mvnw test -Dtest="TeacherPresentation*Test"-> 17 tests run, 0 failures, 0 errors.How to Test
Test with WISE-Community/WISE-Client#2351. See testing instructions there.
Database migration should occur automatically (via Flyway) when you restart WISE-API.