Skip to content

Elsa/260511 fix description#114

Merged
NicolasCARPi merged 4 commits into
masterfrom
elsa/260511-fix-description
May 12, 2026
Merged

Elsa/260511 fix description#114
NicolasCARPi merged 4 commits into
masterfrom
elsa/260511-fix-description

Conversation

@eltouma
Copy link
Copy Markdown
Collaborator

@eltouma eltouma commented May 12, 2026

The description column can be NULL . During production deployment, scanning this nullable value into a Go string caused the error: name "description": converting NULL to string is unsupported

To handle nullable descriptions correctly, Description is now using sql.NullString instead of string.

This allows the code to handle descriptions that are either text or NULL.

doc: NullString

Summary by CodeRabbit

  • Refactor

    • Improved description handling across the app to support nullable descriptions, ensuring consistent behavior for create, update, browse, and history views.
  • Bug Fixes

    • Fixed rendering and validation of record descriptions in edit and display pages so empty/absent descriptions behave correctly.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: ca425780-701d-484c-a83a-2e53cb63c90f

📥 Commits

Reviewing files that changed from the base of the PR and between 27732a7 and ab7e83c.

📒 Files selected for processing (1)
  • src/record_handler.go

📝 Walkthrough

Walkthrough

The PR converts description fields from string to sql.NullString across the codebase. Models (Record, RecordHistory, PendingItem), handlers (CreateRecord, UpdateRecord, browse API), and templates are updated to handle nullable descriptions while preserving JSON tags.

Changes

Nullable Description Field Migration

Layer / File(s) Summary
Data model struct definitions
src/model.go, src/moderation.go
Record.Description, RecordHistory.Description, and PendingItem.Description are changed from string to sql.NullString; database/sql import is added.
Handler record creation, updating, and API response
src/record_handler.go
CreateRecord and UpdateRecord validate description length with descriptionMaxLength and wrap submitted descriptions as sql.NullString (Valid set when non-empty); BrowseRecordShort and browse responses now use sql.NullString; supporting imports and minor formatting/validation renames updated.
Template display of nullable description
src/templates/edit.html, src/templates/record.html
Templates access description values using the .String property of sql.NullString for display and editing.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nibble at strings and tuck them neat,
Into SQL's pockets, small and sweet,
Templates sip .String from a cozy bed,
Handlers pack Valid when words are said,
A rabbit's hop—safe nulls ahead!


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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

@eltouma eltouma marked this pull request as draft May 12, 2026 10:58
@eltouma eltouma marked this pull request as ready for review May 12, 2026 11:01
@eltouma eltouma requested a review from NicolasCARPi May 12, 2026 11:01
Comment thread src/record_handler.go Outdated
@eltouma eltouma requested a review from NicolasCARPi May 12, 2026 12:12
Copy link
Copy Markdown
Member

@NicolasCARPi NicolasCARPi left a comment

Choose a reason for hiding this comment

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

👍

@NicolasCARPi NicolasCARPi merged commit cc9c6a6 into master May 12, 2026
3 checks passed
@NicolasCARPi NicolasCARPi deleted the elsa/260511-fix-description branch May 12, 2026 14:56
NicolasCARPi added a commit that referenced this pull request May 12, 2026
* master:
  bug/critical: fix description field (#114)
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.

2 participants