Project

General

Profile

Actions

User Story #933

open

EPIC #930: CS Trust Score

Feature #931: Trust Score Dashboard

Backend User Story – Trust Score Dashboard API

Added by Islam Mansoori about 1 month ago.

Status:
To Do
Priority:
low
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

User Story

As the ConnectSouq platform, I want to provide a secure API that retrieves a member's Trust Score dashboard information so that members can view their latest reputation metrics accurately.


Business Background

The backend shall expose Trust Score data calculated from verified member activities. The dashboard aggregates the four trust dimensions, trust level, trust token balance, and recent scoring activities according to the Trust Framework.


Functional Requirements

The API shall return:

  • Member ID
  • Total Trust Score
  • Current Trust Level
  • Business Impact Score
  • Community Impact Score
  • Leadership Impact Score
  • Growth Impact Score
  • Progress to Next Level
  • Trust Token Balance
  • Recent Activities
  • Last Calculated Date

Business Rules

  1. Only authenticated users may access the API.
  2. Members can retrieve only their own Trust Score.
  3. Trust Score is calculated from verified activities only.
  4. Trust Level is derived from configured score thresholds.
  5. Trust Token balance must be current.
  6. Activities are returned in descending date order.

Database Changes

Tables

Member_Trust_Score

  • MemberId
  • TotalScore
  • BusinessImpact
  • CommunityImpact
  • LeadershipImpact
  • GrowthImpact
  • TrustLevel
  • TokenBalance
  • LastCalculatedOn

Trust_Score_History

  • ActivityId
  • MemberId
  • ActivityType
  • PointsAwarded
  • Dimension
  • CreatedDate

API Endpoints

GET /api/trust/dashboard

Returns member Trust Dashboard.

GET /api/trust/history

Returns recent Trust activities.


Validation Rules

  • Member must exist.
  • Member account must be active.
  • Dashboard data must be available.
  • Unauthorized access returns 401.
  • Forbidden access returns 403.

Error Handling

Error Response
Member not found 404
Unauthorized 401
Forbidden 403
Internal Server Error 500

Security

  • JWT Authentication
  • Role-based authorization
  • Audit logging
  • API rate limiting

Audit Logs

Capture:

  • Member ID
  • API access time
  • IP Address
  • Device
  • Response status

Acceptance Criteria

  • API returns complete dashboard information.
  • Four Trust Dimensions are returned correctly.
  • Trust Level matches configured thresholds.
  • Token balance is accurate.
  • Response time is under 500 ms for cached requests.
  • Unauthorized users cannot access another member's dashboard.

In Scope (MVP)

  • Dashboard API
  • Trust summary retrieval
  • Activity history retrieval
  • Trust token balance
  • Trust level retrieval
  • Secure authentication
  • Audit logging

Out of Scope

  • Manual score recalculation
  • AI analytics
  • Predictive trust scoring
  • External API integrations
  • Bulk dashboard export

Definition of Done

  • APIs implemented and documented.
  • Business rules validated.
  • Database schema updated.
  • Unit and integration tests completed.
  • Security testing passed.
  • Product Owner approval received.

No data to display

Actions

Also available in: Atom PDF