2026-10-08 14:43:34 +00:00
import type { Sequelize } from "sequelize" ;
import { QueryTypes } from "sequelize" ;
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 type { DashboardDetailsQuery , DashboardEntryDTO } from "../../../common/dashboard" ;
import type {
DashboardBlock ,
IAssetDashboardReader ,
IDashboardRepository ,
IInventoryDashboardReader ,
InventoryEntry ,
} from "../../application/dashboard.use-cases" ;
2026-10-10 12:08:54 +00:00
const OPEN_TICKET = "t.state IN ('open','in_progress','waiting')" ;
const PENDING_INTERVENTION = "i.state IN ('pending','in_progress')" ;
2026-10-10 11:32:40 +00:00
const PROFILE_REVIEW = ` p.active=true AND (person.active=0 OR a.status='retired' OR (p.accountId IS NOT NULL AND (
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
account . id IS NULL OR JSON_EXTRACT ( account . \ ` values \` ,' $ .active')<>true OR JSON_UNQUOTE(JSON_EXTRACT(account. \` values \` ,' $ .usage'))='technical'
OR JSON_UNQUOTE ( JSON_EXTRACT ( account . \ ` values \` ,' $ .expiresOn')) < :today
OR NOT EXISTS ( SELECT 1 FROM access_items s WHERE s . id = JSON_UNQUOTE ( JSON_EXTRACT ( account . \ ` values \` ,' $ .systemId')) AND s.kind='system' AND JSON_EXTRACT(s. \` values \` ,' $ .active')=true)
OR ( NULLIF ( JSON_UNQUOTE ( JSON_EXTRACT ( account . \ ` values \` ,' $ .environmentId')),'null') IS NOT NULL AND NOT EXISTS (SELECT 1 FROM access_items e WHERE e.id=JSON_UNQUOTE(JSON_EXTRACT(account. \` values \` ,' $ .environmentId')) AND e.kind='environment' AND JSON_EXTRACT(e. \` values \` ,' $ .active')=true))
OR NOT EXISTS ( SELECT 1 FROM access_items link WHERE link . kind = 'account_person' AND JSON_UNQUOTE ( JSON_EXTRACT ( link . \ ` values \` ,' $ .personId'))=p.personId AND JSON_UNQUOTE(JSON_EXTRACT(link. \` values \` ,' $ .accountId'))=p.accountId AND JSON_UNQUOTE(JSON_EXTRACT(link. \` values \` ,' $ .startDate'))<=:today AND (NULLIF(JSON_UNQUOTE(JSON_EXTRACT(link. \` values \` ,' $ .endDate')),'null') IS NULL OR JSON_UNQUOTE(JSON_EXTRACT(link. \` values \` ,' $ .endDate'))>:today) AND JSON_UNQUOTE(JSON_EXTRACT(link. \` values \` ,' $ .configuration')) IN ('pending','configured'))
) ) ) ` ;
export class SequelizeDashboardRepository implements IDashboardRepository {
constructor (
private readonly database : Sequelize ,
private readonly assets : IAssetDashboardReader ,
private readonly resources : IInventoryDashboardReader
) { }
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
private select < T extends object > (
sql : string ,
query : DashboardDetailsQuery ,
extra : Record < string , string | number | null | string [ ] > = { }
) {
return this . database . query < T > ( sql , {
type : QueryTypes . SELECT ,
replacements : {
companyId : query.companyId ? ? null ,
today : new Date ( ) . toISOString ( ) . slice ( 0 , 10 ) ,
offset : ( query . page - 1 ) * 10 ,
. . . extra ,
} ,
} ) ;
}
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 companyExists ( id : string ) {
const rows = await this . select < { id : string } > ( "SELECT id FROM companies WHERE id=:companyId" , {
companyId : id ,
page : 1 ,
} ) ;
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 rows . length > 0 ;
}
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
private async companies ( query : DashboardDetailsQuery ) {
const [ rows , assets , resources ] = await Promise . all ( [
this . select < {
id : string ;
name : string ;
active : number ;
tickets : number ;
interventions : number ;
people : number ;
} > (
` SELECT c.id,c.name,c.active,(SELECT COUNT(*) FROM tickets t WHERE t.companyId=c.id AND ${ OPEN_TICKET } ) AS tickets,(SELECT COUNT(*) FROM interventions i WHERE i.companyId=c.id AND ${ PENDING_INTERVENTION } ) AS interventions,(SELECT COUNT(*) FROM company_contacts p WHERE p.companyId=c.id) AS people FROM companies c WHERE (:companyId IS NULL OR c.id=:companyId) ORDER BY c.name,c.id ` ,
query
) ,
this . assets . stats ( query . companyId ) ,
this . resources . stats ( 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
return rows . map ( ( row ) = > ( {
id : row.id ,
name : row.name ,
companies : Number ( Boolean ( row . active ) ) ,
tickets : Number ( row . tickets ) ,
interventions : Number ( row . interventions ) ,
people : Number ( row . people ) ,
assets : Number ( assets . find ( ( item ) = > item . companyId === row . id ) ? . count ? ? 0 ) ,
resources : Number ( resources . find ( ( item ) = > item . companyId === row . id ) ? . count ? ? 0 ) ,
} ) ) ;
}
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
private workQuery() {
2026-10-10 12:08:54 +00:00
return ` SELECT t.id,t.companyId,c.name AS companyName,'ticket' AS kind,t.reference,t.subject AS name,t.state AS state,t.priority AS priority,(SELECT MIN(recordedAt) FROM ticket_revisions WHERE ticketId=t.id) AS recordedAt,NULL AS actorName FROM tickets t JOIN companies c ON c.id=t.companyId WHERE ${ OPEN_TICKET } AND (:companyId IS NULL OR t.companyId=:companyId)
UNION ALL SELECT i . id , i . companyId , c . name , 'intervention' , i . reference , i . subject , i . state , t . priority , ( SELECT MIN ( recordedAt ) FROM intervention_revisions WHERE interventionId = i . id ) , NULL FROM interventions i JOIN companies c ON c . id = i . companyId LEFT JOIN tickets t ON t . id = i . ticketId WHERE $ { PENDING_INTERVENTION } AND ( : companyId IS NULL OR i . companyId = : companyId ) ` ;
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
}
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
private async work ( query : DashboardDetailsQuery ) {
const counts = await this . select < { total : number } > (
` SELECT COUNT(*) AS total FROM ( ${ this . workQuery ( ) } ) work ` ,
query
) ;
const items = await this . select < DashboardEntryDTO > (
` SELECT * FROM ( ${ this . workQuery ( ) } ) work ORDER BY FIELD(COALESCE(priority,'normal'),'urgent','high','normal','low'),recordedAt,id LIMIT 10 OFFSET :offset ` ,
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
return { items , total : Number ( counts [ 0 ] ? . total ? ? 0 ) } ;
}
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
private async issues ( query : DashboardDetailsQuery ) {
if ( query . issue === "profile" ) {
const from =
"FROM work_profiles p JOIN companies c ON c.id=p.companyId JOIN company_contacts person ON person.id=p.personId JOIN assets a ON a.id=p.assetId LEFT JOIN access_items account ON account.id=p.accountId" ;
const where = ` WHERE (:companyId IS NULL OR p.companyId=:companyId) AND ${ PROFILE_REVIEW } ` ;
const count = await this . select < { total : number } > (
` SELECT COUNT(*) AS total ${ from } ${ where } ` ,
query
) ;
const items = await this . select < InventoryEntry > (
2026-10-10 11:32:40 +00:00
` SELECT p.id,p.companyId,c.name AS companyName,p.name AS name,NULL AS recordedAt,NULL AS actorName ${ from } ${ where } ORDER BY name,p.id LIMIT 10 OFFSET :offset ` ,
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
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
return {
items : items.map ( ( item ) = > ( {
. . . item ,
kind : "profile" as const ,
reference : null ,
state : null ,
priority : null ,
} ) ) ,
total : Number ( count [ 0 ] ? . total ? ? 0 ) ,
} ;
}
if ( query . issue === "inactive_person" ) {
const assets = await this . assets . inactivePeople ( query . companyId ) ;
const ids = assets . map ( ( item ) = > item . id ) ;
const profileConfigurations = [
"application_configurations" ,
"certificate_configurations" ,
"folder_mappings" ,
"printer_configurations" ,
]
. map (
( table ) = >
2026-10-10 11:32:40 +00:00
` EXISTS (SELECT 1 FROM ${ table } cfg JOIN work_profiles w ON w.id=cfg.profileId WHERE cfg.companyId=p.companyId AND w.personId=p.id AND cfg.state NOT IN ('removed','never_configured')) `
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
)
. join ( " OR " ) ;
2026-10-10 11:32:40 +00:00
const where = ` WHERE p.active=0 AND (:companyId IS NULL OR p.companyId=:companyId) AND (p.id IN (:ids) OR EXISTS (SELECT 1 FROM work_profiles w WHERE w.personId=p.id AND w.active=true) OR EXISTS (SELECT 1 FROM access_items link JOIN access_workspaces ws ON ws.id=link.workspaceId WHERE ws.companyId=p.companyId AND JSON_UNQUOTE(JSON_EXTRACT(link. \` values \` ,' $ .personId'))=p.id AND ((link.kind='need' AND (NULLIF(JSON_UNQUOTE(JSON_EXTRACT(link. \` values \` ,' $ .endDate')),'null') IS NULL OR JSON_UNQUOTE(JSON_EXTRACT(link. \` values \` ,' $ .endDate'))>:today)) OR (link.kind='account_person' AND JSON_UNQUOTE(JSON_EXTRACT(link. \` values \` ,' $ .configuration')) IN ('pending','configured','removal_pending'))))
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
OR EXISTS ( SELECT 1 FROM remote_connections r WHERE r . companyId = p . companyId AND r . personId = p . id AND JSON_UNQUOTE ( JSON_EXTRACT ( r . \ ` values \` ,' $ .state')) NOT IN ('removed','never_configured'))
OR EXISTS ( SELECT 1 FROM mail_configurations m LEFT JOIN work_profiles w ON w . id = m . profileId WHERE m . companyId = p . companyId AND ( m . personId = p . id OR w . personId = p . id ) AND JSON_UNQUOTE ( JSON_EXTRACT ( m . \ ` values \` ,' $ .state')) NOT IN ('removed','never_configured'))
OR $ { profileConfigurations }
2026-10-10 11:32:40 +00:00
OR EXISTS ( SELECT 1 FROM telework_authorizations ta WHERE ta . companyId = p . companyId AND ta . personId = p . id AND ta . active = true AND ( ta . expiresOn IS NULL OR ta . expiresOn >= : today ) ) ) ` ;
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
const extra = { ids : ids.length ? ids : [ "" ] } ;
const count = await this . select < { total : number } > (
` SELECT COUNT(*) AS total FROM company_contacts p ${ where } ` ,
query ,
extra
) ;
const items = await this . select < InventoryEntry > (
` SELECT p.id,p.companyId,c.name AS companyName,p.name,NULL AS recordedAt,NULL AS actorName FROM company_contacts p JOIN companies c ON c.id=p.companyId ${ where } ORDER BY p.name,p.id LIMIT 10 OFFSET :offset ` ,
query ,
extra
) ;
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 {
items : items.map ( ( item ) = > ( {
. . . item ,
kind : "person" as const ,
reference : null ,
state : null ,
priority : null ,
} ) ) ,
total : Number ( count [ 0 ] ? . total ? ? 0 ) ,
} ;
}
const kind = query . issue === "missing_site" || query . kind === "asset" ? "asset" : "resource" ;
const data = await ( kind === "asset" ? this . assets : this.resources ) . entries (
query . companyId ,
query . issue ,
query . page
) ;
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 {
total : data.total ,
items : data.items.map ( ( item ) = > ( {
. . . item ,
kind ,
reference : null ,
state : null ,
priority : null ,
} ) ) ,
} ;
}
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
private async activity ( query : DashboardDetailsQuery ) {
const items : DashboardEntryDTO [ ] = [ ] ;
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
for ( const [ table , revisions , foreignKey , kind ] of [
[ "tickets" , "ticket_revisions" , "ticketId" , "ticket" ] ,
[ "interventions" , "intervention_revisions" , "interventionId" , "intervention" ] ,
] as const ) {
items . push (
. . . ( await this . select < DashboardEntryDTO > (
2026-10-10 12:08:54 +00:00
` SELECT t.id,h.id AS eventId,t.companyId,c.name AS companyName,' ${ kind } ' AS kind,t.reference,h.subject AS name,h.state AS state,NULL AS priority,h.recordedAt,u.name AS actorName FROM ${ revisions } h JOIN ${ table } t ON t.id=h. ${ foreignKey } JOIN companies c ON c.id=t.companyId LEFT JOIN users u ON u.id=h.actorId WHERE (:companyId IS NULL OR t.companyId=:companyId) ORDER BY h.recordedAt DESC,h.id DESC LIMIT 6 ` ,
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
query
) )
) ;
}
for ( const [ service , kind ] of [
[ this . assets , "asset" ] ,
[ this . resources , "resource" ] ,
] as const ) {
items . push (
. . . ( await service . activity ( query . companyId ) ) . map ( ( item ) = > ( {
. . . item ,
kind ,
reference : null ,
state : null ,
priority : null ,
} ) )
) ;
}
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 {
total : Math.min ( items . length , 6 ) ,
items : items
. sort (
( a , b ) = >
( b . recordedAt ? ? "" ) . localeCompare ( a . recordedAt ? ? "" ) || a . id . localeCompare ( b . id )
)
. slice ( 0 , 6 ) ,
} ;
}
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 ) {
switch ( block ) {
case "work" :
return this . work ( query ) ;
case "activity" :
return this . activity ( query ) ;
case "details" :
return this . issues ( query ) ;
case "attention" : {
const kinds = [
"certificate" ,
"license" ,
"profile" ,
"missing_site" ,
"inactive_person" ,
] as const ;
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 {
items : await Promise . all (
kinds . map ( async ( kind ) = > ( {
kind ,
count : ( await this . issues ( { . . . query , issue : kind } ) ) . total ,
} ) )
) ,
} ;
}
case "companies" : {
const items = await this . companies ( 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
return { total : items.length , items } ;
}
case "summary" : {
const items = await this . companies ( 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
return items . reduce (
( sum , item ) = > ( {
companies : sum.companies + item . companies ,
tickets : sum.tickets + item . tickets ,
interventions : sum.interventions + item . interventions ,
assets : sum.assets + item . assets ,
resources : sum.resources + item . resources ,
} ) ,
{ companies : 0 , tickets : 0 , interventions : 0 , assets : 0 , resources : 0 }
) ;
}
}
}
}