@opengis/fastify-table 2.5.60 → 2.5.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -113,6 +113,9 @@ ALTER TABLE admin.user_roles DROP CONSTRAINT IF EXISTS admin_user_roles_pkey;
|
|
|
113
113
|
ALTER TABLE admin.user_roles DROP CONSTRAINT IF EXISTS admin_user_roles_role_id_fkey;
|
|
114
114
|
ALTER TABLE admin.user_roles DROP CONSTRAINT IF EXISTS admin_user_roles_user_uid_fkey;
|
|
115
115
|
ALTER TABLE admin.user_roles DROP CONSTRAINT IF EXISTS admin_user_roles_user_uid_role_id_key;
|
|
116
|
+
alter table admin.user_roles drop constraint if exists user_roles_user_uid_fkey;
|
|
117
|
+
alter table admin.user_roles drop constraint if exists user_roles_role_id_fkey;
|
|
118
|
+
alter table admin.user_roles drop constraint if exists admin_user_roles_role_id_fkey;
|
|
116
119
|
|
|
117
120
|
ALTER TABLE admin.user_roles ADD COLUMN IF NOT EXISTS ugr_id text NOT NULL DEFAULT next_id();
|
|
118
121
|
ALTER TABLE admin.user_roles ADD COLUMN IF NOT EXISTS user_uid text NOT NULL;
|
|
@@ -127,6 +130,8 @@ ALTER TABLE admin.user_roles ADD COLUMN IF NOT EXISTS access_granted_time timest
|
|
|
127
130
|
ALTER TABLE admin.user_roles ADD COLUMN IF NOT EXISTS actions text [];
|
|
128
131
|
|
|
129
132
|
ALTER TABLE admin.user_roles ADD CONSTRAINT admin_user_roles_pkey PRIMARY KEY (ugr_id);
|
|
133
|
+
ALTER TABLE admin.user_roles ADD CONSTRAINT user_roles_user_uid_fkey FOREIGN KEY (user_uid) REFERENCES admin.users (uid) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE;
|
|
134
|
+
ALTER TABLE admin.user_roles ADD CONSTRAINT admin_user_roles_role_id_fkey FOREIGN KEY (role_id) REFERENCES admin.roles (role_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE;
|
|
130
135
|
ALTER TABLE admin.user_roles ADD CONSTRAINT admin_user_roles_user_uid_role_id_key UNIQUE (user_uid, role_id);
|
|
131
136
|
|
|
132
137
|
|
|
@@ -142,7 +147,7 @@ COMMENT ON COLUMN admin.user_roles.actions IS 'Рівень доступу ко
|
|
|
142
147
|
CREATE INDEX IF NOT EXISTS admin_user_roles_access_user_uid_idx ON admin.user_roles USING btree (user_uid COLLATE pg_catalog."default");
|
|
143
148
|
CREATE INDEX IF NOT EXISTS admin_user_roles_cdate_btree_idx ON admin.user_roles USING btree (cdate);
|
|
144
149
|
CREATE INDEX IF NOT EXISTS admin_user_roles_editor_date_btree_idx ON admin.user_roles USING btree (editor_date);
|
|
145
|
-
CREATE INDEX IF NOT EXISTS admin_user_roles_user_uid_gin_idx ON admin.user_roles USING gin (user_uid COLLATE pg_catalog."default" gin_trgm_ops);
|
|
150
|
+
CREATE INDEX IF NOT EXISTS admin_user_roles_user_uid_gin_idx ON admin.user_roles USING gin (user_uid COLLATE pg_catalog."default" public.gin_trgm_ops);
|
|
146
151
|
CREATE INDEX IF NOT EXISTS admin_user_roles_role_id_idx ON admin.user_roles USING btree (role_id COLLATE pg_catalog."default");
|
|
147
152
|
|
|
148
153
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggest.d.ts","sourceRoot":"","sources":["../../../../../server/routes/table/controllers/suggest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AA+BpD,wBAAsB,kBAAkB,CAAC,EACvC,KAAK,EACL,QAAQ,EACR,MAAM,EACN,UAAU,EACV,QAAQ,EACR,UAAU,EACV,GAAG,EACH,EAAqB,GACtB,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,GAAG,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,UAAU,CAAC;CACjB
|
|
1
|
+
{"version":3,"file":"suggest.d.ts","sourceRoot":"","sources":["../../../../../server/routes/table/controllers/suggest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AA+BpD,wBAAsB,kBAAkB,CAAC,EACvC,KAAK,EACL,QAAQ,EACR,MAAM,EACN,UAAU,EACV,QAAQ,EACR,UAAU,EACV,GAAG,EACH,EAAqB,GACtB,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,GAAG,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,UAAU,CAAC;CACjB;;;;;;UAyGA;AAED,wBAA8B,OAAO,CAAC,GAAG,EAAE,GAAG,gBA6d7C"}
|
|
@@ -45,11 +45,24 @@ export async function getTableColumnMeta({ table, template, column, selectName,
|
|
|
45
45
|
const searchQuerySelect = startsWith && key
|
|
46
46
|
? `id in ( with cc(id, text) as (${select}) select id from cc where (left(lower("text"),${key.length})=$1) )`
|
|
47
47
|
: `id in ( with cc(id, text) as (${select}) select id from cc where (lower("text") ~ $1) )`;
|
|
48
|
+
const counts = pg.queryCache
|
|
49
|
+
? await pg
|
|
50
|
+
.queryCache(`SELECT json_object_agg( (
|
|
51
|
+
SELECT
|
|
52
|
+
nspname
|
|
53
|
+
FROM
|
|
54
|
+
pg_namespace
|
|
55
|
+
WHERE
|
|
56
|
+
oid = relnamespace
|
|
57
|
+
) || '.' || relname, reltuples::bigint) FROM pg_class WHERE relkind = 'r'`)
|
|
58
|
+
.then((r) => r.rows[0].json_object_agg)
|
|
59
|
+
: {};
|
|
48
60
|
if (pg.pgType?.[dataTypeID]?.includes("[]")) {
|
|
49
61
|
const original = filtered
|
|
50
62
|
? `with c(id,text) as (select id, id as text from (select unnest(${column}) as id from ${tableName} t ${sqlTable})q group by id) select id, text from c`
|
|
51
63
|
: `with c(id,text) as (select id, id as text, count(*) from (select unnest(${column}) as id from ${tableName} t ${sqlTable})q group by id limit ${defaultLimit}) select * from c`;
|
|
52
64
|
return {
|
|
65
|
+
count: counts[tableName] || 0,
|
|
53
66
|
arr,
|
|
54
67
|
original,
|
|
55
68
|
searchQuery: select ? searchQuerySelect : searchQueryDefault,
|
|
@@ -60,6 +73,7 @@ export async function getTableColumnMeta({ table, template, column, selectName,
|
|
|
60
73
|
? `with c(id,text) as (select ${column} as id, ${column} as text from ${tableName} t ${sqlTable} group by ${column}) select id, text from c`
|
|
61
74
|
: `with c(id,text) as (select ${column} as id, ${column} as text, count(*) from ${tableName} t ${sqlTable} group by ${column} limit ${defaultLimit}) select * from c`;
|
|
62
75
|
return {
|
|
76
|
+
count: counts[tableName] || 0,
|
|
63
77
|
arr,
|
|
64
78
|
original,
|
|
65
79
|
searchQuery: select ? searchQuerySelect : searchQueryDefault,
|