Skip to content

Commit 06afd27

Browse files
committed
update
1 parent 2a1cbf0 commit 06afd27

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

Diff for: db/models/searchTransaction.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ SearchTransaction.prototype.read = function(txHash) {
1010
return pool.query('SELECT * FROM searchtransaction WHERE txHash = $1', [txHash]);
1111
};
1212

13-
SearchTransaction.prototype.create = function(txHash) {
14-
return pool.query('SELECT * FROM searchtransaction WHERE txHash = $1', [txHash]);
13+
SearchTransaction.prototype.create = function(entity) {
14+
return null;
1515
};
1616

17-
SearchTransaction.prototype.update = function() {
18-
17+
SearchTransaction.prototype.update = function(entity) {
18+
return null;
1919
};
2020

21-
SearchTransaction.prototype.delete = function() {
22-
21+
SearchTransaction.prototype.delete = function(id) {
22+
return pool.query("DELETE searchtransaction WHERE id = $1", [id]);
2323
};
2424

2525
exports = module.exports = new SearchTransaction();

Diff for: db/models/transactionData.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ TransactionData.prototype.read = function(txHash) {
2121

2222
TransactionData.prototype.create = function(entity) {
2323
return pool.query("SELECT nextval(pg_get_serial_sequence('transactiondata', 'txid')) as txId;").then(function(result) {
24-
// calculate txHash
2524
var txId = result.rows[0].txid;
26-
console.log('txId: ' + txId );
2725
var txHash = keccak_256(txId);
28-
// console.log('txId: ' + txId + ', txHash: ' + txHash);
26+
console.log('txId: ' + txId + ', txHash: ' + txHash);
2927
return pool.query("INSERT INTO transactiondata (txid, txhash, data, status, network, txtimestamp) " +
3028
"values ($1, $2, $3, $4, $5, $6)",
3129
[txId, txHash, entity.data, 'UNAPPROVED', 'testnet', 'now']).then(function(){
@@ -39,6 +37,7 @@ TransactionData.prototype.create = function(entity) {
3937
};
4038

4139
TransactionData.prototype.update = function(entity) {
40+
// TODO 定義 status
4241
return pool.query("UPDATE transactiondata SET " +
4342
"transactionhash = $1, datahash = $2, status = $3, blocknumber = $4, blockhash = $5, fromAddress = $6 WHERE txhash = $7",
4443
[entity.transactionHash, entity.dataHash, entity.status, entity.blockNumber, entity.blockHash, entity.fromAddress, entity.txHash]);

0 commit comments

Comments
 (0)