Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Provide API endpoint for transactions of an account - Closes #1892 #1920

Merged
merged 12 commits into from
Apr 25, 2018
1 change: 1 addition & 0 deletions api/controllers/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ TransactionsController.getTransactions = function(context, next) {
var params = context.request.swagger.params;

var filters = {
senderIdOrRecipientId: params.senderIdOrRecipientId.value,
id: params.id.value,
blockId: params.blockId.value,
recipientId: params.recipientId.value,
Expand Down
2 changes: 2 additions & 0 deletions modules/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ __private.list = function(filter, cb) {
const params = {};
const where = [];
const allowedFieldsMap = {
senderIdOrRecipientId:
't_senderId" IN (${senderId:csv}) OR t_recipientId" IN (${recipientId:csv})',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be missing double quote in the beginning of t_senderId and t_recipientId

id: '"t_id" = ${id}',
blockId: '"t_blockId" = ${blockId}',
fromHeight: '"b_height" >= ${fromHeight}',
Expand Down
17 changes: 17 additions & 0 deletions schema/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,7 @@ paths:
- $ref: '#/parameters/recipientPublicKey'
- $ref: '#/parameters/senderId'
- $ref: '#/parameters/senderPublicKey'
- $ref: '#/parameters/senderIdOrRecipientId'
- $ref: '#/parameters/transactionType'
- $ref: '#/parameters/height'
- $ref: '#/parameters/minAmount'
Expand Down Expand Up @@ -1086,6 +1087,14 @@ parameters:
type: string
format: publicKey
minLength: 1
senderIdOrRecipientId:
name: senderIdOrRecipientId
in: query
description: Sender or Recipient address to query
type: string
format: address
minLength: 1
maxLength: 22
transactionType:
name: type
in: query
Expand Down Expand Up @@ -1167,6 +1176,10 @@ definitions:
type: string
format: address
example: 12668885769632475474L
senderIdOrRecipientId:
type: string
format: address
example: 12668885769632475474L
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Tschakki senderIdOrRecipientId is just a request param. It would not be part of POST /transactions request.

signature:
type: string
format: signature
Expand Down Expand Up @@ -1615,6 +1628,10 @@ definitions:
type: string
format: publicKey
example: 2ca9a7143fc721fdc540fef893b27e8d648d2288efa61e56264edf01a2c23079
senderIdOrRecipientId:
type: string
format: address
example: 12668885769632475474L
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Tschakki senderIdOrRecipientId is just a request param. It would not be part of GET /transactions response.

signature:
type: string
format: signature
Expand Down