Skip to content

prepare user grouping#161

Merged
SteRiccio merged 4 commits into
masterfrom
feat/user-grouping
Jul 16, 2026
Merged

prepare user grouping#161
SteRiccio merged 4 commits into
masterfrom
feat/user-grouping

Conversation

@SteRiccio

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

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 the first end-to-end “user grouping” feature slice: new DB tables + repository functions, a server-side service, and survey-scoped REST endpoints to create/read/update/delete groups and manage members, along with an authorization middleware hook.

Changes:

  • Added user_group / user_group_user tables via db-migrator migration, plus corresponding DB table classes and exports.
  • Implemented UserGroupRepository (CRUD + membership ops) and UserGroupServiceServer, then registered it in the Arena server service registry.
  • Added UserGroupApi endpoints and a new requireUserGroupManagePermission middleware guard.

Reviewed changes

Copilot reviewed 32 out of 32 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/service/userGroup/index.ts Adds UserGroupService interface + server implementation delegating to repository
src/service/index.ts Re-exports user group service type/server
src/server/arenaServer/serverServiceType.ts Adds userGroup service type
src/server/arenaServer/registerServices.ts Registers UserGroupServiceServer in the service registry
src/repository/userGroup/update.ts Implements full props replace and partial props merge updates
src/repository/userGroup/types.ts Defines UserGroup domain types
src/repository/userGroup/read.ts Adds count/list/get-by-uuid queries
src/repository/userGroup/members.ts Adds add/remove/list group members queries
src/repository/userGroup/insert.ts Adds insert logic for user groups
src/repository/userGroup/index.ts Repository barrel export + type exports
src/repository/userGroup/getUserGroupsByUser.ts Adds “list groups by user” query
src/repository/userGroup/delete.ts Adds delete-by-uuid with returning
src/repository/index.ts Exposes UserGroupRepository + user group types
src/index.ts Exposes TableUserGroup and TableUserGroupUser from top-level entry
src/db/table/schemaPublic/userGroupUser.ts Defines user_group_user table mapping
src/db/table/schemaPublic/userGroup.ts Defines user_group table mapping
src/db/table/schemaPublic/index.ts Re-exports the new table classes
src/db/table/index.ts Re-exports the new table classes via db table barrel
src/db/index.ts Re-exports the new table classes via db barrel
src/db/dbMigrator/migration/public/migrations/sqls/20260713124754-create-user-group-tables-up.sql Creates user_group / user_group_user tables and indexes
src/db/dbMigrator/migration/public/migrations/sqls/20260713124754-create-user-group-tables-down.sql Drops the two user-group tables
src/db/dbMigrator/migration/public/migrations/20260713124754-create-user-group-tables.js db-migrator JS wrapper for the migration SQL
src/api/userGroup/update.ts Adds PUT endpoint to update group props
src/api/userGroup/read.ts Adds GET endpoints for count/list/get group/get members
src/api/userGroup/index.ts Wires user group route initializers
src/api/userGroup/delete.ts Adds DELETE group and DELETE member endpoints
src/api/userGroup/create.ts Adds POST group and POST add-member endpoints
src/api/middleware/auth.ts Adds requireUserGroupManagePermission (survey-admin-only)
src/api/endpoint/userGroup.ts Defines user-group endpoint path builders
src/api/endpoint/index.ts Exposes userGroup endpoints in the endpoint registry
src/api/api.ts Registers UserGroupApi into the main API initializer
Comments suppressed due to low confidence (2)

src/api/userGroup/read.ts:84

  • This endpoint ignores surveyId and returns group members by groupUuid alone. Because authorization is based on surveyId, a user with view permission on one survey could retrieve members of a group from another survey if they know the UUID. Resolve surveyUuid from surveyId and ensure the group belongs to that survey before returning members.
}

src/api/userGroup/create.ts:55

  • This handler authorizes based on surveyId but adds a member to a group by UUID without verifying the group belongs to that survey. A survey admin could add members to a group in another survey if they know the UUID. Resolve surveyUuid from surveyId and validate the group before calling addMember.
    )
  },
}


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

Comment thread src/api/userGroup/update.ts Outdated
Comment thread src/api/userGroup/read.ts Outdated
Comment thread src/api/userGroup/delete.ts Outdated
Comment thread src/api/userGroup/delete.ts Outdated
@sonarqubecloud

Copy link
Copy Markdown

@SteRiccio
SteRiccio merged commit 19c555b into master Jul 16, 2026
6 checks passed
@SteRiccio
SteRiccio deleted the feat/user-grouping branch July 16, 2026 07:54
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