Files
Komediruzecki 01e5ede600 feat: Add comprehensive E2E test specifications for backend modules
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.
2026-04-25 22:05:36 +00:00

5.5 KiB

Receipts Specification

Module: Receipts Version: 2.0 Status: Active Priority: Must

1. Overview

Receipts module handles digital receipt storage, attachment to transactions, and file management.

2. Functional Requirements

2.1. File Management

ID Description Type
R-001 Upload receipt must accept file upload Must
R-002 Upload receipt must validate file type Must
R-003 Upload receipt must validate file size Must
R-004 Upload receipt must generate unique filename Must
R-005 Upload receipt must store file securely Must
R-006 Get receipt must return file data Must
R-007 Get receipt by transaction must return associated receipt Must
R-008 Delete receipt must remove file Must
R-009 Delete receipt must require authentication Must

2.2. Receipt Data

ID Description Type
R-010 Receipt must have unique ID Must
R-011 Receipt must have filename Must
R-012 Receipt must have transaction association Should
R-013 Receipt must have upload date Must
R-014 Receipt must have file size Must
R-015 Receipt must support file format validation Must

2.3. File Type Support

ID Description Type
R-020 Supported formats must include JPEG, PNG, PDF Must
R-021 File size limit must be enforced (e.g., 10MB) Must
R-022 Invalid formats must be rejected Must

2.4. Transaction Association

ID Description Type
R-030 Receipt must be linkable to transactions Must
R-031 Get receipts by transaction must return associated receipts Must
R-032 Transaction must support multiple receipts Should

2.5. File Access

ID Description Type
R-040 Get receipt by filename must return file Must
R-041 Direct file URL must be generated Must
R-042 Access must be authenticated Must

3. Non-Functional Requirements

3.1. Performance

ID Description Target
NFR-001 Upload receipt must complete within 5s (10MB) 5s
NFR-002 Get receipt must complete within 200ms 200ms
NFR-003 Delete receipt must complete within 500ms 500ms

3.2. Data Consistency

ID Description Requirement
NFR-004 File storage must be consistent Always
NFR-005 Filename collisions must be resolved Always

3.3. Security

ID Description Requirement
NFR-006 File uploads must be validated Always
NFR-007 Access to receipts must be authenticated Always
NFR-008 Sensitive data in receipts must be protected Should

4. API Endpoints

Endpoint Method Description
/api/receipts/upload POST Upload receipt file
/api/receipts/:id GET Get receipt by ID
/api/receipts/transaction/:transactionId GET Get receipts by transaction
/api/receipts/file/:filename GET Get receipt file by filename
/api/receipts/:id DELETE Delete receipt

5. Data Models

Receipt:

  • id: string - Receipt UUID
  • filename: string - Original filename
  • storedFilename: string - Stored filename
  • fileSize: number - File size in bytes
  • contentType: string - File content type
  • transactionId: string - Associated transaction ID (optional)
  • createdAt: ISO8601 - Upload timestamp

UploadReceiptResponse:

  • id: string - Receipt UUID
  • filename: string - Stored filename
  • contentType: string - File content type
  • transactionId: string - Transaction ID (optional)

6. User Flows

6.1. Upload Receipt

  1. User opens transaction detail
  2. User clicks "Upload Receipt" button
  3. User selects file (JPEG, PNG, PDF)
  4. System validates file type and size
  5. System generates unique filename
  6. System uploads file
  7. System creates receipt record
  8. System returns receipt ID
  9. System updates transaction with receipt ID

6.2. View Transaction Receipts

  1. User opens transaction detail
  2. System loads associated receipts
  3. System displays receipt thumbnails
  4. User can click to view full receipt

6.3. Delete Receipt

  1. User selects receipt to delete
  2. User confirms deletion
  3. System deletes file
  4. System deletes receipt record
  5. System returns success

7. Exceptional Conditions

Condition Behavior
Invalid file type Return 400 with error message
File too large Return 413 with size limit
File upload fails Return 500 with error message
Receipt ID not found Return 404 Not Found
User not authenticated Return 401 Unauthorized

8. Open/Closed Questions

  1. Should receipts support OCR for metadata extraction?
  2. Should receipts be accessible via URL?
  3. Should receipts support sharing?
  4. Should receipts support automatic deletion after archive?

9. Acceptance Criteria

  • User can upload receipt files
  • File type and size are validated
  • Receipts are stored securely
  • Receipts can be attached to transactions
  • User can view attached receipts
  • User can delete receipts
  • Access to receipts is authenticated
  • Direct file URLs work

10. Dependencies

Component Purpose
File Storage Receipt storage
Transactions Transaction association
Authentication Access control