Orders Event Log

Author

Serhii Nosko

JIRA task

https://folio-org.atlassian.net/browse/UXPROD-3215 - Display a history of edits for the Order and Order line records

Business Requirements
Architects Review

DONE

PO review

DONE

Revision History

Version

Date

Owner

Description

Reason

v1.006.17.2022Initial versionAdd DB schemas 

Overview

Problems

Todo

In scope

Todo

Out Of Scope

Todo

Architecturally Significant Requirements

Solution Design

The overall architectural solution and analyzed requirements are available at Acquisition Event Log.

Data Model

The Event Log for Acquisition will be located in the mod-audit module; accordingly, the data schemas and tables described in this document are also for mod-audit.

There will be 2 separate tables - one for orders, another one for order lines. These tables will be placed in the mod_audit schema. Therefore, this is not expected to lead to confusion with the tables used to store actual orders. However, it may be useful to have some kind of prefix/suffix in the name that highlights the sense of the table. So, table naming follows the pattern - <domain name>_<entity name>_log

acquisition_order_log

Data Model and Data example for this table:

ColumnColumn Data TypeSenseIs mandatory?Is unique?Column Data Example
EventIdUUIDHow to identify an event?YYc4abf6c3-4bd5-4464-999b-c66cfb6f1cf9
EventDateDateWhen was the event captured in Event Log?YN2022-11-10T09:22:15.808Z
ActionDateDateWhen did the event happen?YN2022-11-10T09:22:15.808Z
ActionStringWhat was the event type?YNCREATE/EDIT
OrderIdUUIDWhat order does the event belong to?YN5f8a321e-6b38-4d90-92d4-bf08f91a2242
UserIdUUIDWho initiated the event?YN58edf8c3-89e4-559c-9aed-aae637a3f40b
ModifiedContentSnapshotJson-bWhat is the new order value?NN
{
    "id": "c4abf6c3-4bd5-4464-999b-c66cfb6f1cf9",
    "tags": {
        "tagList": [
            "amazon"
        ]
    },
    "notes": [
        "Check credit card statement to make sure payment shows up"
    ],
    "billTo": "5f8a321e-6b38-4d90-92d4-bf08f91a2242",
    "shipTo": "f7c36792-05f7-4c8c-969d-103ac6763187",
    "vendor": "e0fb5df2-cdf1-11e8-a8d5-f2801f1b9fd1",
    "approved": true,
    "manualPo": false,
    "metadata": {
        "createdDate": "2022-11-10T09:22:15.808Z",
        "updatedDate": "2022-11-10T09:29:00.578Z",
        "createdByUserId": "58edf8c3-89e4-559c-9aed-aae637a3f40b",
        "updatedByUserId": "58edf8c3-89e4-559c-9aed-aae637a3f40b"
    },
    "poNumber": "pref10000suf",
    "template": "4dee318b-f5b3-40dc-be93-cc89b8c45b6f",
    "orderType": "One-Time",
    "acqUnitIds": [],
    "reEncumber": true,
    "poNumberPrefix": "pref",
    "poNumberSuffix": "suf",
    "workflowStatus": "Pending"
}

acquisition_order_line_log

Data Model and Data example for this table:

ColumnColumn Data TypeSenseIs mandatory?Is unique?Column Data Example
EventIdUUIDHow to identify an event?YY7f907515-a1bf-4513-8a38-92e1a07c539d
EventDateDateWhen was the event captured in Event Log?YN2022-11-10T09:28:08.367Z
ActionDateDateWhen did the event happen?YN2022-11-03T00:00:00.000+00:00
ActionStringWhat was the event type?YNCREATE/EDIT
OrderIdUUIDWhat order does the event belong to?YNqwart6c3-tyd5-4464-999b-c66cfb6f1cf9
OrderLineIdUUIDWhat POL does the event belong to?YNee0b9edb-5508-5f3e-a33b-0adb42fdcdc5
UserIdUUIDWho initiated the event?YN58edf8c3-89e4-559c-9aed-aae637a3f40b
ModifiedContentSnapshotJson-bWhat is the new order value?NN
{
    "id": "b86ee25c-2ba5-4c08-a2c2-7b5f6b9547de",
    "cost": {
        "currency": "USD",
        "discount": 1,
        "discountType": "percentage",
        "listUnitPrice": 10,
        "additionalCost": 3,
        "quantityPhysical": 1,
        "poLineEstimatedPrice": 12.9
    },
    "rush": true,
    "tags": {
        "tagList": [
            "important"
        ]
    },
    "donor": "donor",
    "alerts": [],
    "claims": [],
    "source": "User",
    "details": {
        "productIds": [
            {
                "productId": "123",
                "qualifier": "Qualifier",
                "productIdType": "7f907515-a1bf-4513-8a38-92e1a07c539d"
            }
        ],
        "receivingNote": "Some receiving note",
        "subscriptionTo": "2022-11-11T00:00:00.000+00:00",
        "subscriptionFrom": "2022-11-03T00:00:00.000+00:00",
        "subscriptionInterval": 0
    },
    "edition": "rew",
    "metadata": {
        "createdDate": "2022-11-10T09:28:08.367Z",
        "updatedDate": "2022-11-10T10:16:53.804Z",
        "createdByUserId": "58edf8c3-89e4-559c-9aed-aae637a3f40b",
        "updatedByUserId": "58edf8c3-89e4-559c-9aed-aae637a3f40b"
    },
    "physical": {
        "volumes": [],
        "receiptDue": "2022-11-24T00:00:00.000+00:00",
        "materialType": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
        "createInventory": "Instance, Holding, Item",
        "materialSupplier": "e0fb5df2-cdf1-11e8-a8d5-f2801f1b9fd1",
        "expectedReceiptDate": "2022-11-30T00:00:00.000+00:00"
    },
    "selector": "selector",
    "isPackage": false,
    "locations": [
        {
            "quantity": 1,
            "locationId": "fcd64ce1-6995-48f0-840e-89ffa2288371",
            "quantityPhysical": 1
        }
    ],
    "publisher": "Library",
    "requester": "requester",
    "collection": true,
    "description": "internal note",
    "orderFormat": "Physical Resource",
    "receiptDate": "2022-11-11T00:00:00.000+00:00",
    "checkinItems": false,
    "contributors": [
        {
            "contributor": "Sport",
            "contributorNameTypeId": "2e48e713-17f3-4c13-a9f8-23845bb210aa"
        }
    ],
    "poLineNumber": "pref10000suf-1",
    "vendorDetail": {
        "instructions": "Instructions to vendor\n",
        "vendorAccount": "1234",
        "referenceNumbers": [
            {
                "refNumber": "1234",
                "refNumberType": "Vendor continuation reference number"
            }
        ]
    },
    "paymentStatus": "Payment Not Required",
    "receiptStatus": "Pending",
    "reportingCodes": [],
    "titleOrPackage": "Sport",
    "automaticExport": true,
    "purchaseOrderId": "c4abf6c3-4bd5-4464-999b-c66cfb6f1cf9",
    "fundDistribution": [
        {
            "code": "AFRICAHIST",
            "value": 100,
            "fundId": "7fbd5d84-62d1-44c6-9c45-6cb173998bbd",
            "expenseClassId": "1bcc3247-99bf-4dca-9b0f-7bc51a2998c2",
            "distributionType": "percentage"
        }
    ],
    "acquisitionMethod": "306489dd-0053-49ee-a068-c316444a8f55",
    "poLineDescription": "Line description\n",
    "cancellationRestriction": true,
    "cancellationRestrictionNote": "Cancellation description\n"
}