improvement: dashboard UX improved
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
-- Ensure Treatment feature and permissions exist for existing databases.
|
||||
WITH treatment_feature AS (
|
||||
INSERT INTO "features" ("id", "name")
|
||||
VALUES (md5(random()::text || clock_timestamp()::text), 'Treatment')
|
||||
ON CONFLICT ("name") DO UPDATE SET "name" = EXCLUDED."name"
|
||||
RETURNING "id"
|
||||
),
|
||||
selected_feature AS (
|
||||
SELECT "id" FROM treatment_feature
|
||||
UNION ALL
|
||||
SELECT f."id" FROM "features" f WHERE f."name" = 'Treatment' LIMIT 1
|
||||
)
|
||||
INSERT INTO "permissions" ("id", "name", "featureId")
|
||||
SELECT md5(random()::text || clock_timestamp()::text), 'TAB_TREATMENT_READ', sf."id"
|
||||
FROM selected_feature sf
|
||||
ON CONFLICT ("name") DO NOTHING;
|
||||
|
||||
WITH treatment_feature AS (
|
||||
SELECT "id" FROM "features" WHERE "name" = 'Treatment' LIMIT 1
|
||||
)
|
||||
INSERT INTO "permissions" ("id", "name", "featureId")
|
||||
SELECT md5(random()::text || clock_timestamp()::text), 'TAB_TREATMENT_EDIT', tf."id"
|
||||
FROM treatment_feature tf
|
||||
ON CONFLICT ("name") DO NOTHING;
|
||||
@@ -69,21 +69,25 @@ async function main() {
|
||||
name: 'Today',
|
||||
permissions: ['TAB_TODAY_READ', 'TAB_TODAY_EDIT'],
|
||||
},
|
||||
{
|
||||
name: 'Staff',
|
||||
permissions: ['TAB_STAFF_READ', 'TAB_STAFF_EDIT'],
|
||||
},
|
||||
{
|
||||
name: 'Labs / Clinics',
|
||||
permissions: ['TAB_LAB_READ', 'TAB_LAB_EDIT'],
|
||||
},
|
||||
{
|
||||
name: 'Patients',
|
||||
permissions: ['TAB_PATIENTS_READ', 'TAB_PATIENTS_EDIT'],
|
||||
},
|
||||
{
|
||||
name: 'Appointments',
|
||||
name: 'Appointment',
|
||||
permissions: ['TAB_APPOINTMENTS_READ', 'TAB_APPOINTMENTS_EDIT'],
|
||||
},
|
||||
{
|
||||
name: 'Staff Management',
|
||||
permissions: ['TAB_STAFF_READ', 'TAB_STAFF_EDIT'],
|
||||
},
|
||||
{
|
||||
name: 'Lab Management',
|
||||
permissions: ['TAB_LAB_READ', 'TAB_LAB_EDIT'],
|
||||
name: 'Treatment',
|
||||
permissions: ['TAB_TREATMENT_READ', 'TAB_TREATMENT_EDIT'],
|
||||
},
|
||||
{
|
||||
name: 'Billing',
|
||||
|
||||
@@ -2,14 +2,16 @@
|
||||
export const ALL_TAB_PERMISSIONS = [
|
||||
'TAB_TODAY_READ',
|
||||
'TAB_TODAY_EDIT',
|
||||
'TAB_PATIENTS_READ',
|
||||
'TAB_PATIENTS_EDIT',
|
||||
'TAB_APPOINTMENTS_READ',
|
||||
'TAB_APPOINTMENTS_EDIT',
|
||||
'TAB_STAFF_READ',
|
||||
'TAB_STAFF_EDIT',
|
||||
'TAB_LAB_READ',
|
||||
'TAB_LAB_EDIT',
|
||||
'TAB_PATIENTS_READ',
|
||||
'TAB_PATIENTS_EDIT',
|
||||
'TAB_APPOINTMENTS_READ',
|
||||
'TAB_APPOINTMENTS_EDIT',
|
||||
'TAB_TREATMENT_READ',
|
||||
'TAB_TREATMENT_EDIT',
|
||||
'TAB_BILLING_READ',
|
||||
'TAB_BILLING_EDIT',
|
||||
'TAB_REPORTS_READ',
|
||||
@@ -37,6 +39,7 @@ const EDIT_TO_READ: Record<string, string> = {
|
||||
TAB_APPOINTMENTS_EDIT: 'TAB_APPOINTMENTS_READ',
|
||||
TAB_STAFF_EDIT: 'TAB_STAFF_READ',
|
||||
TAB_LAB_EDIT: 'TAB_LAB_READ',
|
||||
TAB_TREATMENT_EDIT: 'TAB_TREATMENT_READ',
|
||||
TAB_BILLING_EDIT: 'TAB_BILLING_READ',
|
||||
TAB_REPORTS_EDIT: 'TAB_REPORTS_READ',
|
||||
};
|
||||
|
||||
@@ -18,14 +18,16 @@ import { JwtPayload } from './interfaces/jwt-payload.interface';
|
||||
const ALL_PERMISSIONS = [
|
||||
'TAB_TODAY_READ',
|
||||
'TAB_TODAY_EDIT',
|
||||
'TAB_PATIENTS_READ',
|
||||
'TAB_PATIENTS_EDIT',
|
||||
'TAB_APPOINTMENTS_READ',
|
||||
'TAB_APPOINTMENTS_EDIT',
|
||||
'TAB_STAFF_READ',
|
||||
'TAB_STAFF_EDIT',
|
||||
'TAB_LAB_READ',
|
||||
'TAB_LAB_EDIT',
|
||||
'TAB_PATIENTS_READ',
|
||||
'TAB_PATIENTS_EDIT',
|
||||
'TAB_APPOINTMENTS_READ',
|
||||
'TAB_APPOINTMENTS_EDIT',
|
||||
'TAB_TREATMENT_READ',
|
||||
'TAB_TREATMENT_EDIT',
|
||||
'TAB_BILLING_READ',
|
||||
'TAB_BILLING_EDIT',
|
||||
'TAB_REPORTS_READ',
|
||||
@@ -34,10 +36,11 @@ const ALL_PERMISSIONS = [
|
||||
|
||||
const READ_ONLY_PERMISSIONS = [
|
||||
'TAB_TODAY_READ',
|
||||
'TAB_PATIENTS_READ',
|
||||
'TAB_APPOINTMENTS_READ',
|
||||
'TAB_STAFF_READ',
|
||||
'TAB_LAB_READ',
|
||||
'TAB_PATIENTS_READ',
|
||||
'TAB_APPOINTMENTS_READ',
|
||||
'TAB_TREATMENT_READ',
|
||||
'TAB_BILLING_READ',
|
||||
'TAB_REPORTS_READ',
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user