Skip to content

feat: collection management#1726

Merged
gaspergrom merged 2 commits intomainfrom
feat/collection-management
Mar 9, 2026
Merged

feat: collection management#1726
gaspergrom merged 2 commits intomainfrom
feat/collection-management

Conversation

@gaspergrom
Copy link
Collaborator

No description provided.

Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
@gaspergrom gaspergrom requested review from epipav and joanagmaia March 6, 2026 09:26
@gaspergrom gaspergrom self-assigned this Mar 6, 2026
Copilot AI review requested due to automatic review settings March 6, 2026 09:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces community collection management backed by the CM database, migrating collection read endpoints away from Tinybird and adding authenticated CRUD endpoints for a user’s own collections.

Changes:

  • Enable CM DB usage via runtime config and wire CM DB pool into /api/collection* requests.
  • Replace Tinybird-backed /api/collection and /api/collection/:slug with CM DB queries.
  • Add repositories + new authenticated endpoints to create/update/delete/list a user’s community collections.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
frontend/setup/runtime-config.ts Makes CM DB enablement configurable via NUXT_CM_DB_ENABLED (still always on in prod).
frontend/setup/caching.ts Disables caching for community collection management endpoints.
frontend/server/utils/common.ts Adds a shared generateSlug() helper using slugify.
frontend/server/repo/insightsSsoUser.repo.ts New CM DB repository to upsert/look up SSO users.
frontend/server/repo/communityCollection.repo.ts New CM DB repository implementing collection CRUD and list/detail queries.
frontend/server/middleware/jwt-auth.ts Protects /api/collection/community* routes with JWT auth.
frontend/server/middleware/database.ts Injects DB pools for /api/collection* routes.
frontend/server/api/collection/index.ts Migrates collection listing from Tinybird to CM DB repository query.
frontend/server/api/collection/community/my.get.ts Adds “my collections” endpoint for authenticated user.
frontend/server/api/collection/community/index.post.ts Adds authenticated endpoint to create a community collection.
frontend/server/api/collection/community/[id].put.ts Adds authenticated endpoint to update a community collection.
frontend/server/api/collection/community/[id].delete.ts Adds authenticated endpoint to soft-delete a community collection.
frontend/server/api/collection/[slug].ts Migrates collection detail-by-slug from Tinybird to CM DB.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +65 to +71
const repo = new CommunityCollectionRepository(cmDbPool);
return await repo.update(id, ssoUser.id, {
name: body.name?.trim(),
description: body.description?.trim(),
isPrivate: body.isPrivate,
projects: body.projects,
});
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

When updating, name: body.name?.trim() will turn a whitespace-only value into an empty string, which then updates the collection name/slug to ''. If name is provided, validate it after trimming (non-empty), or treat empty/whitespace-only input as "no update" (i.e. undefined).

Copilot uses AI. Check for mistakes.
@gaspergrom gaspergrom requested a review from emlimlf March 6, 2026 09:33
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
@gaspergrom gaspergrom requested a review from joanagmaia March 6, 2026 15:15
Copy link
Collaborator

@joanagmaia joanagmaia left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@gaspergrom gaspergrom merged commit 4a248cd into main Mar 9, 2026
9 checks passed
@gaspergrom gaspergrom deleted the feat/collection-management branch March 9, 2026 05:03
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.

4 participants