lexicongovernance / pluraltools-backend

This repository contains the backend implementation for the plurality research project. The backend is responsible for handling various functionalities to support the plurality research platform.
GNU General Public License v3.0
3 stars 1 forks source link

Add lead author information to group members endpoint #398

Closed MartinBenediktBusch closed 1 month ago

MartinBenediktBusch commented 1 month ago
/**
 * Executes a query to retrieve the members of a group.

 * @param {PostgresJsDatabase<typeof db>} dbPool - The database connection pool.
 * @param {string} groupId - The ID of the user.
 */
export async function getGroupMembers(dbPool: PostgresJsDatabase<typeof db>, groupId: string) {
  const response = await dbPool.query.groups.findMany({
    where: eq(db.groups.id, groupId),
    with: {
      usersToGroups: {
        with: {
          user: true,
        },
      },
    },
  });