251209:0000 Backend Test stagenot finish & Frontend add Task 013-015
This commit is contained in:
@@ -126,15 +126,15 @@ graph TB
|
||||
|
||||
### Phase 1: Foundation (2-3 weeks)
|
||||
|
||||
| ID | Task | Priority | Effort | Status | Dependencies |
|
||||
| ---------------------------------------------- | --------------------------- | -------- | -------- | -------------- | ------------ |
|
||||
| ID | Task | Priority | Effort | Status | Dependencies |
|
||||
| ---------------------------------------------- | --------------------------- | -------- | -------- | ------------- | ------------ |
|
||||
| [BE-001](./TASK-BE-001-database-migrations.md) | Database Setup & Migrations | P0 | 2-3 days | 🔴 Not Started | None |
|
||||
| [BE-002](./TASK-BE-002-auth-rbac.md) | Auth & RBAC Module | P0 | 5-7 days | 🔴 Not Started | BE-001 |
|
||||
|
||||
### Phase 2: Core Infrastructure (3-4 weeks)
|
||||
|
||||
| ID | Task | Priority | Effort | Status | Dependencies |
|
||||
| ------------------------------------------------- | -------------------------- | -------- | ---------- | -------------- | -------------- |
|
||||
| ID | Task | Priority | Effort | Status | Dependencies |
|
||||
| ------------------------------------------------- | -------------------------- | -------- | ---------- | ------------- | -------------- |
|
||||
| [BE-013](./TASK-BE-013-user-management.md) | User Management | P1 | 5-7 days | 🔴 Not Started | BE-001, BE-002 |
|
||||
| [BE-012](./TASK-BE-012-master-data-management.md) | Master Data Management | P1 | 6-8 days | 🔴 Not Started | BE-001, BE-002 |
|
||||
| [BE-003](./TASK-BE-003-file-storage.md) | File Storage (Two-Phase) | P1 | 4-5 days | 🔴 Not Started | BE-001, BE-002 |
|
||||
@@ -143,23 +143,23 @@ graph TB
|
||||
|
||||
### Phase 3: Business Modules (4-5 weeks)
|
||||
|
||||
| ID | Task | Priority | Effort | Status | Dependencies |
|
||||
| ------------------------------------------------ | --------------------- | -------- | --------- | -------------- | ---------------------------------- |
|
||||
| ID | Task | Priority | Effort | Status | Dependencies |
|
||||
| ------------------------------------------------ | --------------------- | -------- | --------- | ------------- | ---------------------------------- |
|
||||
| [BE-005](./TASK-BE-005-correspondence-module.md) | Correspondence Module | P1 | 7-10 days | 🔴 Not Started | BE-001~004, BE-006, BE-012, BE-013 |
|
||||
| [BE-007](./TASK-BE-007-rfa-module.md) | RFA Module | P1 | 8-12 days | 🔴 Not Started | BE-001~004, BE-006, BE-012, BE-013 |
|
||||
|
||||
### Phase 4: Supporting Modules (2-3 weeks)
|
||||
|
||||
| ID | Task | Priority | Effort | Status | Dependencies |
|
||||
| -------------------------------------------------- | ------------------------- | -------- | -------- | -------------- | -------------------------- |
|
||||
| ID | Task | Priority | Effort | Status | Dependencies |
|
||||
| -------------------------------------------------- | ------------------------- | -------- | -------- | ------------- | -------------------------- |
|
||||
| [BE-008](./TASK-BE-008-drawing-module.md) | Drawing Module | P2 | 6-8 days | 🔴 Not Started | BE-001~004, BE-012 |
|
||||
| [BE-009](./TASK-BE-009-circulation-transmittal.md) | Circulation & Transmittal | P2 | 5-7 days | 🔴 Not Started | BE-001~003, BE-006, BE-012 |
|
||||
| [BE-010](./TASK-BE-010-search-elasticsearch.md) | Search & Elasticsearch | P2 | 4-6 days | 🔴 Not Started | BE-001, BE-005, BE-007 |
|
||||
|
||||
### Phase 5: Supporting Services (1 week)
|
||||
|
||||
| ID | Task | Priority | Effort | Status | Dependencies |
|
||||
| --------------------------------------------- | ------------------------ | -------- | -------- | -------------- | -------------- |
|
||||
| ID | Task | Priority | Effort | Status | Dependencies |
|
||||
| --------------------------------------------- | ------------------------ | -------- | -------- | ------------- | -------------- |
|
||||
| [BE-011](./TASK-BE-011-notification-audit.md) | Notification & Audit Log | P3 | 3-5 days | 🔴 Not Started | BE-001, BE-002 |
|
||||
|
||||
---
|
||||
@@ -190,10 +190,11 @@ graph TB
|
||||
|
||||
### Phase 4: Supporting Features (Week 9)
|
||||
|
||||
| Task | Title | Priority | Effort | Dependencies |
|
||||
| ------------------------------------------------------- | ---------------------------- | -------- | -------- | -------------- |
|
||||
| [TASK-FE-008](./TASK-FE-008-search-ui.md) | Search & Global Filters | P2 | 3-4 days | FE-003, BE-010 |
|
||||
| [TASK-FE-009](./TASK-FE-009-dashboard-notifications.md) | Dashboard & Notifications UI | P3 | 3-4 days | FE-003, BE-011 |
|
||||
| Task | Title | Priority | Effort | Dependencies |
|
||||
| ---------------------------------------------------------- | ---------------------------- | -------- | -------- | -------------- |
|
||||
| [TASK-FE-008](./TASK-FE-008-search-ui.md) | Search & Global Filters | P2 | 3-4 days | FE-003, BE-010 |
|
||||
| [TASK-FE-009](./TASK-FE-009-dashboard-notifications.md) | Dashboard & Notifications UI | P3 | 3-4 days | FE-003, BE-011 |
|
||||
| [TASK-FE-013](./TASK-FE-013-circulation-transmittal-ui.md) | Circulation & Transmittal UI | P2 | 5-7 days | FE-005, BE-009 |
|
||||
|
||||
### Phase 5: Administration (Weeks 10-11)
|
||||
|
||||
@@ -202,6 +203,8 @@ graph TB
|
||||
| [TASK-FE-010](./TASK-FE-010-admin-panel.md) | Admin Panel & Settings UI | P2 | 5-7 days | FE-002, FE-005, BE-012, BE-013 |
|
||||
| [TASK-FE-011](./TASK-FE-011-workflow-config-ui.md) | Workflow Configuration UI | P2 | 5-7 days | FE-010, BE-006 |
|
||||
| [TASK-FE-012](./TASK-FE-012-numbering-config-ui.md) | Document Numbering Config UI | P2 | 3-4 days | FE-010, BE-004 |
|
||||
| [TASK-FE-014](./TASK-FE-014-reference-data-ui.md) | Reference Data & Lookups UI | P3 | 3-5 days | FE-010, BE-012 |
|
||||
| [TASK-FE-015](./TASK-FE-015-security-admin-ui.md) | Security & System Admin UI | P2 | 5-7 days | FE-010, BE-002, BE-011 |
|
||||
|
||||
---
|
||||
|
||||
@@ -231,7 +234,7 @@ graph TB
|
||||
#### Sprint 9-10: Supporting Modules (4 weeks)
|
||||
|
||||
- Week 18-19: Drawing Module (BE-008)
|
||||
- Week 20: Circulation & Transmittal (BE-009)
|
||||
- Week 20: Circulation & Transmittal (BE-009, FE-013)
|
||||
- Week 21: Search & Elasticsearch (BE-010)
|
||||
- _Milestone:_ Complete document ecosystem
|
||||
|
||||
@@ -313,16 +316,6 @@ graph TB
|
||||
- Search & filter
|
||||
- **Why Critical:** Core business document type
|
||||
|
||||
### TASK-BE-006: Workflow Engine
|
||||
|
||||
- **Type:** Core Infrastructure
|
||||
- **Key Deliverables:**
|
||||
- DSL parser and validator
|
||||
- State machine management
|
||||
- Guard and effect executors
|
||||
- History tracking
|
||||
- **Related ADR:** [ADR-001](../05-decisions/ADR-001-unified-workflow-engine.md)
|
||||
|
||||
### TASK-BE-007: RFA Module
|
||||
|
||||
- **Type:** Business Module
|
||||
@@ -377,7 +370,7 @@ graph TB
|
||||
|
||||
## 🔗 Dependencies Graph
|
||||
|
||||
```
|
||||
```mermaid
|
||||
BE-001 (Database)
|
||||
├── BE-002 (Auth)
|
||||
│ ├── BE-004 (Doc Numbering)
|
||||
|
||||
71
specs/06-tasks/TASK-BE-014-testing-documentation.md
Normal file
71
specs/06-tasks/TASK-BE-014-testing-documentation.md
Normal file
@@ -0,0 +1,71 @@
|
||||
# TASK-BE-014: Backend Testing & Documentation Strategy
|
||||
|
||||
**Status:** Draft
|
||||
**Owner:** TBD
|
||||
**Priority:** High
|
||||
**Related:**
|
||||
|
||||
- `specs/03-implementation/testing-strategy.md`
|
||||
- `specs/03-implementation/backend-guidelines.md`
|
||||
|
||||
## 🎯 Objective
|
||||
|
||||
Establish a robust safety net and comprehensive documentation for the Backend (NestJS).
|
||||
Goal: **Quality First, Self-Documenting Code.**
|
||||
|
||||
## 📋 Scope
|
||||
|
||||
### 1. Unit Testing (Target: 80% Coverage on Services)
|
||||
|
||||
Focus on Business Logic, not framework glue code.
|
||||
|
||||
- [/] **Unit Testing (Service Level):** <!-- In Progress -->
|
||||
- [x] `DocumentNumberingService` (Mock Redis/Redlock, Test Optimistic Lock).
|
||||
- [x] `FileStorageService` (Test Local Storage fs-extra).
|
||||
- [x] `WorkflowEngineService` (Test state transitions/Guard validation).
|
||||
- [x] `AuthService` (Critical: RBAC)
|
||||
|
||||
- [ ] **Feature Modules:**
|
||||
- [ ] `CorrespondenceService` & `CorrespondenceWorkflowService`
|
||||
- [ ] `RfaService` & `RfaWorkflowService`
|
||||
- [ ] `TransmittalService` & `CirculationService`
|
||||
|
||||
### 2. Integration / E2E Testing (Target: Critical User Journeys)
|
||||
|
||||
Verify end-to-end flows using a Test Database (Dockerized MariaDB).
|
||||
|
||||
- [ ] **Infrastructure:**
|
||||
- [ ] Ensure `docker-compose.test.yml` exists for isolated DB testing.
|
||||
- [ ] Setup Global Setup/Teardown for Jest E2E.
|
||||
- [ ] **Scenarios:**
|
||||
- [ ] **Auth Flow:** Login -> JWT -> RBAC Rejection.
|
||||
- [ ] **Document Lifecycle:** Create -> Upload -> Submit -> Approve -> Complete.
|
||||
- [ ] **Search:** Create Doc -> Wait -> Search (Elasticsearch Mock/Real).
|
||||
|
||||
### 3. Documentation
|
||||
|
||||
- [/] **API Documentation (Swagger/OpenAPI):** <!-- In Progress -->
|
||||
- [x] Ensure all DTOs have `@ApiProperty()` (Verified in CreateCorrespondenceDto and others).
|
||||
- [x] Ensure all Controllers have `@ApiOperation()` and `@ApiResponse()` (Done for Auth & Correspondence).
|
||||
- [ ] Verify `http://localhost:3000/docs` covers 100% of endpoints.
|
||||
- [/] **Code Documentation (Compodoc):** <!-- In Progress -->
|
||||
- [x] Install `@compodoc/compodoc`.
|
||||
- [x] Configure `tsconfig.doc.json`.
|
||||
- [x] Add `npm run doc` script.
|
||||
- [ ] Generate static HTML documentation.
|
||||
|
||||
## 🛠Implementation Details
|
||||
|
||||
### Tools
|
||||
|
||||
- **Unit/Integration:** `jest`, `ts-jest`, `@nestjs/testing`
|
||||
- **E2E:** `supertest`
|
||||
- **Docs:** `@nestjs/swagger`, `@compodoc/compodoc`
|
||||
|
||||
## ✅ Definition of Done
|
||||
|
||||
1. [ ] `npm run test` passes (Unit Tests).
|
||||
2. [ ] `npm run test:e2e` passes (E2E Tests).
|
||||
3. [ ] `npm run doc` generates valid HTML.
|
||||
4. [ ] Swagger UI (`/docs`) is complete and usable.
|
||||
5. [ ] **Testing Strategy Guide** is updated if new patterns emerge.
|
||||
159
specs/06-tasks/TASK-FE-013-circulation-transmittal-ui.md
Normal file
159
specs/06-tasks/TASK-FE-013-circulation-transmittal-ui.md
Normal file
@@ -0,0 +1,159 @@
|
||||
# Task: Circulation & Transmittal UI
|
||||
|
||||
**Status:** Not Started
|
||||
**Priority:** P2 (Medium)
|
||||
**Estimated Effort:** 5-7 days
|
||||
**Dependencies:** TASK-FE-005, TASK-BE-009
|
||||
**Owner:** Frontend Team
|
||||
|
||||
---
|
||||
|
||||
## 📋 Overview
|
||||
|
||||
Implement the **Circulation** (Internal Distribution) and **Transmittal** (External Submission) modules in the Frontend. These interfaces will allow users to manage document distribution, track assignees, and generate transmittal slips.
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Objectives
|
||||
|
||||
- ✅ **Circulation UI:** Create, View, and Track internal circulations.
|
||||
- ✅ **Transmittal UI:** Create Transmittals, Manage Items, and Print/Export PDF.
|
||||
- ✅ **Integration:** Connect with Backend APIs for data persistence and workflow actions.
|
||||
- ✅ **UX/UI:** User-friendly document selection and assignee management.
|
||||
|
||||
---
|
||||
|
||||
## 📝 Acceptance Criteria
|
||||
|
||||
### 1. Circulation Module
|
||||
|
||||
- [ ] **List View:** Display circulations with status, due date, and progress indicators.
|
||||
- [ ] **Create Form:**
|
||||
- [ ] Select Subject/Title.
|
||||
- [ ] **Assignee Selector:** Multi-select users for Main/Action/Info roles.
|
||||
- [ ] **Document Linker:** Search and select existing Correspondence/RFAs to attach.
|
||||
- [ ] **Detail View:**
|
||||
- [ ] Show overall status.
|
||||
- [ ] List of assignees with their individual status (Pending/Completed).
|
||||
- [ ] Action button for Assignee to "Complete" their task with remarks.
|
||||
|
||||
### 2. Transmittal Module
|
||||
|
||||
- [ ] **List View:** Display transmittals with transmittal number, recipient, and date.
|
||||
- [ ] **Create Form:**
|
||||
- [ ] Header info (Attention To, Organization, Date).
|
||||
- [ ] **Item Manager:** Add/Remove documents (Correspondence/RFA/Drawing) to the transmittal list.
|
||||
- [ ] Specify "Number of Copies" for each item.
|
||||
- [ ] **Detail View:** Read-only view of the transmittal slip.
|
||||
- [ ] **PDF Export:** Button to download the generated Transmittal PDF.
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Implementation Steps
|
||||
|
||||
### 1. API Services & Types
|
||||
|
||||
Create TypeScript interfaces and API service methods.
|
||||
|
||||
```typescript
|
||||
// types/circulation.ts
|
||||
export interface Circulation {
|
||||
id: number;
|
||||
circulation_number: string;
|
||||
subject: string;
|
||||
due_date: string;
|
||||
status: 'active' | 'completed';
|
||||
assignees: CirculationAssignee[];
|
||||
correspondences: Correspondence[]; // Linked docs
|
||||
}
|
||||
|
||||
export interface CirculationAssignee {
|
||||
id: number;
|
||||
user_id: number;
|
||||
user_name: string; // Mapped from User entity
|
||||
status: 'pending' | 'completed';
|
||||
remarks?: string;
|
||||
}
|
||||
|
||||
// services/circulation-service.ts
|
||||
// - getCirculations(params)
|
||||
// - getCirculationById(id)
|
||||
// - createCirculation(data)
|
||||
// - completeAssignment(id, assigneeId, data)
|
||||
```
|
||||
|
||||
```typescript
|
||||
// types/transmittal.ts
|
||||
export interface Transmittal {
|
||||
id: number;
|
||||
transmittal_number: string;
|
||||
attention_to: string;
|
||||
transmittal_date: string;
|
||||
items: TransmittalItem[];
|
||||
}
|
||||
|
||||
export interface TransmittalItem {
|
||||
document_type: 'correspondence' | 'rfa' | 'drawing';
|
||||
document_id: number;
|
||||
document_number: string;
|
||||
document_title: string;
|
||||
number_of_copies: number;
|
||||
}
|
||||
|
||||
// services/transmittal-service.ts
|
||||
// - getTransmittals(params)
|
||||
// - getTransmittalById(id)
|
||||
// - createTransmittal(data)
|
||||
// - downloadTransmittalPDF(id)
|
||||
```
|
||||
|
||||
### 2. UI Components
|
||||
|
||||
#### Circulation
|
||||
|
||||
- **`components/circulation/circulation-list.tsx`**: DataTable with custom columns.
|
||||
- **`components/circulation/circulation-form.tsx`**:
|
||||
- Use `Combobox` for searching Users.
|
||||
- Use `DocumentSelector` (shared component) for linking Correspondence/RFAs.
|
||||
- **`components/circulation/assignee-status-card.tsx`**: Component to show assignee progress.
|
||||
|
||||
#### Transmittal
|
||||
|
||||
- **`components/transmittal/transmittal-list.tsx`**: Standard DataTable.
|
||||
- **`components/transmittal/transmittal-form.tsx`**:
|
||||
- Header fields (Recipient, Date, etc.)
|
||||
- **Items Table**: Dynamic rows to add documents.
|
||||
- Column 1: Document Type (Select).
|
||||
- Column 2: Document Search (AsyncSelect).
|
||||
- Column 3: Copies (Input Number).
|
||||
- Action: Remove Row.
|
||||
|
||||
### 3. Pages & Routing
|
||||
|
||||
- `app/(dashboard)/circulation/page.tsx`: List View
|
||||
- `app/(dashboard)/circulation/new/page.tsx`: Create View
|
||||
- `app/(dashboard)/circulation/[id]/page.tsx`: Detail View
|
||||
- `app/(dashboard)/transmittals/page.tsx`: List View
|
||||
- `app/(dashboard)/transmittals/new/page.tsx`: Create View
|
||||
- `app/(dashboard)/transmittals/[id]/page.tsx`: Detail View
|
||||
|
||||
---
|
||||
|
||||
## 🧪 Testing Strategy
|
||||
|
||||
- **Unit Tests:** Test form validation logic (e.g., at least one assignee required).
|
||||
- **Integration Tests:** Mock API calls to verify data loading and submission.
|
||||
- **E2E Tests:**
|
||||
1. Login as User A.
|
||||
2. Create a Circulation and assign to User B.
|
||||
3. Logout and Login as User B.
|
||||
4. Verify notification/dashboard task.
|
||||
5. Complete the assignment.
|
||||
6. Verify Circulation status updates.
|
||||
|
||||
---
|
||||
|
||||
## 📚 Resources
|
||||
|
||||
- [Figma Design - Circulation](https://figma.com/...) (Internal Link)
|
||||
- [Backend Task: BE-009](../TASK-BE-009-circulation-transmittal.md)
|
||||
116
specs/06-tasks/TASK-FE-014-reference-data-ui.md
Normal file
116
specs/06-tasks/TASK-FE-014-reference-data-ui.md
Normal file
@@ -0,0 +1,116 @@
|
||||
# TASK-FE-014: Reference Data & Lookups UI
|
||||
|
||||
**ID:** TASK-FE-014
|
||||
**Title:** Reference Data & Lookups Management UI
|
||||
**Category:** Administration
|
||||
**Priority:** P3 (Low)
|
||||
**Effort:** 3-5 days
|
||||
**Dependencies:** TASK-FE-010, TASK-BE-012
|
||||
**Assigned To:** Frontend Developer
|
||||
|
||||
---
|
||||
|
||||
## 📋 Overview
|
||||
|
||||
Build a generic or specific UI for managing various system lookup tables (Master Data) that are essential for the application but change infrequently. This includes Disciplines, Drawing Categories, RFA Types, and Tags.
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Objectives
|
||||
|
||||
1. Manage **Correspondence Types** (and Sub-types)
|
||||
2. Manage **RFA Types** and associated **Approve Codes**
|
||||
3. Manage **Drawing Categories** (Main & Sub-categories)
|
||||
4. Manage **Disciplines** (System-wide codes)
|
||||
5. Manage **Tags** and other minor lookups
|
||||
|
||||
---
|
||||
|
||||
## ✅ Acceptance Criteria
|
||||
|
||||
- [ ] Admin can create/edit/delete Correspondence Types
|
||||
- [ ] Admin can manage RFA Types and their Approve Codes
|
||||
- [ ] Admin can configure Drawing Categories (Main/Sub)
|
||||
- [ ] Admin can manage Disciplines (Code & Name)
|
||||
- [ ] UI supports "Soft Delete" (Active/Inactive toggle)
|
||||
- [ ] Updates reflect immediately in dropdowns across the system
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Implementation Steps
|
||||
|
||||
### Step 1: Specific Lookup Pages vs Generic Table
|
||||
|
||||
Since these tables have similar structures (Code, Name, Description, IsActive), you can either build:
|
||||
A. **Generic Master Data Component** (Recommended for simple tables)
|
||||
B. **Dedicated Pages** for complex relations (like Categories -> Sub-categories)
|
||||
|
||||
#### Recommended Approach
|
||||
|
||||
- **Dedicated Page:** for RFA Types (due to relationship with Approve Codes)
|
||||
- **Dedicated Page:** for Drawing Categories (Hierarchical)
|
||||
- **Generic/Shared Page:** for Disciplines, Tags, Correspondence Types
|
||||
|
||||
### Step 2: RFA Configuration Page
|
||||
|
||||
```typescript
|
||||
// File: src/app/(admin)/admin/reference/rfa-types/page.tsx
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { DataTable } from '@/components/common/data-table';
|
||||
import { Button } from '@/components/ui/button';
|
||||
// ... imports
|
||||
|
||||
export default function RfaConfigPage() {
|
||||
const [types, setTypes] = useState([]);
|
||||
|
||||
// Columns: Code, Name, Contract, Active Status, Actions
|
||||
|
||||
return (
|
||||
<div className="p-6">
|
||||
<div className="flex justify-between mb-6">
|
||||
<h1 className="text-2xl font-bold">RFA Types Configuration</h1>
|
||||
<Button>Add Type</Button>
|
||||
</div>
|
||||
<DataTable data={types} columns={/*...*/} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### Step 3: Disciplines Management
|
||||
|
||||
```typescript
|
||||
// File: src/app/(admin)/admin/reference/disciplines/page.tsx
|
||||
'use client';
|
||||
|
||||
import { useMutation, useQuery } from '@tanstack/react-query';
|
||||
import { api } from '@/lib/api';
|
||||
|
||||
// Simple table to manage 'disciplines'
|
||||
// Fields: discipline_code, code_name_th, code_name_en
|
||||
```
|
||||
|
||||
### Step 4: Drawing Categories (Hierarchy)
|
||||
|
||||
```typescript
|
||||
// File: src/app/(admin)/admin/reference/drawing-categories/page.tsx
|
||||
// Needs to handle Main Category -> Sub Category relationship
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📦 Deliverables
|
||||
|
||||
- [ ] RFA Types Management Page
|
||||
- [ ] Drawing Categories Management Page
|
||||
- [ ] Disciplines Management Page
|
||||
- [ ] Correspondence Types Management Page
|
||||
- [ ] Unified "Reference Data" Sidebar Group
|
||||
|
||||
---
|
||||
|
||||
## 🔗 Related Documents
|
||||
|
||||
- [TASK-BE-012: Master Data Management](./TASK-BE-012-master-data-management.md)
|
||||
99
specs/06-tasks/TASK-FE-015-security-admin-ui.md
Normal file
99
specs/06-tasks/TASK-FE-015-security-admin-ui.md
Normal file
@@ -0,0 +1,99 @@
|
||||
# TASK-FE-015: Security & System Administration UI
|
||||
|
||||
**ID:** TASK-FE-015
|
||||
**Title:** Security & System Administration UI
|
||||
**Category:** Administration
|
||||
**Priority:** P2 (High)
|
||||
**Effort:** 5-7 days
|
||||
**Dependencies:** TASK-FE-010, TASK-BE-002, TASK-BE-011
|
||||
**Assigned To:** Frontend Developer
|
||||
|
||||
---
|
||||
|
||||
## 📋 Overview
|
||||
|
||||
Provide advanced administrative tools for managing system security (RBAC), monitoring active user sessions, and viewing system-level error logs (specifically for critical features like Document Numbering).
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Objectives
|
||||
|
||||
1. **RBAC Matrix Editor:** Visual interface to assign permissions to roles.
|
||||
2. **Session Management:** View and revoke active user sessions/tokens.
|
||||
3. **System Logs:** View specific error logs (e.g., `document_number_errors`) and Audit Logs.
|
||||
|
||||
---
|
||||
|
||||
## ✅ Acceptance Criteria
|
||||
|
||||
- [ ] **RBAC Matrix:** Grid view showing Roles (Columns) vs Permissions (Rows) with toggle switches.
|
||||
- [ ] **Session Monitor:** List active users/sessions with "Force Logout" capability.
|
||||
- [ ] **Numbering Logs:** Specific view for `document_number_audit` and `document_number_errors`.
|
||||
- [ ] **Security:** These pages must be restricted to Super Admin only.
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Implementation Steps
|
||||
|
||||
### Step 1: RBAC Matrix Component
|
||||
|
||||
```typescript
|
||||
// File: src/components/admin/security/rbac-matrix.tsx
|
||||
'use client';
|
||||
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
// ...
|
||||
|
||||
// Matrix layout:
|
||||
// | Permission | Admin | User | Approver |
|
||||
// |------------|-------|------|----------|
|
||||
// | rfa.view | [x] | [x] | [x] |
|
||||
// | rfa.create | [x] | [ ] | [ ] |
|
||||
|
||||
export function RbacMatrix({ roles, permissions, matrix }) {
|
||||
const handleToggle = (roleId, permId) => {
|
||||
// Call API to toggle permission
|
||||
};
|
||||
|
||||
return (
|
||||
<Table>
|
||||
{/* ... Render Matrix ... */}
|
||||
</Table>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### Step 2: Active Sessions Page
|
||||
|
||||
```typescript
|
||||
// File: src/app/(admin)/admin/security/sessions/page.tsx
|
||||
'use client';
|
||||
|
||||
// List active refresh tokens or sessions from backend
|
||||
// Columns: User, IP, Last Active, Device, Actions (Revoke)
|
||||
```
|
||||
|
||||
### Step 3: Document Numbering Logs
|
||||
|
||||
```typescript
|
||||
// File: src/app/(admin)/admin/logs/numbering/page.tsx
|
||||
'use client';
|
||||
|
||||
// specific table for 'document_number_errors' and 'document_number_audit'
|
||||
// Critical for diagnosing failed number generation
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📦 Deliverables
|
||||
|
||||
- [ ] RBAC Configuration Page
|
||||
- [ ] Active Sessions / Security Page
|
||||
- [ ] Document Numbering Diagnostics Page
|
||||
|
||||
---
|
||||
|
||||
## 🔗 Related Documents
|
||||
|
||||
- [TASK-BE-002: Auth & RBAC](./TASK-BE-002-auth-rbac.md)
|
||||
- [TASK-BE-011: Notification & Audit](./TASK-BE-011-notification-audit.md)
|
||||
@@ -19,6 +19,9 @@
|
||||
| **TASK-FE-010** | Admin Panel | ✅ **Done** | 100% | Layout, Users, Audit Logs, Organizations implemented. |
|
||||
| **TASK-FE-011** | Workflow Config UI | 🚧 **In Progress** | 30% | Workflow builder UI needed. |
|
||||
| **TASK-FE-012** | Numbering Config UI | 🚧 **In Progress** | 30% | Configuration forms needed. |
|
||||
| **TASK-FE-013** | Circulation & Transmittal | 🔴 **Not Started** | 0% | Pending implementation. |
|
||||
| **TASK-FE-014** | Reference Data UI | 🔴 **Not Started** | 0% | Specs created. |
|
||||
| **TASK-FE-015** | Security Admin UI | 🔴 **Not Started** | 0% | Specs created. |
|
||||
|
||||
## 🛠 Detailed Status by Component
|
||||
|
||||
|
||||
Reference in New Issue
Block a user