Skip to content

fix: allow clearing event description via PATCH#149

Merged
rotarymars merged 4 commits into
mainfrom
fix/event-description-clear
May 4, 2026
Merged

fix: allow clearing event description via PATCH#149
rotarymars merged 4 commits into
mainfrom
fix/event-description-clear

Conversation

@rotarymars
Copy link
Copy Markdown
Member

@rotarymars rotarymars commented Mar 8, 2026

Description

Created a feature that allows clearing event details.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 📝 Documentation update
  • 🎨 Style/UI change
  • ♻️ Refactor (no functional changes)
  • 🔧 Configuration change

Changes Made

  • Look at the code

Testing

  • Tested locally with npm run dev
  • Build passes (npm run build)
  • Lint passes (npm run lint)

Screenshots (if applicable)

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code where necessary
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Related Issues

Summary by CodeRabbit

  • Bug Fixes
    • Event description updates now respect the client's intent: sending description as null clears it, omitting description leaves it unchanged, and other fields (title, date, time, location) update without accidentally overwriting the description.

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
kss-it-committee-github-io Ready Ready Preview, Comment Apr 1, 2026 2:49pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 31563161-4679-4c47-a7b0-9fb15e7a0e58

📥 Commits

Reviewing files that changed from the base of the PR and between 253d5a6 and b11c309.

📒 Files selected for processing (2)
  • src/app/api/events/[id]/route.ts
  • src/lib/db.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/lib/db.ts
  • src/app/api/events/[id]/route.ts

📝 Walkthrough

Walkthrough

The API PATCH handler now conditionally includes description in the update payload only if present in the request body (allowing explicit null). The DB update uses a CASE expression to write the provided value (or NULL) when present, otherwise leaves the existing description unchanged.

Changes

Cohort / File(s) Summary
API Route & DB Update
src/app/api/events/[id]/route.ts, src/lib/db.ts
PATCH handler builds updateData that includes description only when "description" in body; database eventQueries.update uses a CASE to set description to the provided value (or SQL NULL) if present, or keep the current value when omitted.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant API as Server (PATCH /events/:id)
    participant DB as Database

    Client->>API: PATCH /events/:id\n{ title, ..., description? }
    API->>API: Build updateData\ninclude description only if key present
    API->>DB: UPDATE events SET ...,\ndescription = CASE WHEN $hasDescription THEN $valueOrNull ELSE description END
    DB-->>API: OK / updated row
    API-->>Client: 200 OK / updated event
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nibbled the patch, tidy and neat,
If you send no words, old text stays complete,
Send null and I'll clear it, send a line and it stays—
Hop, hop, precise updates in careful ways! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: allow clearing event description via PATCH' directly and clearly describes the main change: enabling the ability to clear (set to null) the event description field through a PATCH request.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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/event-description-clear

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 and usage tips.

K10-K10
K10-K10 previously approved these changes Mar 25, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/lib/db.ts`:
- Around line 624-635: Rename the boolean variable descriptionProvided to use
the required boolean prefix (e.g., isDescriptionProvided) and update all its
usages in the SQL update logic accordingly; specifically change the variable
declaration currently using descriptionProvided (which checks data.description
!== undefined) to isDescriptionProvided and replace the reference inside the
CASE expression (WHEN ${descriptionProvided} THEN ...) so the name matches
everywhere (also update any other references in this module that rely on
descriptionProvided).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7554ce1a-56f5-4fdf-93c6-36ccd3a3e387

📥 Commits

Reviewing files that changed from the base of the PR and between b32c4cd and 253d5a6.

📒 Files selected for processing (2)
  • src/app/api/events/[id]/route.ts
  • src/lib/db.ts

Comment thread src/lib/db.ts
@rotarymars rotarymars merged commit 3e08265 into main May 4, 2026
19 checks passed
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.

7 participants