ores.scheduler.job_definition
Table of Contents
Metadata overlay for a pg_cron cron.job entry. Tracks the job name, cron expression, SQL command, target database, and active state.
DO NOT regenerate this entity at all – every facet is out of sync with
the hand-maintained C++ (the model's own tenant_id=/=schedule_expression=/
=is_active column shapes don't match the hand-written job_definition
struct's actual types: std::optional<boost::uuids::uuid>, cron_expression,
bool. A regenerated tenant_id would come out as the codegen
utility::uuid::tenant_id wrapper, not the hand-written std::optional
type, so even the "safe" domain/repository-entity/mapper facets would
regenerate wrong types, not just wrong formatting) on top of the
deeper repository/service/messaging divergence documented under
** Custom repository methods below.
None of this is modeled here yet; regenerating clobbers it with a
generic CRUD-only stack (and silently wrong column types) that breaks
all of the above. This model needs a proper resync – correcting the
column shapes to match the hand-written struct, then re-adding
repository/messaging support for the four hand-written operations –
before any facet of it can be regenerated safely. The Qt facet is
equally excluded: its generated controllers/dialogs bind to the
hand-maintained scheduler_protocol.hpp classes, so a Qt regen would
emit code against a protocol surface that does not exist. Mirrors
party's hand-maintained-SQL treatment in the refdata drift-fix task,
but wider in scope (no facet is currently safe, not just SQL).
Flags
Columns
id
UUID primary key for the job definition.
party_id
Optional party scope for this job (NULL for tenant-scoped or system jobs).
job_name
Unique name for the scheduled job.
description
Human-readable description of the job.
command
SQL command to execute (used when action_type = execute_sql).
schedule_expression
Cron expression defining the schedule.
action_type
Execution mode: execute_sql or nats_publish.
action_payload
Payload for nats_publish action type.
is_active
1 = active, 0 = paused.
SQL
Flags
C++
Flags
Repository
Domain includes
#include <string>
Conventions
Qt
Detail fields
| field | label | widget | type | is_key | is_required | placeholder |
|---|---|---|---|---|---|---|
| job_name | Job Name | jobNameEdit | line_edit | true | true | Enter unique job name |
| description | Description | descriptionEdit | text_edit | Enter a human-readable description | ||
| command | SQL Command | commandEdit | text_edit | true | Enter the SQL command to execute | |
| schedule_expression | Schedule (cron) | scheduleExpressionEdit | line_edit | true | e.g., 0 * * * * (every hour) | |
| database_name | Database | databaseNameEdit | line_edit | true | Target PostgreSQL database name |
Columns (Qt model)
| enum_name | field | header | type | width |
|---|---|---|---|---|
| JobName | job_name | Job Name | string | 200 |
| Description | description | Description | string | 250 |
| Schedule | schedule_expression | Schedule | string | 150 |
| DatabaseName | database_name | Database | string | 150 |
| Active | is_active | Active | bool | 80 |
| Version | version | Version | int | 60 |
| ModifiedBy | modified_by | Modified By | string | 120 |
Custom repository methods
job_definition_repository.hpphand-implementsread_all_active(used byscheduler_loopto load every job it needs to fire, regardless of tenant) andfind_by_namex2 (used bysave_definition's name-collision dedup so an existing job updates in-place instead of hitting a unique-constraint violation).job_definition_handler.hpphand-implementsschedule=/ =schedule_batch=/=unschedule(domain-named, permission-gated wrappers with custom NATS subjects and a batch-save operation with partial-failure reporting) and a customhistorywhose request/ response shape differs from the generic one and would collide by name if paste-blocked in alongside it. Their protocol structs live in the separate, hand-maintainedscheduler_protocol.hpp, consumed not just by this component's own Qt UI (JobDefinitionController=/ =JobDefinitionMdiWindow=/=JobDefinitionDetailDialog=/ =JobDefinitionAuditDialog) andregistrar.cpp, but cross-component byores.reporting'sreport_scheduling_service.
See also
- ores.scheduler — component group overview.