From 79c22ae7c201f18b9b8e91919b2e47b5eace5509 Mon Sep 17 00:00:00 2001 From: Julian Vennen Date: Wed, 15 Jan 2025 12:46:10 +0100 Subject: [PATCH] Add user id to Project Members --- .../main/java/io/papermc/hangar/db/dao/v1/ProjectsApiDAO.java | 4 ++-- .../io/papermc/hangar/model/api/project/ProjectMember.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/papermc/hangar/db/dao/v1/ProjectsApiDAO.java b/backend/src/main/java/io/papermc/hangar/db/dao/v1/ProjectsApiDAO.java index acf48431b..6030a3f78 100644 --- a/backend/src/main/java/io/papermc/hangar/db/dao/v1/ProjectsApiDAO.java +++ b/backend/src/main/java/io/papermc/hangar/db/dao/v1/ProjectsApiDAO.java @@ -132,12 +132,12 @@ SELECT count(hp.id) @RegisterConstructorMapper(ProjectMember.class) @RegisterColumnMapperFactory(CompactRoleColumnMapperFactory.class) - @SqlQuery("SELECT u.name AS \"user\", array_agg(r.name) roles " + + @SqlQuery("SELECT u.name AS \"user\", u.id AS \"userId\", array_agg(r.name) roles " + " FROM user_project_roles upr" + " JOIN users u ON upr.user_id = u.id " + " JOIN roles r ON upr.role_type = r.name " + " WHERE upr.project_id = :id " + - " GROUP BY u.name ORDER BY max(r.permission::bigint) DESC " + + " GROUP BY u.name, u.id ORDER BY max(r.permission::bigint) DESC " + " ") List getProjectMembers(long id, @BindPagination RequestPagination pagination); diff --git a/backend/src/main/java/io/papermc/hangar/model/api/project/ProjectMember.java b/backend/src/main/java/io/papermc/hangar/model/api/project/ProjectMember.java index bf95a4615..850285177 100644 --- a/backend/src/main/java/io/papermc/hangar/model/api/project/ProjectMember.java +++ b/backend/src/main/java/io/papermc/hangar/model/api/project/ProjectMember.java @@ -3,5 +3,5 @@ import io.papermc.hangar.model.common.roles.CompactRole; import java.util.List; -public record ProjectMember(String user, List roles) { +public record ProjectMember(String user, long userId, List roles) { }