Skip to content
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 account related emails.

Already on GitHub? Sign in to your account

Frontend feature: introduce database and endpoint for app updates in activity log #124

Closed
louilinn opened this issue Jul 1, 2022 · 1 comment · Fixed by #164
Closed
Assignees
Labels

Comments

@louilinn
Copy link
Collaborator

louilinn commented Jul 1, 2022

Related: CirclesUBI/circles-myxogastria#396

Based on meeting with @llunaCreixent we are planning to:

  • add tables in our postgres db for this
  • handle different languages (i.e. have notification message in all relevant languages in database) This introduces question of how new languages gets added in the db structure. It could be one table per language or just columns
  • store id, message translations, date of notification and icon type in the database

Other concerns: How do we enter the information. We need ad admin interface for adding notifications

@louilinn
Copy link
Collaborator Author

louilinn commented Feb 9, 2023

Context and specification:

So from the myxogastria frontend we want to use the core in the same way as for transaction and trust log.
We want to return all notifications using core.activity.getLatest and a filter of 'DISABLED', 'CONNECTIONS', 'OWNERS', 'TRANSFERS', and now 'NEWS'. This method then calls the private method getNotification calling core.utils.requestIndexedDB making graph queries.
We want getNotifiations to have the option to instead call this new API endpoint though a new core.utils.requestNews ,when filter is ActicityFilterType.NEWS.

The simplest way to deal with notifications would be if the response from this API resembles the format of the notifications from the graph when calling core.utils.requestIndexedDB with data = 'activity stream', i.e. calling core.utils.getNotificationsStatus, meaning the response from the graph query:

        query: `{
          notifications(${parameters}) {
            id
            transactionHash
            safeAddress
            type
            time
            trust {
              user
              canSendTo
              limitPercentage
            }
            transfer {
              from
              to
              amount
            }
            hubTransfer {
              from
              to
              amount
            }
            ownership {
              adds
              removes
            }
          }
        }`,

The most important RESPONSE criteria is:

The returned data/response has attribute notifications which is a list of objects

Each of these objects have the following attributes:

  • type which is a string set to `'NEWS'
  • news which is an object containing
    • iconId number
    • message object with:
      • en string
      • later other attributes for translations such as fr
  • time in the same format as timestamps from the graph
  • other a tributes if necessary

Further more we don't want to include inactive news in the response.

Of course there can also be a parsing function in the core to ensure this format. So these are preferences. Let me know what you think.

REQUEST criteria

The query we want to be able to make is guided by the same principles as for the graph notification queries, which has the following parameters:

orderBy: "time",
orderDirection: "desc",
first: ${options.limit},
skip: ${options.offset},
where: {
    time_gt: ${options.timestamp},
    safeAddress: "${options.safeAddress.toLowerCase()}",
    ${filterString ? `type: ${filterString}` : ''}
}
  • we want to always order by time starting with the latest
  • we want to include some options in our request to the endpoint:
    • limit - pagination page size (default 10)
    • offset - pagination start index (default 0)
    • timestamp - show only messages after this time (less important, unsure if we will need it) (default 0, number format preferably the same as the graph accepts)

@llunaCreixent llunaCreixent removed their assignment Mar 13, 2023
@louilinn louilinn assigned llunaCreixent and unassigned louilinn Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants