mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-02 03:29:03 +00:00
taskCount should show total count for openedBy or assignedTo a user (#15016)
This commit is contained in:
parent
f817921750
commit
87efc57394
@ -1189,18 +1189,37 @@ public interface CollectionDAO {
|
||||
@BindFQN("fqnPrefixHash") String fqnPrefixHash,
|
||||
@Bind("toType") String toType);
|
||||
|
||||
@SqlQuery(
|
||||
"SELECT te.type, te.taskStatus, COUNT(id) count FROM thread_entity te where "
|
||||
+ "(entityId in (SELECT toId FROM entity_relationship WHERE "
|
||||
+ "((fromEntity='user' AND fromId= :userId) OR "
|
||||
+ "(fromEntity='team' AND fromId IN (<teamIds>))) AND relation=8) OR "
|
||||
+ "id in (SELECT toId FROM entity_relationship WHERE (fromEntity='user' AND fromId= :userId AND toEntity='THREAD' AND relation IN (1,2))) "
|
||||
+ " OR id in (SELECT toId FROM entity_relationship WHERE ((fromEntity='user' AND fromId= :userId) OR "
|
||||
+ "(fromEntity='team' AND fromId IN (<teamIds>))) AND relation=11)) "
|
||||
+ "GROUP BY te.type, te.taskStatus")
|
||||
@ConnectionAwareSqlQuery(
|
||||
value =
|
||||
"SELECT te.type, te.taskStatus, COUNT(id) count FROM thread_entity te where "
|
||||
+ "(entityId in (SELECT toId FROM entity_relationship WHERE "
|
||||
+ "((fromEntity='user' AND fromId= :userId) OR "
|
||||
+ "(fromEntity='team' AND fromId IN (<teamIds>))) AND relation=8) OR "
|
||||
+ "id in (SELECT toId FROM entity_relationship WHERE (fromEntity='user' AND fromId= :userId AND toEntity='THREAD' AND relation IN (1,2))) "
|
||||
+ " OR id in (SELECT toId FROM entity_relationship WHERE ((fromEntity='user' AND fromId= :userId) OR "
|
||||
+ "(fromEntity='team' AND fromId IN (<teamIds>))) AND relation=11)) "
|
||||
+ " OR (taskAssignees @> ANY (ARRAY[<userTeamJsonPostgres>]::jsonb[]) OR createdBy = :username)"
|
||||
+ "GROUP BY te.type, te.taskStatus",
|
||||
connectionType = POSTGRES)
|
||||
@ConnectionAwareSqlQuery(
|
||||
value =
|
||||
"SELECT te.type, te.taskStatus, COUNT(id) count FROM thread_entity te where "
|
||||
+ "(entityId in (SELECT toId FROM entity_relationship WHERE "
|
||||
+ "((fromEntity='user' AND fromId= :userId) OR "
|
||||
+ "(fromEntity='team' AND fromId IN (<teamIds>))) AND relation=8) OR "
|
||||
+ "id in (SELECT toId FROM entity_relationship WHERE (fromEntity='user' AND fromId= :userId AND toEntity='THREAD' AND relation IN (1,2))) "
|
||||
+ " OR id in (SELECT toId FROM entity_relationship WHERE ((fromEntity='user' AND fromId= :userId) OR "
|
||||
+ "(fromEntity='team' AND fromId IN (<teamIds>))) AND relation=11)) OR "
|
||||
+ "(JSON_OVERLAPS(taskAssignees, :userTeamJsonMysql) OR createdBy = :username)"
|
||||
+ "GROUP BY te.type, te.taskStatus",
|
||||
connectionType = MYSQL)
|
||||
@RegisterRowMapper(OwnerCountFieldMapper.class)
|
||||
List<List<String>> listCountByOwner(
|
||||
@BindUUID("userId") UUID userId, @BindList("teamIds") List<String> teamIds);
|
||||
@BindUUID("userId") UUID userId,
|
||||
@BindList("teamIds") List<String> teamIds,
|
||||
@Bind("username") String username,
|
||||
@Bind("userTeamJsonMysql") String userTeamJsonMysql,
|
||||
@BindList("userTeamJsonPostgres") List<String> userTeamJsonPostgres);
|
||||
|
||||
@SqlQuery(
|
||||
"SELECT json FROM thread_entity <condition> AND "
|
||||
|
||||
@ -528,7 +528,12 @@ public class FeedRepository {
|
||||
User user = Entity.getEntity(USER, userId, TEAMS_FIELD, NON_DELETED);
|
||||
List<String> teamIds = getTeamIds(user);
|
||||
List<String> teamNames = getTeamNames(user);
|
||||
result = dao.feedDAO().listCountByOwner(userId, teamIds);
|
||||
String userTeamJsonMysql = getUserTeamJsonMysql(userId, teamIds);
|
||||
List<String> userTeamJsonPostgres = getUserTeamJsonPostgres(userId, teamIds);
|
||||
result =
|
||||
dao.feedDAO()
|
||||
.listCountByOwner(
|
||||
userId, teamIds, user.getName(), userTeamJsonMysql, userTeamJsonPostgres);
|
||||
mentions =
|
||||
dao.feedDAO()
|
||||
.listCountThreadsByMentions(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user