8000 Add the modification and creation date in the aggregate messages · Issue #470 · aleph-im/pyaleph · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add the modification and creation date in the aggregate messages #470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you accou 8000 nt related emails.

Already on GitHub? Sign in to your account

Closed
aliel opened this issue Aug 31, 2023 · 1 comment · Fixed by #473
Closed

Add the modification and creation date in the aggregate messages #470

aliel opened this issue Aug 31, 2023 · 1 comment · Fixed by #473
Assignees
Labels
enhancement New feature or request

Comments

@aliel
Copy link
Member
aliel commented Aug 31, 2023

To avoid fetching all the messages to find the creation/modification time of a specific aggregate entry it will be useful to have this info directly in the aggregate message

@aliel aliel added the enhancement New feature or request label Aug 31, 2023
@odesenfans
Copy link
Contributor

The solution I suggest is to have a new dictionary in the response of the /api/v0/aggregates endpoint. Currently, the response looks like:

{
  "address": "0xa1B3bb7d2332383D96b7796B908fB7f7F3c2Be10",
  "data": {
    "key1": ...,
    "key2": ...,
  }
}

We could technically add the information about each key directly in the dictionary of each key but a) there is a risk of conflict with the content of the aggregate and b) users may not want this information most of the time.

I suggest to add a new "info" dictionary at the root level that will contain the information for each key. Example:

{
  "address": "0xa1B3bb7d2332383D96b7796B908fB7f7F3c2Be10",
  "data": {
    "key1": ...,
    "key2": ...,
  }
  "info": {
    "key1": {
      "created": ...,
      "last_updated": ...,
      "original_item_hash": ...,
      "last_update_item_hash: ...,
    },
    "key2": ...
  }
}

To avoid querying this field by default, I suggest to add a with_info boolean query parameter that defaults to false.

odesenfans pushed a commit that referenced this issue Oct 6, 2023
Problem :
To avoid fetching all the messages to find the creation/modification time of a specific aggregate entry it will be useful to have this info directly in the aggregate message

Solution:
Update '/api/v0/aggregates' Endpoint

param : 
 - with_info: bool default : False 

From :

```
{
  "address": "0xa1B3bb7d2332383D96b7796B908fB7f7F3c2Be10",
  "data": {
    "key1": ...,
    "key2": ...,
  }
}
```

To:
```
{
  "address": "0xa1B3bb7d2332383D96b7796B908fB7f7F3c2Be10",
  "data": {
    "key1": ...,
    "key2": ...,
  }
  "info": {
    "key1": {
      "created": ...,
      "last_updated": ...,
      "original_item_hash": ...,
      "last_update_item_hash: ...,
    },
    "key2": ...
  }
}
```

Fixes #470.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0