Skip to content

fix(subject): remove unique validation rule on subject name - #325

Merged
trtajim merged 1 commit into
mainfrom
fix/allow-duplicate-subject-names
Sep 8, 2026
Merged

fix(subject): remove unique validation rule on subject name#325
trtajim merged 1 commit into
mainfrom
fix/allow-duplicate-subject-names

Conversation

@trtajim

@trtajim trtajim commented Sep 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Removed the unique:subjects,name validation rule from StoreSubjectRequest and UpdateSubjectRequest.
  • Uniqueness is already guaranteed across courses by the slug field, which includes the course prefix.
  • Added feature tests covering subject creation with identical names across ssc and hsc courses.

Summary by CodeRabbit

  • Bug Fixes
    • Subjects can now share the same name across different courses.
    • Subject name validation continues to enforce required formatting and length rules.
    • Course-specific slugs remain unique and are generated correctly.

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 11c999ab-4e00-4c5f-980b-539b7749aca3

📥 Commits

Reviewing files that changed from the base of the PR and between d3d47ee and 964b614.

📒 Files selected for processing (3)
  • app/Http/Requests/Subject/StoreSubjectRequest.php
  • app/Http/Requests/Subject/UpdateSubjectRequest.php
  • tests/Feature/SubjectManagementTest.php

📝 Walkthrough

Walkthrough

Subject name validation no longer requires global uniqueness. A feature test verifies that the same name can exist in different courses and that the new subject receives a course-scoped slug.

Changes

Course-Scoped Subject Names

Layer / File(s) Summary
Relax name validation and verify duplicate names
app/Http/Requests/Subject/StoreSubjectRequest.php, app/Http/Requests/Subject/UpdateSubjectRequest.php, tests/Feature/SubjectManagementTest.php
Store and update requests remove subject-name uniqueness checks. The feature test confirms that duplicate names across courses are accepted and persisted with a course-scoped slug.

Estimated code review effort: 1 (Trivial) | ~5 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/allow-duplicate-subject-names

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@trtajim
trtajim merged commit f5f4f6f into main Sep 8, 2026
5 of 6 checks passed
@trtajim
trtajim deleted the fix/allow-duplicate-subject-names branch September 8, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant