Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for requiring and storing a teacher-provided rejection explanation when an appointment/lesson is rejected, and surfaces that reason to students in the UI.
Changes:
- Adds
rejectionReasonto appointment types, DB schema, and API formatting. - Adds server/client-side validation enforcing a 100–500 character rejection reason when status is
rejected. - Adds a teacher-side “Reject Appointment” modal for entering the reason and a student-side display of the rejection reason.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| server/src/validation/appointment/rejectionReasonValidation.ts | Introduces reusable rejection-reason validation (currently not wired in). |
| server/src/validation/appointment/appointmentValidationMiddleware.ts | Adds request validation for rejectionReason when rejecting. |
| server/src/types/appointment/appointment.types.ts | Extends update-status payload type with optional rejectionReason. |
| server/src/services/appointment/appointment.service.ts | Enforces rejection-reason rules in service layer and includes it in formatted response. |
| server/src/db/schemes/types/appointment.types.ts | Adds rejectionReason to DB appointment type. |
| server/src/db/schemes/appointmentSchema.ts | Adds rejectionReason field to Mongoose schema. |
| client/src/types/appointments.types.ts | Adds rejectionReason to client appointment type. |
| client/src/pages/privetTeachersPages/teacherAppointments/TeacherAppointments.tsx | Opens a reject modal when teacher selects “rejected”. |
| client/src/features/appointments/mutations/useUpdateAppointmentMutation.ts | Sends rejectionReason with status update when provided. |
| client/src/components/ui/statusButtons/StatusButtons.tsx | Avoids locally setting status to rejected (delegates rejection flow to parent/modal). |
| client/src/components/appointmentCard/RejectionReasonDisplay.tsx | Displays rejection reason on appointment card when status is rejected. |
| client/src/components/appointmentCard/RejectAppointmentModal.tsx | New modal to collect and validate rejection reason and submit rejection. |
| client/src/components/appointmentCard/AppointmentCard.tsx | Renders rejection reason display section. |
Comments suppressed due to low confidence (1)
server/src/services/appointment/appointment.service.ts:133
updateDataspreads the incoming payload, so if an appointment was previously rejected and then later moved to another status without providingrejectionReason, the old reason may remain stored. Consider explicitly clearingrejectionReasonwhenstatus !== "rejected"to prevent stale data from persisting.
const updateData = {
...data,
updatedAt: new Date(),
};
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Dmytro-Doronin
approved these changes
Mar 9, 2026
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.
added feat: teacher need write explanation why reject lesson


Teacher:
Student: