Skip to content

feat: option to hide groups from search#32

Merged
toto04 merged 7 commits intomainfrom
hide-column-groups
Apr 11, 2026
Merged

feat: option to hide groups from search#32
toto04 merged 7 commits intomainfrom
hide-column-groups

Conversation

@lorenzocorallo
Copy link
Copy Markdown
Member

No description provided.

@lorenzocorallo lorenzocorallo requested a review from toto04 April 11, 2026 20:47
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 11, 2026

Warning

Rate limit exceeded

@lorenzocorallo has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 10 minutes and 30 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 10 minutes and 30 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f50a456d-9886-408a-9391-334b20ced666

📥 Commits

Reviewing files that changed from the base of the PR and between 6f237e7 and 3b9d3be.

📒 Files selected for processing (5)
  • drizzle/0011_yellow_silver_samurai.sql
  • drizzle/meta/0011_snapshot.json
  • drizzle/meta/_journal.json
  • src/db/schema/tg/groups.ts
  • src/routers/tg/groups.ts

Walkthrough

Version bumped to 0.15.10. Added a hide boolean column (default false) to the tg groups schema, updated search to exclude hidden groups, and added a setHide TRPC mutation to toggle group visibility.

Changes

Cohort / File(s) Summary
Version Updates
package.json, package/package.json
Bumped package version from 0.15.90.15.10.
Groups Schema & Migration
src/db/schema/tg/groups.ts, drizzle/0010_brave_marvel_apes.sql
Added hide boolean column to tg_groups with default false and corresponding SQL migration.
API / Router
src/routers/tg/groups.ts
Updated search filter to exclude hidden groups (not(GROUPS.hide)) and added setHide mutation ({ telegramId, hide }) updating GROUPS.hide.
Drizzle Metadata
drizzle/meta/0010_snapshot.json, drizzle/meta/_journal.json
Added snapshot capturing new schema and appended migration journal entry (idx: 10, version: "7", tag 0010_brave_marvel_apes).

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Client as Client
participant API as TRPC API
participant Router as groups.router
participant DB as Database
Client->>API: search(query)
API->>Router: invoke search procedure
Router->>DB: SELECT ... WHERE (title ILIKE OR tags ILIKE) AND NOT hide
DB-->>Router: rows
Router-->>API: results
API-->>Client: results
Client->>API: setHide({telegramId, hide})
API->>Router: invoke setHide mutation
Router->>DB: UPDATE tg_groups SET hide = $hide WHERE telegram_id = $telegramId RETURNING *
DB-->>Router: updated row(s)
Router-->>API: boolean (rows.length === 1)
API-->>Client: success/failure

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: option to hide groups from search' directly aligns with the main changes: adding a hide column to the groups table, implementing a setHide mutation, updating search logic to exclude hidden groups, and creating the necessary database migration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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


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.

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: 2

🧹 Nitpick comments (1)
src/routers/tg/groups.ts (1)

126-140: Add explicit output schema for mutation consistency.

setHide returns a boolean but doesn’t declare .output(z.boolean()) like delete. Adding it keeps contracts explicit and safer for clients.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/routers/tg/groups.ts` around lines 126 - 140, The setHide mutation
currently returns a boolean but lacks an explicit output schema; update the
procedure chain for setHide (the publicProcedure declaration) to include
.output(z.boolean())—mirroring how delete declares its output—so the procedure
signature explicitly declares it returns a boolean before the .mutation handler.
🤖 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/db/schema/tg/groups.ts`:
- Line 10: The column "hide" is currently nullable which causes SQL
three-valued-logic issues with filters using not(GROUPS.hide); update the schema
definition for the "hide" column in the groups table to be non-nullable (default
false AND NOT NULL) and modify the migration 0010_brave_marvel_apes.sql to
alter/create the column with NOT NULL (and ensure existing NULLs are backfilled
to false before adding the constraint). Update any schema symbol references
(hide, GROUPS.hide) to reflect the non-nullable boolean and include a safe
migration step: backfill NULL -> false, add NOT NULL constraint, then set
default false.

In `@src/routers/tg/groups.ts`:
- Around line 126-140: setHide is currently exposed as publicProcedure allowing
unauthenticated callers to change group visibility; replace publicProcedure with
your authenticated/authorized wrapper (e.g., protectedProcedure or
adminProcedure) and add an authorization check inside the mutation to ensure the
caller is allowed to update the group (verify session user ownership or admin
rights against the GROUPS.telegramId) before running DB.update(GROUPS). Keep the
same input and return behavior but reject unauthorized requests (throw/return an
error) so only authenticated/authorized users can toggle hide.

---

Nitpick comments:
In `@src/routers/tg/groups.ts`:
- Around line 126-140: The setHide mutation currently returns a boolean but
lacks an explicit output schema; update the procedure chain for setHide (the
publicProcedure declaration) to include .output(z.boolean())—mirroring how
delete declares its output—so the procedure signature explicitly declares it
returns a boolean before the .mutation handler.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2e92016d-6466-45e7-8c06-d2cc3c710e96

📥 Commits

Reviewing files that changed from the base of the PR and between 47e5b69 and 7864bcd.

📒 Files selected for processing (4)
  • package.json
  • package/package.json
  • src/db/schema/tg/groups.ts
  • src/routers/tg/groups.ts

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 `@drizzle/meta/0010_snapshot.json`:
- Around line 736-742: Change the "hide" column to be non-nullable in the schema
snapshot by setting its "notNull" property to true (keeping "type": "boolean"
and "default": false) and add a migration that first updates existing NULL
values to false (UPDATE ... SET hide = false WHERE hide IS NULL) and then alters
the column to NOT NULL (ALTER TABLE ... ALTER COLUMN hide SET NOT NULL); ensure
the migration targets the same table/column name referenced as "hide" so the
snapshot and DB remain consistent.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a1c7b332-0f29-4907-8015-abb674a2e675

📥 Commits

Reviewing files that changed from the base of the PR and between 7864bcd and 6f237e7.

📒 Files selected for processing (3)
  • drizzle/0010_brave_marvel_apes.sql
  • drizzle/meta/0010_snapshot.json
  • drizzle/meta/_journal.json
✅ Files skipped from review due to trivial changes (2)
  • drizzle/0010_brave_marvel_apes.sql
  • drizzle/meta/_journal.json

@toto04 toto04 merged commit 69883cd into main Apr 11, 2026
2 checks passed
@lorenzocorallo lorenzocorallo deleted the hide-column-groups branch April 11, 2026 21:18
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