dyne / zenpub

Reflow federated economic network
GNU Affero General Public License v3.0
13 stars 3 forks source link

Backend to timestamp mutations? #61

Open pral2a opened 3 years ago

pral2a commented 3 years ago

Looks like the backend does not provide any timestamp information about when mutation happened to an event or a resource.

The properties available such as hasBeginning, hasEnd or hasPointInTime are only mean to be updated at the client-side.

Could you confirm that is correct?

vcuculo commented 2 years ago

@pral2a are you able to provide a Timestamp? Mutations involving one of these properties seems to ignore such data (ref #66 )

pral2a commented 2 years ago

@vcuculo I'm able to provide timestamp for economicEvents using properties hasEnd, hasPointInTime, hasBeginning. See example below:

mutation {
  createEconomicEvent(
    event: {
      note: "Test produce with time",
      action: "produce",
      resourceInventoriedAs: "01FF0N5ADMKF50V4VB8J7AXDS2",
      provider: "01EYJR67EAYVWRW5Z87HNGN16X",
      receiver: "01EYJR67EAYVWRW5Z87HNGN16X",
      resourceQuantity: {
        hasUnit: "01EVTV5PZEQYQFW34SFHY2M4NN",
        hasNumericalValue: 10
      }
      hasEnd: "2021-09-19T10:00:00Z",
      hasPointInTime: "2021-09-16T10:00:00Z",
      hasBeginning: "2021-09-15T10:00:00Z"
    }
  ) {
  economicEvent {
      id
      note
      action {
        id
      }
      hasEnd
      hasPointInTime
      hasBeginning
      resourceInventoriedAs { # updated details of the existing resource
        id
        name
        onhandQuantity {
          hasNumericalValue
          hasUnit {
            label
            symbol
          }
        }
        accountingQuantity {
          hasNumericalValue
          hasUnit {
            label
            symbol
          }
        }
      }
    }
  }
}
{
  "data": {
    "createEconomicEvent": {
      "economicEvent": {
        "action": {
          "id": "produce"
        },
        "hasBeginning": "2021-09-15T10:00:00.000000Z",
        "hasEnd": "2021-09-19T10:00:00.000000Z",
        "hasPointInTime": "2021-09-16T10:00:00.000000Z",
        "id": "01FFQR6HS3ZH8478DJCY4YR875",
        "note": "Test produce with time",
        "resourceInventoriedAs": {
          "accountingQuantity": {
            "hasNumericalValue": 10,
            "hasUnit": {
              "label": "liter",
              "symbol": "kg"
            }
          },
          "id": "01FF0N5ADMKF50V4VB8J7AXDS2",
          "name": "10kg produced to be consumed",
          "onhandQuantity": {
            "hasNumericalValue": 10,
            "hasUnit": {
              "label": "liter",
              "symbol": "kg"
            }
          }
        }
      }
    }
  }
}

However, I have the same issues for createOffer. due returns null after it's set with a valid ISO8601 timestamp. See example below:

mutation {
  createOffer(intent: {
      action: "transfer",
      name: "Givign Away",
      provider: "01EYJR67EAYVWRW5Z87HNGN16X",
      receiver:"01F3MHQ0KWJC7M19B1E8BXVY46",
      resourceInventoriedAs:"01FF0N5ADMKF50V4VB8J7AXDS2"
      availableQuantity: {hasUnit: "01FFJEBJ4S4E4ZDWZNEWYFZYD7", hasNumericalValue: 10}
      due: "2021-09-20T14:10:20Z"
  }
  ) {
    intent {
      id
      name
      due
    }
  }
}
{
  "data": {
    "createOffer": {
      "intent": {
        "due": null,
        "id": "01FFQRM96YV3EBAQT3FMPGJ1S0",
        "name": "Givign Away"
      }
    }
  }
}