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
type Entry = {
eventId? : string ;
id : string ;
companyId : string ;
companyName : string ;
name : string ;
recordedAt : string | null ;
actorName : string | null ;
} ;
/** Consulta definiciones por stockKey, nunca por nombres editables. */
export class ResourceDashboardReader {
constructor ( private readonly database : Sequelize ) { }
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
stats ( companyId? : string ) {
return this . database . query < { companyId : string ; count : number } > (
2026-10-24 23:19:17 +00:00
"SELECT companyId,COUNT(*) AS count FROM resources WHERE companyId IS NOT NULL AND (:companyId IS NULL OR companyId=:companyId) GROUP BY 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
{ type : QueryTypes . SELECT , replacements : { companyId : companyId ? ? 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
async entries ( companyId? : string , issue? : string , page = 1 ) {
const expiry = issue === "certificate" || issue === "license" ;
const join = expiry
2026-10-10 11:32:40 +00:00
? " JOIN resource_definitions d ON d.id=r.templateId JOIN resource_definitions f ON f.stockKey='field:expires' JOIN resource_characteristics expiry ON expiry.resourceId=r.id AND expiry.fieldId=f.id"
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 where =
2026-10-24 23:19:17 +00:00
"WHERE r.companyId IS NOT NULL AND (:companyId IS NULL OR r.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
( expiry
2026-10-10 11:32:40 +00:00
? " AND d.stockKey=:stockKey AND r.active=1 AND expiry.dateValue BETWEEN :today AND :until"
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 today = new Date ( ) . toISOString ( ) . slice ( 0 , 10 ) ;
const until = new Date ( Date . now ( ) + 30 * 86400000 ) . toISOString ( ) . slice ( 0 , 10 ) ;
const replacements = {
companyId : companyId ? ? null ,
stockKey : issue === "certificate" ? "template:certificate" : "template:software_license" ,
today ,
until ,
offset : ( page - 1 ) * 10 ,
} ;
const counts = await this . database . query < { total : number } > (
` SELECT COUNT(*) AS total FROM resources r ${ join } ${ where } ` ,
{ type : QueryTypes . SELECT , replacements }
) ;
const items = await this . database . query < Entry > (
2026-10-10 11:32:40 +00:00
` SELECT r.id,r.companyId,c.name AS companyName,r.name AS name,NULL AS recordedAt,NULL AS actorName FROM resources r JOIN companies c ON c.id=r.companyId ${ join } ${ where } ORDER BY name,r.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
{ type : QueryTypes . SELECT , replacements }
) ;
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 : Number ( counts [ 0 ] ? . total ? ? 0 ) , items } ;
}
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
activity ( companyId? : string ) {
return this . database . query < Entry > (
2026-10-24 23:19:17 +00:00
"SELECT r.id,h.id AS eventId,r.companyId,c.name AS companyName,r.name AS name,h.recordedAt,u.name AS actorName FROM resource_revisions h JOIN resources r ON r.id=h.resourceId JOIN companies c ON c.id=r.companyId LEFT JOIN users u ON u.id=h.actorId WHERE r.companyId IS NOT NULL AND (:companyId IS NULL OR r.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
{ type : QueryTypes . SELECT , replacements : { companyId : companyId ? ? null } }
) ;
}
}