diff --git a/README.md b/README.md index 4b3f181a..1094dab9 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,66 @@ # SIMRS - FE + RSSA - Front End ## Framework Guide + - [Vue Style Guide](https://vuejs.org/style-guide) - [Nuxt Style Guide](https://nuxt.com/docs/4.x/guide) ## Configuration + - `nuxt.config.ts`
Nuxt configuration file - `.env`
Some environment variables ## Directory Structure for `app/` + - `app.vue`: Main layout - `components` : Contains all reusable UI components. - `components/flow` : Entry point for business logic and workflows. Pages or routes call these flow components to handle API requests and process application logic -- `components/app` : View-layer components that manage and present data. These are used within `flow/` to render or handle specific parts of the UI, and return results back to the flow +- `components/app` : View-layer components that manage and present data. These are used within `flow/` to render or handle specific parts of the UI, and return results back to the flow - `components/pub` : Public/shared components used across different parts of the app. - `composables` : Contains reusable logic and utility functions (e.g. composables, hooks).. - `layouts` : Reusable UI layout patterns used across pages. -## Directory Structure for `app/pages` +## Directory Structure for `app/pages` + - `pages/auth` : Authentication related pages. - `pages/(features)` : Grouped feature modules that reflect specific business flow or domains. -## Directory Structure for `server/` +## Directory Structure for `server/` + - `server/api` : API or proxy requests ## Workflows + The basic development workflow follows these steps: ### Define Your Data in `models/` + - Create data definitions or interfaces. - These should represent the structure of the data used across your app. ### Build UI Components in `components/app` + - Create reusable UI and app specific components. - Keep components pure, avoid making HTTP requests directly within them. - They receive data via props and emit events upward. ### Business Logic in `components/flow` + - This layer connects the UI with the logic (API calls, validations, navigation). - It composes components from `components/app/`, `components/pub/`, and other flow. - Also responsible for managing state, side effects, and interactions. ### Create Pages in `pages/` + - Pages load the appropriate flow from `components/flow/`. - They do not contain UI or logic directly, just route level layout or guards. ## Git Workflows + The basic git workflow follows these steps: + 1. Create a new branch on `dev` - branch name should be `feat/` or `fix/` 2. Make your changes diff --git a/app/components/app/patient/list.vue b/app/components/app/patient/list.vue index d2f74529..3267842c 100644 --- a/app/components/app/patient/list.vue +++ b/app/components/app/patient/list.vue @@ -1,5 +1,5 @@ + + diff --git a/app/components/pub/nav/data-table.vue b/app/components/pub/nav/data-table.vue index 5477c734..9dc72099 100644 --- a/app/components/pub/nav/data-table.vue +++ b/app/components/pub/nav/data-table.vue @@ -1,5 +1,5 @@ diff --git a/app/lib/page-permission.ts b/app/lib/page-permission.ts index a31edd64..797dd077 100644 --- a/app/lib/page-permission.ts +++ b/app/lib/page-permission.ts @@ -1,3 +1,5 @@ +import type { RoleAccess } from '~/models/role' + export const PAGE_PERMISSIONS = { '/patient': { doctor: ['R'], @@ -7,4 +9,4 @@ export const PAGE_PERMISSIONS = { billing: ['R'], management: ['R'], }, -} as const +} as const satisfies Record diff --git a/app/middleware/auth.global.ts b/app/middleware/auth.global.ts index e254a754..e2b76d91 100644 --- a/app/middleware/auth.global.ts +++ b/app/middleware/auth.global.ts @@ -11,14 +11,5 @@ export default defineNuxtRouteMiddleware((to) => { if (!userStore.isAuthenticated) { return navigateTo('/401') } - - // const allowedRoles = to.meta.roles as string[] | undefined - // if (allowedRoles && !allowedRoles.includes(userStore.userRole)) { - // return navigateTo('/unauthorized') - // } - // const allowedRoles = to.meta.roles as string[] | undefined - // if (allowedRoles && !userStore.userRole.some((r) => allowedRoles.includes(r))) { - // return navigateTo('/unauthorized') - // } } }) diff --git a/app/pages/(features)/patient/add.vue b/app/pages/(features)/patient/add.vue index f71f712a..30b25cf4 100644 --- a/app/pages/(features)/patient/add.vue +++ b/app/pages/(features)/patient/add.vue @@ -30,7 +30,5 @@ const canCreate = hasCreateAccess(roleAccess)
-
-

You don't have permission to create patient records.

-
+ diff --git a/eslint.config.js b/eslint.config.js index e786c1c0..4879bee5 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -18,14 +18,14 @@ export default withNuxt( { rules: { // Basic rules - quotes: ['error', 'single', { avoidEscape: true }], + 'quotes': ['error', 'single', { avoidEscape: true }], 'style/no-trailing-spaces': ['error', { ignoreComments: true }], 'no-console': 'off', // Relax strict formatting rules 'style/brace-style': 'off', // Allow inline if - curly: ['error', 'multi-line'], // Only require braces for multi-line + 'curly': ['error', 'multi-line'], // Only require braces for multi-line 'style/arrow-parens': 'off', // UnoCSS - make it warning instead of error, or disable completely @@ -48,6 +48,6 @@ export default withNuxt( rules: { 'style/no-trailing-spaces': 'off', }, - } - ) + }, + ), ) diff --git a/package.json b/package.json index a77d07a3..74a2234b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "nuxt-app", - "private": true, "type": "module", + "private": true, "scripts": { "build": "nuxt build", "dev": "nuxt dev", diff --git a/server/api/[...req].ts b/server/api/[...req].ts index 88e27d59..3fd45b16 100644 --- a/server/api/[...req].ts +++ b/server/api/[...req].ts @@ -23,7 +23,7 @@ export default defineEventHandler(async (event) => { if (headers['content-type']) forwardHeaders.set('Content-Type', headers['content-type']) forwardHeaders.set('Authorization', `Bearer ${bearer}`) - let body: any = undefined + let body: any if (['POST', 'PATCH'].includes(method!)) { if (headers['content-type']?.includes('multipart/form-data')) { body = await readBody(event) diff --git a/uno.config.ts b/uno.config.ts index 48e7c051..fb109dd6 100644 --- a/uno.config.ts +++ b/uno.config.ts @@ -1,4 +1,4 @@ -import { defineConfig, presetWind, presetAttributify, presetIcons } from 'unocss' +import { defineConfig, presetAttributify, presetIcons, presetWind } from 'unocss' export default defineConfig({ presets: [