690514:2019 204-rfa-approval-refactor #01
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
// File: docs/ai-knowledge-base/templates/api-spec.md
|
||||
# API Specification: [Endpoint Name]
|
||||
|
||||
## 📋 Metadata
|
||||
- **Version**: v1
|
||||
- **Module**: [e.g. RFA]
|
||||
- **Protocol**: REST (JSON)
|
||||
- **Status**: Draft / Proposed
|
||||
|
||||
## 🚀 Endpoint
|
||||
`METHOD /v1/[path]`
|
||||
|
||||
## 🛡️ Authentication & Authorization
|
||||
- **Auth Required**: Yes/No
|
||||
- **Roles**: [Admin, Consultant, etc.]
|
||||
- **CASL Action**: `Action.Create / Action.Read / ...`
|
||||
|
||||
## 📥 Request Parameters
|
||||
### Headers
|
||||
- `Idempotency-Key`: UUID (Required for Write actions)
|
||||
- `Authorization`: Bearer [token]
|
||||
|
||||
### Body (JSON)
|
||||
| Field | Type | Required | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `name` | String | Yes | Name of entity |
|
||||
|
||||
## 📤 Response (JSON)
|
||||
### Success (200/201)
|
||||
```json
|
||||
{
|
||||
"publicId": "...",
|
||||
"status": "success",
|
||||
"data": { ... }
|
||||
}
|
||||
```
|
||||
|
||||
### Error (400/401/403/500)
|
||||
- ปฏิบัติตาม ADR-007
|
||||
|
||||
---
|
||||
// Change Log:
|
||||
// - 2026-05-14: Initial API spec template
|
||||
@@ -0,0 +1,32 @@
|
||||
// File: docs/ai-knowledge-base/templates/bug-report.md
|
||||
# Bug Report: [Short Title]
|
||||
|
||||
## 🚨 Issue Description
|
||||
[อธิบายปัญหาที่เกิดขึ้น]
|
||||
|
||||
## 🛠️ Environment
|
||||
- **Branch**: [main / develop / ...]
|
||||
- **Device**: [Desktop / Mobile]
|
||||
- **User Role**: [Admin / Document Control / ...]
|
||||
|
||||
## 🔄 Steps to Reproduce
|
||||
1. Go to '...'
|
||||
2. Click on '...'
|
||||
3. Scroll down to '...'
|
||||
4. See error
|
||||
|
||||
## ❌ Actual Result
|
||||
[สิ่งที่เกิดขึ้นจริง เช่น หน้าจอค้าง หรือ Error Message]
|
||||
|
||||
## ✅ Expected Result
|
||||
[สิ่งที่ควรจะเป็น]
|
||||
|
||||
## 🪵 Logs & Screenshots
|
||||
```
|
||||
[Paste Error Log Here]
|
||||
```
|
||||
![Link to screenshot]
|
||||
|
||||
---
|
||||
// Change Log:
|
||||
// - 2026-05-14: Initial template
|
||||
@@ -0,0 +1,42 @@
|
||||
// File: docs/ai-knowledge-base/templates/db-migration.md
|
||||
# Database Change Script (SQL Delta)
|
||||
|
||||
## 📋 Metadata
|
||||
- **Feature**: [Feature Name]
|
||||
- **Requested By**: [Name]
|
||||
- **Date**: [YYYY-MM-DD]
|
||||
- **Risk Level**: Low / Medium / High
|
||||
|
||||
## 🏗️ SQL Script (ADR-009 Standard)
|
||||
```sql
|
||||
-- Purpose: [Add new column/table for feature X]
|
||||
-- Target Table: [table_name]
|
||||
|
||||
-- 1. Create Table (if new)
|
||||
CREATE TABLE IF NOT EXISTS `table_name` (
|
||||
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||
`publicId` BINARY(16) NOT NULL UNIQUE,
|
||||
-- Custom fields...
|
||||
`version` INT DEFAULT 1,
|
||||
`createdAt` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`createdBy` INT,
|
||||
`updatedBy` INT
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- 2. Alter Table (if existing)
|
||||
-- ALTER TABLE `table_name` ADD COLUMN `new_field` VARCHAR(255);
|
||||
|
||||
-- 3. Add Indexes
|
||||
-- CREATE INDEX `idx_table_field` ON `table_name` (`field`);
|
||||
```
|
||||
|
||||
## 🆘 Rollback Script
|
||||
```sql
|
||||
-- DROP TABLE IF EXISTS `table_name`;
|
||||
-- ALTER TABLE `table_name` DROP COLUMN `new_field`;
|
||||
```
|
||||
|
||||
---
|
||||
// Change Log:
|
||||
// - 2026-05-14: Initial SQL delta template based on ADR-009
|
||||
@@ -0,0 +1,45 @@
|
||||
// File: docs/ai-knowledge-base/templates/feature-spec.md
|
||||
# Feature Specification: [Feature Name]
|
||||
|
||||
## 📋 Metadata
|
||||
- **Status**: Draft / In Review / Approved
|
||||
- **Author**: [Name]
|
||||
- **Date**: [YYYY-MM-DD]
|
||||
- **Module**: [e.g., Correspondence, RFA]
|
||||
- **Reference**: [PRD Link / Issue ID]
|
||||
|
||||
## 🎯 1. Overview
|
||||
[อธิบายวัตถุประสงค์สั้นๆ ของฟีเจอร์นี้ และปัญหาที่ต้องการแก้ไข]
|
||||
|
||||
## 📑 2. Requirements
|
||||
- **Functional Requirements**:
|
||||
- [ ] Requirement 1
|
||||
- [ ] Requirement 2
|
||||
- **Non-Functional Requirements**:
|
||||
- [ ] Performance: < 200ms API response
|
||||
- [ ] Security: RBAC 4-Level Check
|
||||
|
||||
## 🏗️ 3. Proposed Solution
|
||||
### Data Model (ADR-019)
|
||||
- Table: `table_name`
|
||||
- Fields: `publicId (UUIDv7)`, `name`, `status`, ...
|
||||
|
||||
### API Endpoints
|
||||
- `POST /v1/[module]/...`
|
||||
- `GET /v1/[module]/:publicId`
|
||||
|
||||
### Workflow / Logic
|
||||
[อธิบายลำดับการทำงาน หรือ Flow Chart]
|
||||
|
||||
## 🛡️ 4. Security & Edge Cases
|
||||
- **Permissions**: ใครสามารถทำอะไรได้บ้าง?
|
||||
- **Edge Cases**: จะเกิดอะไรขึ้นถ้าข้อมูลไม่ครบ? หรือส่งซ้ำ?
|
||||
|
||||
## ✅ 5. Acceptance Criteria
|
||||
- [ ] UI แสดงผลถูกต้องตามแบบ
|
||||
- [ ] API ทำงานได้ตามที่กำหนด
|
||||
- [ ] Unit Test Coverage > 80%
|
||||
|
||||
---
|
||||
// Change Log:
|
||||
// - 2026-05-14: Initial template based on Hybrid Specs
|
||||
@@ -0,0 +1,34 @@
|
||||
// File: docs/ai-knowledge-base/templates/test-case.md
|
||||
# Test Case Specification
|
||||
|
||||
## 📋 Metadata
|
||||
- **Module**: [e.g. Authentication]
|
||||
- **Type**: Unit / Integration / E2E
|
||||
- **Author**: [Name]
|
||||
|
||||
## 🧪 Test Case: [Descriptive Title]
|
||||
### Objective
|
||||
[อธิบายว่าต้องการทดสอบอะไร]
|
||||
|
||||
### Pre-conditions
|
||||
1. User logged in as [Role]
|
||||
2. Data [X] exists in database
|
||||
|
||||
### Test Steps
|
||||
1. Call API `METHOD /v1/...` with data `[Y]`
|
||||
2. Verify response status is `200`
|
||||
3. Verify database record is updated
|
||||
|
||||
### Expected Result
|
||||
- API return success
|
||||
- Audit log is created
|
||||
- No side effects on unrelated data
|
||||
|
||||
### Edge Cases to Cover
|
||||
- Missing `Idempotency-Key`
|
||||
- Unauthorized role access
|
||||
- Invalid UUID format
|
||||
|
||||
---
|
||||
// Change Log:
|
||||
// - 2026-05-14: Initial test case template
|
||||
Reference in New Issue
Block a user