Couple more slight tweaks :)
This commit is contained in:
@@ -26,6 +26,7 @@ create table group_members (
|
||||
primary key (group_id, member_id)
|
||||
);
|
||||
|
||||
alter table systems add column group_list_privacy integer check (group_list_privacy in (1, 2)) not null default systems.member_list_privacy;
|
||||
alter table systems add column group_list_privacy integer check (group_list_privacy in (1, 2)) not null default 1;
|
||||
update systems set group_list_privacy = member_list_privacy;
|
||||
|
||||
update info set schema_version = 9;
|
||||
|
@@ -11,6 +11,9 @@ namespace PluralKit.Core
|
||||
{
|
||||
public static Task<IEnumerable<SystemFronter>> QueryCurrentFronters(this IPKConnection conn, SystemId system) =>
|
||||
conn.QueryAsync<SystemFronter>("select * from system_fronters where system = @system", new {system});
|
||||
|
||||
public static Task<IEnumerable<ListedGroup>> QueryGroupList(this IPKConnection conn, SystemId system) =>
|
||||
conn.QueryAsync<ListedGroup>("select * from group_list where system = @System", new {System = system});
|
||||
|
||||
public static Task<IEnumerable<ListedMember>> QueryMemberList(this IPKConnection conn, SystemId system, MemberListQueryOptions opts)
|
||||
{
|
||||
|
7
PluralKit.Core/Database/Views/ListedGroup.cs
Normal file
7
PluralKit.Core/Database/Views/ListedGroup.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace PluralKit.Core
|
||||
{
|
||||
public class ListedGroup : PKGroup
|
||||
{
|
||||
public int MemberCount { get; }
|
||||
}
|
||||
}
|
@@ -54,4 +54,10 @@ select members.*,
|
||||
when members.description_privacy = 1 then members.description
|
||||
-- Any other privacy (rn just '2'), return null description (missing case = null in SQL)
|
||||
end as public_description
|
||||
from members;
|
||||
from members;
|
||||
|
||||
create view group_list as
|
||||
select groups.*,
|
||||
-- Find group member count
|
||||
(select count(*) from group_members where group_id = groups.id) as member_count
|
||||
from groups;
|
@@ -5,6 +5,7 @@
|
||||
drop view if exists system_last_switch;
|
||||
drop view if exists system_fronters;
|
||||
drop view if exists member_list;
|
||||
drop view if exists group_list;
|
||||
|
||||
drop function if exists message_context;
|
||||
drop function if exists proxy_members;
|
||||
|
Reference in New Issue
Block a user