AOSSIE-Org / AOSSIE-Org/Resonate-Backend

[FEATURE]: Add centralized activity tracking for backend events

Đang mở
#169 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
JavaScript
Star
43
Fork
120
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### Feature and its Use Cases

## Problem

Currently, there is no centralized way to track important backend events such as room creation, user joining, or room deletion. This makes it difficult to monitor system behavior, debug issues, or build analytics features in the future.

## Proposed Solution

Introduce a new backend function `track-activity` to capture and log key user and room-related events in a structured format.

The function will:
- Accept event data such as `eventType`, `userId`, and optional `metadata`
- Log activity in a consistent structure
- Return standardized API responses

Additionally, integrate this tracking into existing functions:
- `create-room`
- `join-room`
- `delete-room`

## Benefits

- Improves observability of backend operations
- Enables future analytics and monitoring
- Lays the foundation for an event-driven architecture
- Helps in debugging and auditing system actions

### Additional Context

## What Needs to Be Done

- Create a new backend function `track-activity`
- Implement safe request parsing using `parseBody`
- Validate required fields (`eventType`, `userId`) using `throwIfMissing`
- Add structured logging for activity events
- Standardize API response format (`success`, `message`, `data`)
- Integrate activity tracking into:
- create-room (ROOM_CREATED)
- join-room (USER_JOINED)
- delete-room (ROOM_DELETED)

### Code of Conduct

- [x] I have joined the [Discord server](https://discord.gg/hjUhu33uAn) and will post updates there
- [x] I have searched existing issues to avoid duplicates

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.