-
Notifications
You must be signed in to change notification settings - Fork 4
Add thread schema #214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add thread schema #214
Conversation
WalkthroughThe changes update the Changes
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm error Exit handler never called! ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
__tests__/unit/models/thread.model.test.ts (2)
43-45
: Prefer explicit undefined checks over non-null assertion in testsUsing
thread.thread_metadata!.auto_archive_duration = 999
compiles, but it sidesteps the very runtime uncertainty that made the field optional.
A clearer pattern is:if (thread.thread_metadata) { thread.thread_metadata.auto_archive_duration = 999; }The test will still fail as intended if
thread_metadata
is unexpectedlyundefined
, giving you a signal instead of silently passing compilation.
74-76
: Same comment as above applies toinvitable
mutationConsider guarding with an explicit check rather than using
!
.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
__tests__/unit/models/thread.model.test.ts
(2 hunks)src/interfaces/Thread.interface.ts
(1 hunks)
🔇 Additional comments (1)
src/interfaces/Thread.interface.ts (1)
38-41
: Check downstream expectations before loosening these fields
parent_id
,owner_id
,name
, andthread_metadata
are now optional. All validation, persistence, and serialization layers that previously assumed these keys were always present must tolerateundefined
or supply sensible fall-backs.
In particular, the Mongoose schema (and any DB indexes) may still declare them asrequired
, which would make the typings lie to the rest of the codebase.Please audit:
- The
Thread
model schema (src/models/thread.model.ts
?) – ensure.required()
flags are removed or kept in sync.- All code that does
thread.parent_id!
,thread.thread_metadata!.…
etc. outside of tests.- Business rules that rely on
name
always existing (e.g. duplicate-name checks).If any of these assumptions remain, keep the properties required or add explicit runtime guards.
Also applies to: 45-45
Summary by CodeRabbit
Refactor
Tests