feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
import { UniqueID } from "@repo/rdx-ddd";
|
|
|
|
|
import { Result } from "@repo/rdx-utils";
|
|
|
|
|
|
|
|
|
|
import type { DashboardDetailsQuery, DashboardEntryDTO } from "../../common/dashboard";
|
|
|
|
|
import { CompanyError } from "../domain/company-error";
|
|
|
|
|
|
|
|
|
|
export type InventoryEntry = Pick<
|
|
|
|
|
DashboardEntryDTO,
|
|
|
|
|
"id" | "companyId" | "companyName" | "name" | "recordedAt" | "actorName" | "eventId"
|
|
|
|
|
>;
|
2026-10-10 10:01:58 +00:00
|
|
|
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
export interface IInventoryDashboardReader {
|
|
|
|
|
stats(companyId?: string): Promise<{ companyId: string; count: number }[]>;
|
|
|
|
|
entries(
|
|
|
|
|
companyId?: string,
|
|
|
|
|
issue?: string,
|
|
|
|
|
page?: number
|
|
|
|
|
): Promise<{ items: InventoryEntry[]; total: number }>;
|
|
|
|
|
activity(companyId?: string): Promise<InventoryEntry[]>;
|
|
|
|
|
}
|
2026-10-10 10:01:58 +00:00
|
|
|
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
export interface IAssetDashboardReader extends IInventoryDashboardReader {
|
|
|
|
|
inactivePeople(companyId?: string): Promise<{ id: string }[]>;
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-15 09:50:01 +00:00
|
|
|
export type DashboardBlock = "summary" | "attention" | "activity" | "companies" | "details";
|
2026-10-10 10:01:58 +00:00
|
|
|
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
export interface IDashboardRepository {
|
|
|
|
|
companyExists(id: string): Promise<boolean>;
|
|
|
|
|
read(block: DashboardBlock, query: DashboardDetailsQuery): Promise<unknown>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class DashboardUseCases {
|
|
|
|
|
constructor(private readonly repository: IDashboardRepository) {}
|
2026-10-10 10:01:58 +00:00
|
|
|
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
async read(block: DashboardBlock, query: DashboardDetailsQuery) {
|
|
|
|
|
let normalized = query;
|
2026-10-10 10:01:58 +00:00
|
|
|
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
if (query.companyId) {
|
|
|
|
|
const id = UniqueID.create(query.companyId);
|
2026-10-10 10:01:58 +00:00
|
|
|
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
if (!id.isSuccess) {
|
|
|
|
|
return Result.fail(new CompanyError("INVALID_REQUEST"));
|
|
|
|
|
}
|
|
|
|
|
if (!(await this.repository.companyExists(id.data.toPrimitive()))) {
|
|
|
|
|
return Result.fail(new CompanyError("COMPANY_NOT_FOUND"));
|
|
|
|
|
}
|
|
|
|
|
normalized = { ...query, companyId: id.data.toPrimitive() };
|
|
|
|
|
}
|
2026-10-10 10:01:58 +00:00
|
|
|
|
feat(dashboard): implement dashboard schemas and API integration
- Added Zod schemas for dashboard queries, entries, summaries, and companies.
- Created dashboard API functions for fetching summary, work, attention, activity, and companies data.
- Developed dashboard components including BlockState, DashboardDetailsDialog, and DashboardPage for rendering dashboard information.
- Implemented quick create functionality for companies, tickets, interventions, assets, and resources.
- Introduced a new ResourceDashboardReader for querying resource-related data.
- Added a StatisticCard component for displaying key performance indicators in the dashboard.
2026-10-08 11:27:27 +00:00
|
|
|
return Result.ok(await this.repository.read(block, normalized));
|
|
|
|
|
}
|
|
|
|
|
}
|