<style> .ui-infobar, #doc.markdown-body { max-width: 1200px; } .mermaid svg { height: auto; } </style> # Statistics Service [Lucidchart Folder](https://lucid.app/folder/invitations/accept/inv_6e2aefdf-4a0b-4457-bfef-0d4d2e47126b) ## Table of Contents [TOC] # Statistics Service #### Description: Desc here. ![Architecture](https://lucid.app/publicSegments/view/41cf7d6b-b1ac-412e-8f75-666f971e044d/image.png) #### Requirements - Target sdk: .net 6.0 ```sequence Alice->Bob: Hello Bob, how are you? Note right of Bob: Bob thinks Bob-->Alice: I am good thanks! Note left of Alice: Alice responds Alice->Bob: Where have you been? ``` User stories --- Ref: https://cucumber.io/docs/gherkin/reference/ ```gherkin= Feature: Payments As a ..., I want to ..., based on ... Scenario: Post payments When something happens Given a state Then Do something ``` ## Backend ### Description: ASP.NET 6 based backend. ## Controllers #### General Controller Design GetItemByResourceId v1/{item}/{resourceId}/?type={type}&take={take}&skip={skip}&fromDate={fromDate}&toDate={toDate} **item** = Receivables, Statements, Invoices and Payments. **resourceId** = id of requested company/resource. **type** = hour, day or month **take** = number of entries to return **skip** = number of entries to skip **fromDate** = earliest date to be included **toDate**= latest date to be included ##### Example controller: ReceivablesController GetReceivablesByResourceId v1/receivables/{resourceId}?type={type}&take={take}&skip={skip}&fromDate={fromDate}&toDate={toDate} #### Endpoints: ##### Example generic endpoint: v1/{item}/{resourceId}/?type={type}&take={take}&skip={skip}&fromDate={fromDate}&toDate={toDate} #### Requirements - Target SDK: .net 6.0 - ASP NET Web Core API ## Possible resource schema ```json { parentId: string, childrenIds: [childId1: string, childId2: string], timestamp: DateTime, type: ResourceType, data: { amount: integer } } ``` ## Frontend #### Description: Frontend built for displaying statistics for clients on ZData products. #### Requirements - [React](https://reactjs.org/) - [ZData Identity Server](https://id.dev.zdata.io/) Handles all authentication / authorization. - [ZData Access Management](https://zam.internal.zdata.io/docs) Handles access control. - [React-query](https://react-query.tanstack.com/) Hooks built for React for fetching, caching and synchronizing of asynchronous data. Easy to implement and acts as a global state manager as well. - [Zustand](https://github.com/pmndrs/zustand) Lightweight library used to deal with client-side state management. ### Views Should have two views, one for ZData Admins (internal) and one for clients (external). The views are based on your role in Identity Server (or ZAM (userrole-zdataadmin)).