From e967ee1cf03f8482a26ecf09bb6d5c6a973687ba Mon Sep 17 00:00:00 2001 From: Khafid Prayoga Date: Mon, 8 Dec 2025 18:57:35 +0700 Subject: [PATCH] refactor(role): rename PagePermission to RoleAccesses and fix base model id Update type name from PagePermission to RoleAccesses across multiple files for consistency Change mock id value from -1 to 0 in base model to match backend constraints Enable RBAC middleware and fix patient edit page permissions --- app/lib/page-permission.ts | 4 +-- app/models/_base.ts | 4 +-- app/models/person.ts | 6 ++--- .../(features)/client/patient/[id]/edit.vue | 27 +++++++++---------- .../(features)/client/patient/[id]/index.vue | 4 +-- app/pages/(features)/client/patient/add.vue | 4 +-- app/pages/(features)/client/patient/index.vue | 6 ++--- 7 files changed, 26 insertions(+), 29 deletions(-) diff --git a/app/lib/page-permission.ts b/app/lib/page-permission.ts index 807131a8..8b5a4746 100644 --- a/app/lib/page-permission.ts +++ b/app/lib/page-permission.ts @@ -1,4 +1,4 @@ -import type { RoleAccess } from '~/models/role' +import type { RoleAccesses } from '~/models/role' export const PAGE_PERMISSIONS = { '/client/patient': { @@ -63,4 +63,4 @@ export const PAGE_PERMISSIONS = { 'emp|pay': ['R'], 'emp|mng': ['R'], }, -} as const satisfies Record +} as const satisfies Record diff --git a/app/models/_base.ts b/app/models/_base.ts index ed6f7204..01769d29 100644 --- a/app/models/_base.ts +++ b/app/models/_base.ts @@ -19,9 +19,7 @@ export interface TreeItem { export function genBase(): Base { return { - // -1 buat mock data - // backend harusnya non-negative/ > 0 (untuk auto increment constraint) jadi harusnya aman ya - id: -1, + id: 0, createdAt: '', updatedAt: '', } diff --git a/app/models/person.ts b/app/models/person.ts index f2c400b6..fa8bfd4f 100644 --- a/app/models/person.ts +++ b/app/models/person.ts @@ -43,9 +43,9 @@ export interface Person extends Base { export function genPerson(): Person { return { ...genBase(), - frontTitle: '[MOCK] dr. ', - name: 'Agus Iwan Setiawan', - endTitle: 'Sp.Bo', + frontTitle: '', + name: '', + endTitle: '', } } diff --git a/app/pages/(features)/client/patient/[id]/edit.vue b/app/pages/(features)/client/patient/[id]/edit.vue index d8cd5619..c0ec4c7b 100644 --- a/app/pages/(features)/client/patient/[id]/edit.vue +++ b/app/pages/(features)/client/patient/[id]/edit.vue @@ -1,12 +1,12 @@