-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move core-api repositories into core-database-* (#2107)
- Loading branch information
1 parent
92d25e2
commit 57374e6
Showing
41 changed files
with
983 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,87 @@ | ||
import { Database } from "@arkecosystem/core-interfaces"; | ||
import { bignumify } from "@arkecosystem/core-utils"; | ||
import { Model } from "./model"; | ||
|
||
export class Block extends Model { | ||
/** | ||
* The table associated with the model. | ||
* @return {String} | ||
*/ | ||
public getTable() { | ||
return "blocks"; | ||
} | ||
|
||
/** | ||
* The read-only structure with query-formatting columns. | ||
* @return {Object} | ||
*/ | ||
public getColumnSet() { | ||
return this.createColumnSet([ | ||
constructor(pgp) { | ||
|
||
super(pgp); | ||
|
||
this.columnsDescriptor = [ | ||
{ | ||
name: "id", | ||
supportedOperators: [ Database.SearchOperator.OP_EQ ] | ||
}, | ||
{ | ||
name: "version", | ||
supportedOperators: [ Database.SearchOperator.OP_EQ ] | ||
}, | ||
{ | ||
name: "timestamp", | ||
supportedOperators: [ Database.SearchOperator.OP_LTE, Database.SearchOperator.OP_GTE ] | ||
}, | ||
{ | ||
name: "previous_block", | ||
prop: "previousBlock", | ||
def: null, | ||
supportedOperators: [ Database.SearchOperator.OP_EQ ] | ||
}, | ||
{ | ||
name: "height", | ||
supportedOperators: [ Database.SearchOperator.OP_LTE, Database.SearchOperator.OP_GTE ] | ||
}, | ||
{ | ||
name: "number_of_transactions", | ||
prop: "numberOfTransactions", | ||
supportedOperators: [ Database.SearchOperator.OP_LTE, Database.SearchOperator.OP_GTE ] | ||
}, | ||
{ | ||
name: "total_amount", | ||
prop: "totalAmount", | ||
init: col => bignumify(col.value).toFixed(), | ||
supportedOperators: [ Database.SearchOperator.OP_LTE, Database.SearchOperator.OP_GTE ] | ||
}, | ||
{ | ||
name: "total_fee", | ||
prop: "totalFee", | ||
init: col => bignumify(col.value).toFixed(), | ||
supportedOperators: [ Database.SearchOperator.OP_LTE, Database.SearchOperator.OP_GTE ] | ||
}, | ||
{ | ||
name: "reward", | ||
init: col => bignumify(col.value).toFixed(), | ||
supportedOperators: [ Database.SearchOperator.OP_LTE, Database.SearchOperator.OP_GTE ] | ||
}, | ||
{ | ||
name: "payload_length", | ||
prop: "payloadLength", | ||
supportedOperators: [ Database.SearchOperator.OP_LTE, Database.SearchOperator.OP_GTE ] | ||
}, | ||
{ | ||
name: "payload_hash", | ||
prop: "payloadHash", | ||
supportedOperators: [ Database.SearchOperator.OP_EQ ] | ||
}, | ||
{ | ||
name: "generator_public_key", | ||
prop: "generatorPublicKey", | ||
supportedOperators: [ Database.SearchOperator.OP_EQ ] | ||
}, | ||
{ | ||
name: "block_signature", | ||
prop: "blockSignature", | ||
}, | ||
]); | ||
supportedOperators: [ Database.SearchOperator.OP_EQ ] | ||
} | ||
]; | ||
} | ||
|
||
/** | ||
* The table associated with the model. | ||
* @return {String} | ||
*/ | ||
public getTable() { | ||
return "blocks"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
import { Model } from "./model"; | ||
|
||
export class Migration extends Model { | ||
|
||
constructor(pgp) { | ||
super(pgp); | ||
|
||
this.columnsDescriptor = [ | ||
{ | ||
name: "name" | ||
} | ||
]; | ||
} | ||
|
||
/** | ||
* The table associated with the model. | ||
* @return {String} | ||
*/ | ||
public getTable() { | ||
return "migrations"; | ||
} | ||
|
||
/** | ||
* The read-only structure with query-formatting columns. | ||
* @return {Object} | ||
*/ | ||
public getColumnSet() { | ||
return this.createColumnSet([ | ||
{ | ||
name: "name", | ||
}, | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,34 @@ | ||
import { Database } from "@arkecosystem/core-interfaces"; | ||
import { bignumify } from "@arkecosystem/core-utils"; | ||
import { Model } from "./model"; | ||
|
||
export class Round extends Model { | ||
/** | ||
* The table associated with the model. | ||
* @return {String} | ||
*/ | ||
public getTable() { | ||
return "rounds"; | ||
} | ||
|
||
/** | ||
* The read-only structure with query-formatting columns. | ||
* @return {Object} | ||
*/ | ||
public getColumnSet() { | ||
return this.createColumnSet([ | ||
constructor(pgp) { | ||
super(pgp); | ||
this.columnsDescriptor = [ | ||
{ | ||
name: "public_key", | ||
prop: "publicKey", | ||
supportedOperators: [ Database.SearchOperator.OP_EQ ] | ||
}, | ||
{ | ||
name: "balance", | ||
prop: "voteBalance", | ||
init: col => bignumify(col.value).toFixed(), | ||
supportedOperators: [ Database.SearchOperator.OP_EQ, Database.SearchOperator.OP_LTE, Database.SearchOperator.OP_GTE ] | ||
}, | ||
{ | ||
name: "round", | ||
supportedOperators: [ Database.SearchOperator.OP_EQ, Database.SearchOperator.OP_LTE, Database.SearchOperator.OP_GTE ] | ||
}, | ||
]); | ||
] | ||
} | ||
|
||
/** | ||
* The table associated with the model. | ||
* @return {String} | ||
*/ | ||
public getTable() { | ||
return "rounds"; | ||
} | ||
} |
Oops, something went wrong.