dodil/erp-brick-consolidation

DODIL ERP brick: consolidation

src/brick_consolidation/domain/migration_run.py

"""The MigrationRun aggregate — the rules, and nothing else.

one Odoo consolidation load, its checks and its signature

No database, no HTTP, no identity: a rule here is true whoever calls it and however it is stored.
Generated by `erp-compose scaffold` from module.yaml; the TODO lines are the work left.
"""
from dataclasses import dataclass, field
from datetime import datetime
from typing import Optional


@dataclass
class MigrationRun:
    """one Odoo consolidation load, its checks and its signature"""
    run_id: str
    status: str = ""
    doors_json: str = ""
    checks_json: str = ""
    signed_by: str = ""
    signed_at: Optional[datetime] = None
    checksums: str = ""
    events: list = field(default_factory=list, repr=False, compare=False)

    def _record(self, event):
        self.events.append(event)
        return event