Sprtch / despinassy

🗄️ Database Schema collection and shared library repository
MIT License
0 stars 0 forks source link

Printer and Barcode table #9

Closed tperale closed 3 years ago

tperale commented 3 years ago

Let erie and victoria access their own table of the database to log data about respectively their barcode and their printer stat and settings.

Printer

The printer table store the typical setting of the printer.

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    type = db.Column(db.Enum(PrinterTypeEnum), nullable=False)
    width = db.Column(db.Integer)
    height = db.Column(db.Integer)
    dialect = db.Column(db.Enum(PrinterDialectEnum), nullable=False)
    name = db.Column(db.String(50), nullable=False)
    redis = db.Column(db.String(50))
    settings = db.Column(db.JSON)

    created_at = db.Column(db.DateTime, default=datetime.datetime.utcnow)
    updated_at = db.Column(db.DateTime, onupdate=datetime.datetime.utcnow)

PrinterTransaction

Each printer interaction should be logged in the PrinterTransaction table logging which part has been printed and the number of time it is printer.

Simply save the json message received by the printer in the database.

Scanner

ScannerTransaction

Save each interaction with the barcode scanner. I still don't know if I should save every barcode scanned or exclude the commands. The mode the printer was in at the moment of scan is maybe an interesting value.

Channel

This table represent the interconnection between a printer (consumer) and Huron/barcode scanners (producer)

tperale commented 3 years ago

The commit https://github.com/Sprtch/despinassy/commit/58dd5203f3a3a88ecb2821f907e3a2d37fbfab07 is introducing the first draft of a transaction logging scheme in the database. I'm still not convinced with the way the "PrinterTransaction" are logged maybe having fields that mimic the IPCMESSAGE schema is a better way to do it or having reference directly to the printed part. The second way is more performant because we need to log less information and the Part table can directly access all its related transaction but its impossible to log custom parts.

There are multiple way to do deal with this:

tperale commented 3 years ago

The field "update_at" should be updated when a new transaction is added in the ScannerTransaction table.