Skip to content

[BE-35] Add Resource Usage Tracker service for per-session consumption logging #974

@devwums

Description

@devwums

Problem

Per-session resource consumption (printing credits, internet data, locker usage) has no tracking mechanism. Resource abuse goes undetected.

Proposed Solution

Create backend/cntr/resource-usage.service.ts exporting: ResourceType union ('PRINT' | 'INTERNET' | 'LOCKER'), ResourceUsageLog interface ({ sessionId, memberId, resourceType: ResourceType, quantity: number, unit: string, recordedAt: string }), and createUsageLog(sessionId: string, memberId: string, resourceType: ResourceType, quantity: number, unit: string): ResourceUsageLog. Throws RangeError if quantity <= 0. All implementation must live inside backend/cntr/.

Acceptance Criteria

  • File at backend/cntr/resource-usage.service.ts
  • recordedAt is new Date().toISOString()
  • Throws RangeError for quantity <= 0
  • Exports ResourceType union and ResourceUsageLog interface
  • Unit test at backend/cntr/resource-usage.service.spec.ts

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions