Use nameSortable to orderBy userlist
This commit is contained in:
parent
d1e3d610d1
commit
2f53dea4a4
@ -1,3 +1,10 @@
|
||||
--unaccent will be used to create nameSortable
|
||||
CREATE EXTENSION IF NOT EXISTS unaccent;
|
||||
CREATE OR REPLACE FUNCTION immutable_lower_unaccent(text)
|
||||
RETURNS text AS $$
|
||||
SELECT lower(unaccent('unaccent', $1))
|
||||
$$ LANGUAGE SQL IMMUTABLE;
|
||||
|
||||
-- ========== Meeting tables
|
||||
|
||||
create table "meeting" (
|
||||
@ -261,6 +268,9 @@ ALTER TABLE "user" ADD COLUMN "isDenied" boolean GENERATED ALWAYS AS ("guestStat
|
||||
|
||||
ALTER TABLE "user" ADD COLUMN "registeredAt" timestamp with time zone GENERATED ALWAYS AS (to_timestamp(("registeredOn" + 6000) / 1000)) STORED;
|
||||
|
||||
--User for the userlist
|
||||
ALTER TABLE "user" ADD COLUMN "nameSortable" varchar(255) GENERATED ALWAYS AS (immutable_lower_unaccent("name")) STORED;
|
||||
|
||||
CREATE INDEX "idx_user_waiting" ON "user"("meetingId") where "isWaiting" is true;
|
||||
|
||||
--ALTER TABLE "user" ADD COLUMN "isModerator" boolean GENERATED ALWAYS AS (CASE WHEN "role" = 'MODERATOR' THEN true ELSE false END) STORED;
|
||||
@ -304,6 +314,7 @@ AS SELECT "user"."userId",
|
||||
"user"."extId",
|
||||
"user"."meetingId",
|
||||
"user"."name",
|
||||
"user"."nameSortable",
|
||||
"user"."avatar",
|
||||
"user"."color",
|
||||
"user"."away",
|
||||
@ -344,17 +355,17 @@ CREATE INDEX "idx_v_user_meetingId" ON "user"("meetingId")
|
||||
AND "user"."expired" IS FALSE
|
||||
and "user"."joined" IS TRUE;
|
||||
|
||||
CREATE INDEX "idx_v_user_meetingId_orderByColumns" ON "user"("meetingId","role","emojiTime","isDialIn","hasDrawPermissionOnCurrentPage","name","userId")
|
||||
CREATE INDEX "idx_v_user_meetingId_orderByColumns" ON "user"("meetingId","role","raiseHandTime","awayTime","emojiTime","isDialIn","hasDrawPermissionOnCurrentPage","nameSortable","userId")
|
||||
where "user"."loggedOut" IS FALSE
|
||||
AND "user"."expired" IS FALSE
|
||||
and "user"."joined" IS TRUE;
|
||||
|
||||
|
||||
CREATE OR REPLACE VIEW "v_user_current"
|
||||
AS SELECT "user"."userId",
|
||||
"user"."extId",
|
||||
"user"."meetingId",
|
||||
"user"."name",
|
||||
"user"."nameSortable",
|
||||
"user"."avatar",
|
||||
"user"."color",
|
||||
"user"."away",
|
||||
@ -405,6 +416,7 @@ AS SELECT "user"."userId",
|
||||
"user"."extId",
|
||||
"user"."meetingId",
|
||||
"user"."name",
|
||||
"user"."nameSortable",
|
||||
"user"."avatar",
|
||||
"user"."color",
|
||||
"user"."away",
|
||||
|
@ -12,7 +12,7 @@ apt update
|
||||
apt install postgresql postgresql-contrib -y
|
||||
sudo -u postgres psql -c "alter user postgres password 'bbb_graphql'"
|
||||
sudo -u postgres psql -c "drop database if exists bbb_graphql"
|
||||
sudo -u postgres psql -c "create database bbb_graphql"
|
||||
sudo -u postgres psql -c "create database bbb_graphql WITH TEMPLATE template0 LC_COLLATE 'C.UTF-8'"
|
||||
sudo -u postgres psql -c "alter database bbb_graphql set timezone to 'UTC'"
|
||||
sudo -u postgres psql -U postgres -d bbb_graphql -a -f bbb_schema.sql --set ON_ERROR_STOP=on
|
||||
sudo -u postgres psql -c "drop database if exists hasura_app"
|
||||
|
@ -100,6 +100,7 @@ select_permissions:
|
||||
- loggedOut
|
||||
- mobile
|
||||
- name
|
||||
- nameSortable
|
||||
- pinned
|
||||
- presenter
|
||||
- raiseHand
|
||||
|
@ -154,6 +154,7 @@ select_permissions:
|
||||
- loggedOut
|
||||
- mobile
|
||||
- name
|
||||
- nameSortable
|
||||
- pinned
|
||||
- presenter
|
||||
- raiseHand
|
||||
|
@ -31,6 +31,7 @@ select_permissions:
|
||||
- loggedOut
|
||||
- mobile
|
||||
- name
|
||||
- nameSortable
|
||||
- pinned
|
||||
- presenter
|
||||
- raiseHand
|
||||
|
@ -18,7 +18,7 @@ fi
|
||||
echo "Restarting database bbb_graphql"
|
||||
sudo -u postgres psql -c "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE datname = 'bbb_graphql'"
|
||||
sudo -u postgres psql -c "drop database if exists bbb_graphql"
|
||||
sudo -u postgres psql -c "create database bbb_graphql"
|
||||
sudo -u postgres psql -c "create database bbb_graphql WITH TEMPLATE template0 LC_COLLATE 'C.UTF-8'"
|
||||
sudo -u postgres psql -c "alter database bbb_graphql set timezone to 'UTC'"
|
||||
|
||||
echo "Creating tables in bbb_graphql"
|
||||
|
@ -9,7 +9,7 @@ export const USER_LIST_SUBSCRIPTION = gql`subscription Users($offset: Int!, $lim
|
||||
{emojiTime: asc_nulls_last},
|
||||
{isDialIn: desc},
|
||||
{hasDrawPermissionOnCurrentPage: desc},
|
||||
{name: asc},
|
||||
{nameSortable: asc},
|
||||
{userId: asc}
|
||||
]) {
|
||||
userId
|
||||
|
@ -7,7 +7,7 @@ case "$1" in
|
||||
|
||||
sudo -u postgres psql -c "alter user postgres password 'bbb_graphql'"
|
||||
sudo -u postgres psql -c "drop database if exists bbb_graphql"
|
||||
sudo -u postgres psql -c "create database bbb_graphql"
|
||||
sudo -u postgres psql -c "create database bbb_graphql WITH TEMPLATE template0 LC_COLLATE 'C.UTF-8'"
|
||||
sudo -u postgres psql -c "alter database bbb_graphql set timezone to 'UTC'"
|
||||
sudo -u postgres psql -U postgres -d bbb_graphql -a -f /usr/share/bbb-graphql-server/bbb_schema.sql --set ON_ERROR_STOP=on
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user