Skip to content
Snippets Groups Projects
Commit 2ebb6366 authored by jm's avatar jm
Browse files

[ref] gva: rename commonTime to blockchainTime

parent 4c0c2d40
No related branches found
No related tags found
1 merge request!240Resolve "GVA: rename commonTime field to blockchainTime"
......@@ -86,7 +86,7 @@ type Block {
membersCount: Int!
number: Int!
hash: String!,
commonTime: DateTimeUtc!
blockchainTime: DateTimeUtc!
powMin: Int!
}
......@@ -104,7 +104,7 @@ type CurrentUd {
amount: Int!
base: Int!
blockNumber: Int!
commonTime: DateTimeUtc!
blockchainTime: DateTimeUtc!
membersCount: Int!
monetaryMass: Int!
}
\ No newline at end of file
......@@ -35,7 +35,7 @@ pub struct Block {
members_count: i32,
number: i32,
hash: String,
common_time: NaiveDateTime,
blockchain_time: NaiveDateTime,
pow_min: i32,
}
......@@ -67,7 +67,7 @@ impl Block {
.hash()
.unwrap_or_else(|| fatal_error!("BlockDb without hash."))
.to_string(),
common_time: NaiveDateTime::from_timestamp(block_db.block.common_time() as i64, 0),
blockchain_time: NaiveDateTime::from_timestamp(block_db.block.common_time() as i64, 0),
pow_min: block_db.block.pow_min() as i32,
})
}
......@@ -102,11 +102,11 @@ impl super::super::BlockFields for Block {
Ok(&self.hash)
}
#[inline]
fn field_common_time(
fn field_blockchain_time(
&self,
_executor: &Executor<'_, QueryContext>,
) -> FieldResult<&NaiveDateTime> {
Ok(&self.common_time)
Ok(&self.blockchain_time)
}
#[inline]
fn field_pow_min(&self, _executor: &Executor<'_, QueryContext>) -> FieldResult<&i32> {
......
......@@ -23,7 +23,7 @@ pub struct CurrentUd {
pub amount: i32,
pub base: i32,
pub block_number: i32,
pub common_time: NaiveDateTime,
pub blockchain_time: NaiveDateTime,
pub members_count: i32,
pub monetary_mass: i32,
}
......@@ -35,7 +35,7 @@ impl CurrentUd {
amount: current_du_db.amount as i32,
base: current_du_db.base as i32,
block_number: current_du_db.block_number.0 as i32,
common_time: NaiveDateTime::from_timestamp(current_du_db.common_time as i64, 0),
blockchain_time: NaiveDateTime::from_timestamp(current_du_db.common_time as i64, 0),
members_count: current_du_db.members_count as i32,
monetary_mass: current_du_db.monetary_mass as i32,
}
......@@ -56,11 +56,11 @@ impl super::super::CurrentUdFields for CurrentUd {
Ok(&self.block_number)
}
#[inline]
fn field_common_time(
fn field_blockchain_time(
&self,
_executor: &Executor<'_, QueryContext>,
) -> FieldResult<&NaiveDateTime> {
Ok(&self.common_time)
Ok(&self.blockchain_time)
}
#[inline]
fn field_members_count(&self, _executor: &Executor<'_, QueryContext>) -> FieldResult<&i32> {
......
......@@ -86,7 +86,7 @@ mod tests {
tests::test_gql_query(
schema.clone(),
"{ block { commonTime, currency, hash, issuer, issuerName, number, version } }",
"{ block { blockchainTime, currency, hash, issuer, issuerName, number, version } }",
json!({
"errors": [{
"message": "Field \"block\" argument \"number\" of type \"Int!\" is required but not provided",
......@@ -100,11 +100,11 @@ mod tests {
tests::test_gql_query(
schema,
"{ block(number: 42) { commonTime, currency, hash, issuer, issuerName, issuersCount, number, powMin, version } }",
"{ block(number: 42) { blockchainTime, currency, hash, issuer, issuerName, issuersCount, number, powMin, version } }",
json!({
"data": {
"block": {
"commonTime": 1_488_987_127.0,
"blockchainTime": 1_488_987_127.0,
"currency": "test_currency",
"hash": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"issuer": "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
......
......@@ -124,7 +124,7 @@ mod tests {
}
fn block_0_json() -> serde_json::Value {
json!({
"commonTime": 1_488_987_127.0,
"blockchainTime": 1_488_987_127.0,
"currency": "test_currency",
"hash": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"issuer": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
......@@ -147,7 +147,7 @@ mod tests {
}
fn block_1_json() -> serde_json::Value {
json!({
"commonTime": 1_488_987_128.0,
"blockchainTime": 1_488_987_128.0,
"currency": "test_currency",
"hash": "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
"issuer": "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
......@@ -170,7 +170,7 @@ mod tests {
}
fn block_2_json() -> serde_json::Value {
json!({
"commonTime": 1_488_987_129.0,
"blockchainTime": 1_488_987_129.0,
"currency": "test_currency",
"hash": "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC",
"issuer": "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC",
......@@ -193,7 +193,7 @@ mod tests {
}
fn block_3_json() -> serde_json::Value {
json!({
"commonTime": 1_488_987_130.0,
"blockchainTime": 1_488_987_130.0,
"currency": "test_currency",
"hash": "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD",
"issuer": "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD",
......@@ -216,7 +216,7 @@ mod tests {
}
fn block_4_json() -> serde_json::Value {
json!({
"commonTime": 1_488_987_131.0,
"blockchainTime": 1_488_987_131.0,
"currency": "test_currency",
"hash": "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE",
"issuer": "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE",
......@@ -266,7 +266,7 @@ mod tests {
tests::test_gql_query(
schema,
"{ blocks(interval: { from: 2 }) {
blocks { commonTime, currency, hash, issuer, number, version },
blocks { blockchainTime, currency, hash, issuer, number, version },
currentPageNumber, intervalFrom, intervalTo, lastPageNumber, totalBlocksCount
} }",
json!({
......@@ -324,14 +324,14 @@ mod tests {
tests::test_gql_query(
schema,
"{ blocks(step: 2) {
blocks { commonTime, currency, hash, issuer, number, version },
blocks { blockchainTime, currency, hash, issuer, number, version },
currentPageNumber, intervalFrom, intervalTo, lastPageNumber, totalBlocksCount
} }",
json!({
"data": {
"blocks": {
"blocks": [{
"commonTime": 1_488_987_127.0,
"blockchainTime": 1_488_987_127.0,
"currency": "test_currency",
"hash": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"issuer": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
......@@ -339,7 +339,7 @@ mod tests {
"version": 10
},
{
"commonTime": 1_488_987_129.0,
"blockchainTime": 1_488_987_129.0,
"currency": "test_currency",
"hash": "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC",
"issuer": "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC",
......@@ -398,7 +398,7 @@ mod tests {
tests::test_gql_query(
global_context,
"{ blocks(sortOrder: DESC) {
blocks { commonTime, currency, hash, issuer, number, version },
blocks { blockchainTime, currency, hash, issuer, number, version },
currentPageNumber, intervalFrom, intervalTo, lastPageNumber, totalBlocksCount
} }",
json!({
......@@ -461,7 +461,7 @@ mod tests {
tests::test_gql_query(
schema,
"{ blocks {
blocks { commonTime, currency, hash, issuer, number, version },
blocks { blockchainTime, currency, hash, issuer, number, version },
currentPageNumber, intervalFrom, intervalTo, lastPageNumber, totalBlocksCount
} }",
json!({
......
......@@ -74,11 +74,11 @@ mod tests {
tests::test_gql_query(
schema,
"{ current { commonTime, currency, hash, issuer, issuerName, membersCount, number, powMin, version } }",
"{ current { blockchainTime, currency, hash, issuer, issuerName, membersCount, number, powMin, version } }",
json!({
"data": {
"current": {
"commonTime": 1_488_987_127.0,
"blockchainTime": 1_488_987_127.0,
"currency": "test_currency",
"hash": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"issuer": "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
......
......@@ -56,14 +56,14 @@ mod tests {
tests::test_gql_query(
schema,
"{ currentUd { amount, base, blockNumber, commonTime, membersCount, monetaryMass } }",
"{ currentUd { amount, base, blockNumber, blockchainTime, membersCount, monetaryMass } }",
json!({
"data": {
"currentUd": {
"amount": 1_000,
"base": 0,
"blockNumber": 1,
"commonTime": 1_488_987_127.0,
"blockchainTime": 1_488_987_127.0,
"membersCount": 59,
"monetaryMass": 59000
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment