P6: convert monster to BaseDomain + BaseNodeAdapter + concern split

Refactor of monster to use the platform infrastructure (BaseDomain, BaseNodeAdapter,
ChildRouter, commandRegistry, statusBadge). Extracts concerns into
focused modules per .claude/refactor/MODULE_SPLIT.md generic template.
Tests stay green; CONTRACT.md generated; legacy aliases preserved.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
znetsixe
2026-05-10 22:09:25 +02:00
parent 5a43f90569
commit 2a6a0bc34b
12 changed files with 710 additions and 1075 deletions

42
src/schedule/schedule.js Normal file
View File

@@ -0,0 +1,42 @@
'use strict';
// AQUON sample schedule helpers. updateMonsternametijden validates the
// row shape before storing; regNextDate walks the rows to find the next
// future START_DATE for the configured aquonSampleName and counts how
// many of those fall in the current calendar year.
function updateMonsternametijden(m, value) {
if (!m.init || !value || Object.keys(value).length === 0) return;
if (
typeof value[0]?.SAMPLE_NAME !== 'undefined' &&
typeof value[0]?.DESCRIPTION !== 'undefined' &&
typeof value[0]?.SAMPLED_DATE !== 'undefined' &&
typeof value[0]?.START_DATE !== 'undefined' &&
typeof value[0]?.END_DATE !== 'undefined'
) {
m.monsternametijden = value;
regNextDate(m, value);
}
}
function regNextDate(m, monsternametijden) {
let next_date = new Date(new Date().setFullYear(new Date().getFullYear() + 1));
let n_days_remaining = 0;
if (typeof monsternametijden !== 'undefined') {
Object.values(monsternametijden).forEach((line) => {
if (line.START_DATE === 'NULL') return;
const curr_date_conv = new Date(line.START_DATE);
const curr_date = curr_date_conv.getTime();
if (line.SAMPLE_NAME === m.aquonSampleName && curr_date > Date.now()) {
if (curr_date < next_date) next_date = curr_date;
if (new Date().getFullYear() === curr_date_conv.getFullYear()) n_days_remaining++;
}
});
}
m.daysPerYear = n_days_remaining;
m.nextDate = next_date;
}
module.exports = { updateMonsternametijden, regNextDate };