fix(backend): remove @ts-nocheck from audit and student route modules - #1038
Merged
ayomideadeniran merged 2 commits intoAug 3, 2026
Merged
Conversation
Closes StellarDevHub#919 ## What changed ### src/types/student.types.ts (new) - Add Zod schemas: CreateStudentSchema, UpdateStudentSchema, StudentIdParamSchema - Export inferred TypeScript types: CreateStudentBody, UpdateStudentBody, StudentIdParam - Add StudentAuditDetails interface for typed audit detail payloads ### src/utils/audit.ts - Remove // @ts-nocheck suppression - Replace `as any` cast with AuditDetailsRecord interface + Object.assign - Narrow req.body via BodyWithOptionalEmail interface - Narrow req.user via AuthenticatedUser interface - Use nullish coalescing (??) consistently ### src/routes/students.ts - Remove // @ts-nocheck suppression - Add typed Request<Params, ResBody, Body> generics on every handler - Add parseBody() helper for centralised Zod validation with structured { field, message }[] error responses (400) - Explicitly type the updateData object — no implicit any - Replace all console.error calls with logger.error; include studentId context but never email (PII redaction) - Handlers return Promise<void> — no implicit any return type ### tests/students.routes.test.ts (new, 19 tests) - Success and error paths for GET /, GET /:id, POST /, PUT /:id, DELETE /:id - Validation failure paths: missing fields, invalid email, invalid DID - 500 paths assert structured logger is called with correct context - PII-redaction assertion: email never appears in error log metadata - DID sync and cache-invalidation side-effects verified ## Verification - tsc --noEmit: zero errors in target files - 19 new tests pass; 2 pre-existing auditAction tests still pass
|
@Zinai10 is attempting to deploy a commit to the Ayomide Adeniran's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Zinai10 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
pr under review |
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.
Closes #919
What changed
src/types/student.types.ts (new)
src/utils/audit.ts
as anycast with AuditDetailsRecord interface + Object.assignsrc/routes/students.ts
tests/students.routes.test.ts (new, 19 tests)
Verification