29 lines
841 B
TypeScript
29 lines
841 B
TypeScript
import 'dotenv/config';
|
|
import db from '../src/database/models/index.js';
|
|
|
|
async function main() {
|
|
const { sequelize, SLANotificationDispatch, SLATracking } = db;
|
|
await sequelize.authenticate();
|
|
const count = await SLANotificationDispatch.count();
|
|
const activeTracks = await SLATracking.count({ where: { isActive: true, endTime: null } });
|
|
const recent = await SLANotificationDispatch.findAll({
|
|
limit: 15,
|
|
order: [['sentAt', 'DESC']]
|
|
});
|
|
console.log('dispatches:', count, 'active tracks:', activeTracks);
|
|
for (const r of recent) {
|
|
console.log(
|
|
r.dispatchType,
|
|
r.thresholdKey,
|
|
String(r.trackingId).slice(0, 8),
|
|
r.sentAt
|
|
);
|
|
}
|
|
await sequelize.close();
|
|
}
|
|
|
|
main().catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
});
|