mirror of
https://github.com/Komediruzecki/token-circles.git
synced 2026-10-20 09:46:43 +02:00
Added 18 E2E test specifications following EARS format for all backend modules: New Specs Created: - tags.spec.md (56 tests) - Tag CRUD, hierarchy, filtering, grouping - receipts.spec.md (57 tests) - Receipts, OCR, splitting, sharing, export - recurring.spec.md (57 tests) - Recurrence patterns, scheduling, timezone - reports.spec.md (62 tests) - Custom reports, export, scheduling, comparison - calculator.spec.md (54 tests) - Financial calculators, conversions, schedules Existing Specs Reviewed: - All existing backend specs validated and organized - Each spec includes Must/Should priorities, test types, steps, validations - Consistent formatting across all 18 specifications Each spec covers: - CRUD operations - Data validation - Performance testing - Error handling - Integration tests - Cross-user data isolation - Acceptance criteria Format: EARS-compliant with test IDs, priorities, types (Positive/Negative/Integration/Performance), detailed steps, validations, and expected results.
7.2 KiB
7.2 KiB
Budgets Specification
Module: Budgets Version: 2.0 Status: Active Priority: Must
1. Overview
Budgets define spending limits for categories within specific time periods.
2. Functional Requirements
2.1. CRUD Operations
| ID | Description | Type |
|---|---|---|
| BU-001 | Get all budgets must return list of budgets | Must |
| BU-002 | Get single budget by ID must return budget data | Must |
| BU-003 | Create budget must validate required fields | Must |
| BU-004 | Create budget must return newly created budget | Must |
| BU-005 | Update budget must allow updating budget data | Must |
| BU-006 | Update budget must return updated budget | Must |
| BU-007 | Delete budget must remove budget | Must |
2.2. Budget Data
| ID | Description | Type |
|---|---|---|
| BU-010 | Budget must have required fields (categoryId, amount, period) | Must |
| BU-011 | Budget must have category | Must |
| BU-012 | Budget must have spending limit amount | Must |
| BU-013 | Budget must have time period | Must |
| BU-014 | Budget must have current spending amount | Must |
| BU-015 | Budget must show remaining amount | Must |
| BU-016 | Budget must show budget used percentage | Should |
| BU-017 | Budget must have name/label | Should |
2.3. Budget Periods
| ID | Description | Type |
|---|---|---|
| BU-020 | Period must support month, year, custom | Must |
| BU-021 | Custom period must have start and end dates | Must |
| BU-022 | Period must be calendar-based | Must |
2.4. Budget Alerts
| ID | Description | Type |
|---|---|---|
| BU-030 | Budget alerts must notify when spending exceeds threshold | Must |
| BU-031 | Alert thresholds must be configurable | Should |
| BU-032 | Over-budget indicators must be visible | Should |
| BU-033 | Alerts must show amount exceeded | Should |
2.5. Budget Analysis
| ID | Description | Type |
|---|---|---|
| BU-040 | Budget forecast must project spending | Should |
| BU-041 | Zero-based budget support must be available | Should |
| BU-042 | Budget improvements suggestions must be provided | Should |
| BU-043 | Historical budget data must be available | Should |
2.6. Budget Management
| ID | Description | Type |
|---|---|---|
| BU-050 | Create budget from existing expenses must be supported | Should |
| BU-051 | Duplicate last budget must be supported | Should |
| BU-052 | Allocate remaining budget must be supported | Should |
2.7. Budget Comparison
| ID | Description | Type |
|---|---|---|
| BU-060 | Compare budgets across periods must be supported | Should |
3. Non-Functional Requirements
3.1. Performance
| ID | Description | Target |
|---|---|---|
| NFR-001 | Get all budgets must complete within 100ms | 100ms |
| NFR-002 | Get budget alerts must complete within 100ms | 100ms |
| NFR-003 | Create budget must complete within 50ms | 50ms |
3.2. Data Consistency
| ID | Description | Requirement |
|---|---|---|
| NFR-004 | Budget calculations must be accurate | Always |
| NFR-005 | Budget period boundaries must be respected | Always |
3.3. Security
| ID | Description | Requirement |
|---|---|---|
| NFR-006 | Budget access must be scoped to user | Always |
4. API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/budgets |
GET | Get all budgets |
/api/budgets |
POST | Create new budget |
/api/budgets/:id |
GET | Get single budget |
/api/budgets/:id |
PUT | Update budget |
/api/budgets/:id |
DELETE | Delete budget |
/api/budgets/alerts |
GET | Get budget alerts |
/api/budgets/history |
GET | Get budget history |
/api/budgets/forecast |
GET | Get budget forecast |
/api/budgets/summary |
GET | Get budget summary |
/api/budgets/zero-based |
GET | Get zero-based budgets |
/api/budgets/zero-based/summary |
GET | Get zero-based budget summary |
/api/budgets/improvements |
GET | Get budget improvement suggestions |
/api/budgets/from-expenses |
POST | Create budget from expenses |
/api/budgets/duplicate-last |
POST | Duplicate last budget |
/api/budgets/allocate |
POST | Allocate remaining budget |
5. Data Models
Budget:
id: string- Budget UUIDcategoryId: string- Category IDcategoryName: string- Category nameamount: number- Budgeted amountcurrentSpending: number- Current spendingremaining: number- Remaining amountperiod: string- Period type (month, year, custom)periodStart: ISO8601- Period start dateperiodEnd: ISO8601- Period end dateusedPercentage: number- Percentage used (0-100)status: string- Status (active, closed)createdAt: ISO8601- Creation timestampupdatedAt: ISO8601- Last update timestamp
BudgetAlert:
id: string- Alert UUIDbudgetId: string- Associated budget IDcategoryId: string- Category IDcategoryName: string- Category namealertType: string- Alert type (warning, critical, exceeded)currentSpending: number- Current spendingbudgetAmount: number- Budget amountexceededAmount: number- Amount exceededthreshold: number- Alert threshold (percentage)createdAt: ISO8601- Alert created timestamp
6. User Flows
6.1. Create Budget
- User opens Budgets page
- User clicks "Add Budget" button
- Modal displays budget creation form
- User selects category and enters amount
- User selects period (month or year)
- User can optionally set alert threshold
- System validates input
- System calculates current spending from transactions
- System creates budget
- System returns budget with confirmation
6.2. View Budget Alerts
- User opens Dashboard
- System loads budget alerts
- System displays alerts sorted by severity
- System shows exceeded amounts
6.3. Delete Budget
- User selects budget to delete
- User confirms deletion
- System deletes budget
- System returns success confirmation
6.4. Create Budget from Expenses
- User opens Budgets page
- User clicks "Create from Expenses" button
- System loads historical spending by category
- User selects categories and amounts
- System creates budget
- System returns created budgets
7. Exceptional Conditions
| Condition | Behavior |
|---|---|
| Category already has budget for period | Return 400 with error message |
| Budget ID not found | Return 404 Not Found |
| Invalid period dates | Return 400 with error message |
| Amount cannot be negative | Return 400 with error message |
8. Open/Closed Questions
- Should budgets support category overrides?
- Should budgets support roll-over to next period?
- Should budgets sync with transaction updates automatically?
- Should budgets support global vs category-specific alerts?
9. Acceptance Criteria
- User can create budgets for categories
- User can set budget amounts
- User can select budget period (month/year)
- Current spending is calculated correctly
- Remaining amount is calculated correctly
- Over-budget indicators are visible
- Budget alerts notify when threshold exceeded
- User can update budget details
- User can delete budgets
- User can create budgets from expenses
- Budgets are scoped to user