diff --git a/doc/doc-site/docs/off-chain/dss/changelog.md b/doc/doc-site/docs/off-chain/dss/changelog.md index b8760c9b..383505dd 100644 --- a/doc/doc-site/docs/off-chain/dss/changelog.md +++ b/doc/doc-site/docs/off-chain/dss/changelog.md @@ -18,11 +18,12 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- 1. Merge `main` into `dss-stable`. 1. Push annotated tag to head of `dss-stable`. -## [v2.4.0-rc.1][dss-v2.4.0-rc.1] (in progress) +## [v2.4.0-rc.2][dss-v2.4.0-rc.2] (in progress) ### Added - Transaction version field inside levels MQTT events ([#792]). +- Timestamp of last processed transaction in `/data_status` endpoint ([#796]). ### Fixed @@ -290,6 +291,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- [#788]: https://github.com/econia-labs/econia/pull/788 [#792]: https://github.com/econia-labs/econia/pull/792 [#793]: https://github.com/econia-labs/econia/pull/793 +[#796]: https://github.com/econia-labs/econia/pull/796 [docs site readme]: https://github.com/econia-labs/econia/blob/main/doc/doc-site/README.md [dss-v2.1.0-rc.1]: https://github.com/econia-labs/econia/releases/tag/dss-v2.1.0-rc.1 [dss-v2.2.1-rc.1]: https://github.com/econia-labs/econia/releases/tag/dss-v2.2.1-rc.1 diff --git a/src/rust/dbv2/migrations/2024-08-14-160622_add_last_transaction_timestamp_to_data_status/down.sql b/src/rust/dbv2/migrations/2024-08-14-160622_add_last_transaction_timestamp_to_data_status/down.sql new file mode 100644 index 00000000..0d6a40cf --- /dev/null +++ b/src/rust/dbv2/migrations/2024-08-14-160622_add_last_transaction_timestamp_to_data_status/down.sql @@ -0,0 +1,23 @@ +-- This file should undo anything in `up.sql` +DROP VIEW api.data_status; + +CREATE VIEW api.data_status AS +SELECT + CURRENT_TIMESTAMP AS current_time, + processor_status.last_success_version AS processor_last_txn_version_processed, + user_history_last_indexed_txn.txn_version AS aggregator_user_history_last_txn_version_processed, + array_agg(ARRAY[resolution, candlesticks_last_indexed_txn.txn_version]) AS aggregator_candlesticks_last_txn_version_processed +FROM + processor_status, + aggregator.user_history_last_indexed_txn, + aggregator.candlesticks_last_indexed_txn +WHERE + processor_status.processor = 'econia_processor' +GROUP BY + user_history_last_indexed_txn.txn_version, + processor_status.last_success_version; + + +GRANT +SELECT + ON api.data_status TO web_anon; diff --git a/src/rust/dbv2/migrations/2024-08-14-160622_add_last_transaction_timestamp_to_data_status/up.sql b/src/rust/dbv2/migrations/2024-08-14-160622_add_last_transaction_timestamp_to_data_status/up.sql new file mode 100644 index 00000000..4cbd46a8 --- /dev/null +++ b/src/rust/dbv2/migrations/2024-08-14-160622_add_last_transaction_timestamp_to_data_status/up.sql @@ -0,0 +1,25 @@ +-- Your SQL goes here +DROP VIEW api.data_status; + +CREATE VIEW api.data_status AS +SELECT + CURRENT_TIMESTAMP AS current_time, + processor_status.last_transaction_timestamp AS processor_last_txn_timestamp_processed, + processor_status.last_success_version AS processor_last_txn_version_processed, + user_history_last_indexed_txn.txn_version AS aggregator_user_history_last_txn_version_processed, + array_agg(ARRAY[resolution, candlesticks_last_indexed_txn.txn_version]) AS aggregator_candlesticks_last_txn_version_processed +FROM + processor_status, + aggregator.user_history_last_indexed_txn, + aggregator.candlesticks_last_indexed_txn +WHERE + processor_status.processor = 'econia_processor' +GROUP BY + user_history_last_indexed_txn.txn_version, + processor_status.last_success_version, + processor_status.last_transaction_timestamp; + + +GRANT +SELECT + ON api.data_status TO web_anon;