history pagination

This commit is contained in:
boufni95 2024-02-06 22:26:05 +01:00
parent e671fce443
commit c09ceef96f
6 changed files with 3655 additions and 3633 deletions

View file

@ -444,38 +444,36 @@ The nostr server will send back a message response, and inside the body there wi
## Messages ## Messages
### The content of requests and response from the methods ### The content of requests and response from the methods
### AppMetrics ### AddAppInvoiceRequest
- __app__: _[Application](#Application)_ - __payer_identifier__: _string_
- __users__: _[UsersInfo](#UsersInfo)_ - __http_callback_url__: _string_
- __total_received__: _number_ - __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_
- __total_spent__: _number_
- __total_available__: _number_
- __unpaid_invoices__: _number_
- __operations__: ARRAY of: _[UserOperation](#UserOperation)_
### ClosedChannel ### NewInvoiceResponse
- __channel_id__: _string_ - __invoice__: _string_
- __capacity__: _number_
- __closed_height__: _number_
### GetUserOperationsRequest ### LnurlPayInfoResponse
- __latestIncomingInvoice__: _number_ - __tag__: _string_
- __latestOutgoingInvoice__: _number_ - __callback__: _string_
- __latestIncomingTx__: _number_ - __maxSendable__: _number_
- __latestOutgoingTx__: _number_ - __minSendable__: _number_
- __latestIncomingUserToUserPayment__: _number_ - __metadata__: _string_
- __latestOutgoingUserToUserPayment__: _number_ - __allowsNostr__: _boolean_
- __nostrPubkey__: _string_
### Application ### DecodeInvoiceResponse
- __amount__: _number_
### HandleLnurlPayResponse
- __pr__: _string_
- __routes__: ARRAY of: _[Empty](#Empty)_
### AddProductRequest
- __name__: _string_ - __name__: _string_
- __id__: _string_ - __price_sats__: _number_
- __balance__: _number_
- __npub__: _string_
### AppsMetricsRequest ### UsageMetrics
- __from_unix__: _number_ *this field is optional - __metrics__: ARRAY of: _[UsageMetric](#UsageMetric)_
- __to_unix__: _number_ *this field is optional
- __include_operations__: _boolean_ *this field is optional
### UsersInfo ### UsersInfo
- __total__: _number_ - __total__: _number_
@ -485,28 +483,42 @@ The nostr server will send back a message response, and inside the body there wi
- __balance_avg__: _number_ - __balance_avg__: _number_
- __balance_median__: _number_ - __balance_median__: _number_
### AuthApp ### SetMockInvoiceAsPaidRequest
- __app__: _[Application](#Application)_ - __invoice__: _string_
- __auth_token__: _string_
### LnurlLinkResponse
- __lnurl__: _string_
- __k1__: _string_
### SendAppUserToAppPaymentRequest
- __from_user_identifier__: _string_
- __amount__: _number_ - __amount__: _number_
### DecodeInvoiceRequest ### SetMockAppBalanceRequest
- __invoice__: _string_ - __amount__: _number_
### PayInvoiceResponse ### PayAddressResponse
- __preimage__: _string_ - __txId__: _string_
- __amount_paid__: _number_
- __operation_id__: _string_ - __operation_id__: _string_
- __service_fee__: _number_ - __service_fee__: _number_
- __network_fee__: _number_ - __network_fee__: _number_
### AppMetrics
- __app__: _[Application](#Application)_
- __users__: _[UsersInfo](#UsersInfo)_
- __total_received__: _number_
- __total_spent__: _number_
- __total_available__: _number_
- __unpaid_invoices__: _number_
- __operations__: ARRAY of: _[UserOperation](#UserOperation)_
### ChannelBalanceEvent
- __block_height__: _number_
- __channel_id__: _string_
- __local_balance_sats__: _number_
- __remote_balance_sats__: _number_
### OpenChannel
- __channel_id__: _string_
- __capacity__: _number_
- __active__: _boolean_
- __lifetime__: _number_
- __local_balance__: _number_
- __remote_balance__: _number_
### LndNodeMetrics ### LndNodeMetrics
- __channels_balance_events__: ARRAY of: _[ChannelBalanceEvent](#ChannelBalanceEvent)_ - __channels_balance_events__: ARRAY of: _[ChannelBalanceEvent](#ChannelBalanceEvent)_
- __chain_balance_events__: ARRAY of: _[ChainBalanceEvent](#ChainBalanceEvent)_ - __chain_balance_events__: ARRAY of: _[ChainBalanceEvent](#ChainBalanceEvent)_
@ -518,51 +530,42 @@ The nostr server will send back a message response, and inside the body there wi
- __open_channels__: ARRAY of: _[OpenChannel](#OpenChannel)_ - __open_channels__: ARRAY of: _[OpenChannel](#OpenChannel)_
- __closed_channels__: ARRAY of: _[ClosedChannel](#ClosedChannel)_ - __closed_channels__: ARRAY of: _[ClosedChannel](#ClosedChannel)_
### UserInfo ### LndMetrics
- __userId__: _string_ - __nodes__: ARRAY of: _[LndNodeMetrics](#LndNodeMetrics)_
- __balance__: _number_
- __max_withdrawable__: _number_ ### NewAddressResponse
- __address__: _string_
### LndGetInfoRequest
- __nodeId__: _number_
### SetMockAppUserBalanceRequest
- __user_identifier__: _string_ - __user_identifier__: _string_
- __amount__: _number_
### Product ### MigrationUpdate
- __id__: _string_ - __closure__: _[ClosureMigration](#ClosureMigration)_ *this field is optional
- __name__: _string_ - __relays__: _[RelaysMigration](#RelaysMigration)_ *this field is optional
- __price_sats__: _number_
### ChannelBalanceEvent ### EncryptionExchangeRequest
- __block_height__: _number_ - __publicKey__: _string_
- __channel_id__: _string_ - __deviceId__: _string_
- __local_balance_sats__: _number_
- __remote_balance_sats__: _number_ ### SendAppUserToAppPaymentRequest
- __from_user_identifier__: _string_
- __amount__: _number_
### NewAddressRequest ### NewAddressRequest
- __addressType__: _[AddressType](#AddressType)_ - __addressType__: _[AddressType](#AddressType)_
### UsageMetrics ### GetUserOperationsRequest
- __metrics__: ARRAY of: _[UsageMetric](#UsageMetric)_ - __latestIncomingInvoice__: _number_
- __latestOutgoingInvoice__: _number_
### HandleLnurlPayResponse - __latestIncomingTx__: _number_
- __pr__: _string_ - __latestOutgoingTx__: _number_
- __routes__: ARRAY of: _[Empty](#Empty)_ - __latestIncomingUserToUserPayment__: _number_
- __latestOutgoingUserToUserPayment__: _number_
### UserOperations - __max_size__: _number_
- __fromIndex__: _number_
- __toIndex__: _number_
- __operations__: ARRAY of: _[UserOperation](#UserOperation)_
### AddAppInvoiceRequest
- __payer_identifier__: _string_
- __http_callback_url__: _string_
- __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_
### AddAppUserInvoiceRequest
- __receiver_identifier__: _string_
- __payer_identifier__: _string_
- __http_callback_url__: _string_
- __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_
### GetAppUserRequest
- __user_identifier__: _string_
### UserOperation ### UserOperation
- __paidAtUnix__: _number_ - __paidAtUnix__: _number_
@ -577,54 +580,58 @@ The nostr server will send back a message response, and inside the body there wi
- __tx_hash__: _string_ - __tx_hash__: _string_
- __internal__: _boolean_ - __internal__: _boolean_
### Empty ### UserInfo
- __userId__: _string_
- __balance__: _number_
- __max_withdrawable__: _number_
- __user_identifier__: _string_
### LndMetricsRequest ### UsageMetric
- __from_unix__: _number_ *this field is optional - __processed_at_ms__: _number_
- __to_unix__: _number_ *this field is optional - __parsed_in_nano__: _number_
- __auth_in_nano__: _number_
### SetMockInvoiceAsPaidRequest - __validate_in_nano__: _number_
- __invoice__: _string_ - __handle_in_nano__: _number_
- __amount__: _number_ - __rpc_name__: _string_
- __batch__: _boolean_
### DecodeInvoiceResponse - __nostr__: _boolean_
- __amount__: _number_ - __batch_size__: _number_
### OpenChannelResponse
- __channelId__: _string_
### RelaysMigration
- __relays__: ARRAY of: _string_
### AppsMetrics ### AppsMetrics
- __apps__: ARRAY of: _[AppMetrics](#AppMetrics)_ - __apps__: ARRAY of: _[AppMetrics](#AppMetrics)_
### GetAppUserLNURLInfoRequest ### AuthApp
- __user_identifier__: _string_ - __app__: _[Application](#Application)_
- __base_url_override__: _string_ - __auth_token__: _string_
### PayAddressRequest ### PayAddressRequest
- __address__: _string_ - __address__: _string_
- __amoutSats__: _number_ - __amoutSats__: _number_
- __satsPerVByte__: _number_ - __satsPerVByte__: _number_
### PayAppUserInvoiceRequest ### PayInvoiceResponse
- __user_identifier__: _string_ - __preimage__: _string_
- __amount_paid__: _number_
- __operation_id__: _string_
- __service_fee__: _number_
- __network_fee__: _number_
### LndGetInfoResponse
- __alias__: _string_
### PayInvoiceRequest
- __invoice__: _string_ - __invoice__: _string_
- __amount__: _number_ - __amount__: _number_
### NewInvoiceRequest ### ClosureMigration
- __amountSats__: _number_ - __closes_at_unix__: _number_
- __memo__: _string_
### LnurlPayInfoResponse ### RelaysMigration
- __tag__: _string_ - __relays__: ARRAY of: _string_
- __callback__: _string_
- __maxSendable__: _number_ ### LndMetricsRequest
- __minSendable__: _number_ - __from_unix__: _number_ *this field is optional
- __metadata__: _string_ - __to_unix__: _number_ *this field is optional
- __allowsNostr__: _boolean_
- __nostrPubkey__: _string_
### GetUserOperationsResponse ### GetUserOperationsResponse
- __latestOutgoingInvoiceOperations__: _[UserOperations](#UserOperations)_ - __latestOutgoingInvoiceOperations__: _[UserOperations](#UserOperations)_
@ -634,6 +641,83 @@ The nostr server will send back a message response, and inside the body there wi
- __latestOutgoingUserToUserPayemnts__: _[UserOperations](#UserOperations)_ - __latestOutgoingUserToUserPayemnts__: _[UserOperations](#UserOperations)_
- __latestIncomingUserToUserPayemnts__: _[UserOperations](#UserOperations)_ - __latestIncomingUserToUserPayemnts__: _[UserOperations](#UserOperations)_
### LiveUserOperation
- __operation__: _[UserOperation](#UserOperation)_
### AppsMetricsRequest
- __from_unix__: _number_ *this field is optional
- __to_unix__: _number_ *this field is optional
- __include_operations__: _boolean_ *this field is optional
### ChainBalanceEvent
- __block_height__: _number_
- __confirmed_balance__: _number_
- __unconfirmed_balance__: _number_
- __total_balance__: _number_
### AppUser
- __identifier__: _string_
- __info__: _[UserInfo](#UserInfo)_
- __max_withdrawable__: _number_
### PayAppUserInvoiceRequest
- __user_identifier__: _string_
- __invoice__: _string_
- __amount__: _number_
### OpenChannelRequest
- __destination__: _string_
- __fundingAmount__: _number_
- __pushAmount__: _number_
- __closeAddress__: _string_
### AuthAppRequest
- __name__: _string_
- __allow_user_creation__: _boolean_ *this field is optional
### LnurlLinkResponse
- __lnurl__: _string_
- __k1__: _string_
### Empty
### AddAppRequest
- __name__: _string_
- __allow_user_creation__: _boolean_
### Application
- __name__: _string_
- __id__: _string_
- __balance__: _number_
- __npub__: _string_
### NewInvoiceRequest
- __amountSats__: _number_
- __memo__: _string_
### ClosedChannel
- __channel_id__: _string_
- __capacity__: _number_
- __closed_height__: _number_
### AddAppUserRequest
- __identifier__: _string_
- __fail_if_exists__: _boolean_
- __balance__: _number_
### GetAppUserRequest
- __user_identifier__: _string_
### UserOperations
- __fromIndex__: _number_
- __toIndex__: _number_
- __operations__: ARRAY of: _[UserOperation](#UserOperation)_
### Product
- __id__: _string_
- __name__: _string_
- __price_sats__: _number_
### RoutingEvent ### RoutingEvent
- __incoming_channel_id__: _number_ - __incoming_channel_id__: _number_
- __incoming_htlc_id__: _number_ - __incoming_htlc_id__: _number_
@ -648,64 +732,29 @@ The nostr server will send back a message response, and inside the body there wi
- __offchain__: _boolean_ - __offchain__: _boolean_
- __forward_fail_event__: _boolean_ - __forward_fail_event__: _boolean_
### LndGetInfoRequest ### AddAppUserInvoiceRequest
- __nodeId__: _number_ - __receiver_identifier__: _string_
- __payer_identifier__: _string_
### AddAppUserRequest - __http_callback_url__: _string_
- __identifier__: _string_ - __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_
- __fail_if_exists__: _boolean_
- __balance__: _number_
### EncryptionExchangeRequest
- __publicKey__: _string_
- __deviceId__: _string_
### UsageMetric
- __processed_at_ms__: _number_
- __parsed_in_nano__: _number_
- __auth_in_nano__: _number_
- __validate_in_nano__: _number_
- __handle_in_nano__: _number_
- __rpc_name__: _string_
- __batch__: _boolean_
- __nostr__: _boolean_
- __batch_size__: _number_
### LiveUserOperation
- __operation__: _[UserOperation](#UserOperation)_
### GetProductBuyLinkResponse
- __link__: _string_
### ChainBalanceEvent
- __block_height__: _number_
- __confirmed_balance__: _number_
- __unconfirmed_balance__: _number_
- __total_balance__: _number_
### SendAppUserToAppUserPaymentRequest ### SendAppUserToAppUserPaymentRequest
- __from_user_identifier__: _string_ - __from_user_identifier__: _string_
- __to_user_identifier__: _string_ - __to_user_identifier__: _string_
- __amount__: _number_ - __amount__: _number_
### SetMockAppBalanceRequest ### GetProductBuyLinkResponse
- __amount__: _number_ - __link__: _string_
### AddProductRequest ### DecodeInvoiceRequest
- __name__: _string_ - __invoice__: _string_
- __price_sats__: _number_
### OpenChannel ### OpenChannelResponse
- __channel_id__: _string_ - __channelId__: _string_
- __capacity__: _number_
- __active__: _boolean_
- __lifetime__: _number_
- __local_balance__: _number_
- __remote_balance__: _number_
### SetMockAppUserBalanceRequest ### GetAppUserLNURLInfoRequest
- __user_identifier__: _string_ - __user_identifier__: _string_
- __amount__: _number_ - __base_url_override__: _string_
### LnurlWithdrawInfoResponse ### LnurlWithdrawInfoResponse
- __tag__: _string_ - __tag__: _string_
@ -716,54 +765,6 @@ The nostr server will send back a message response, and inside the body there wi
- __maxWithdrawable__: _number_ - __maxWithdrawable__: _number_
- __balanceCheck__: _string_ - __balanceCheck__: _string_
- __payLink__: _string_ - __payLink__: _string_
### AddAppRequest
- __name__: _string_
- __allow_user_creation__: _boolean_
### OpenChannelRequest
- __destination__: _string_
- __fundingAmount__: _number_
- __pushAmount__: _number_
- __closeAddress__: _string_
### MigrationUpdate
- __closure__: _[ClosureMigration](#ClosureMigration)_ *this field is optional
- __relays__: _[RelaysMigration](#RelaysMigration)_ *this field is optional
### AppUser
- __identifier__: _string_
- __info__: _[UserInfo](#UserInfo)_
- __max_withdrawable__: _number_
### NewAddressResponse
- __address__: _string_
### PayInvoiceRequest
- __invoice__: _string_
- __amount__: _number_
### LndMetrics
- __nodes__: ARRAY of: _[LndNodeMetrics](#LndNodeMetrics)_
### LndGetInfoResponse
- __alias__: _string_
### AuthAppRequest
- __name__: _string_
- __allow_user_creation__: _boolean_ *this field is optional
### PayAddressResponse
- __txId__: _string_
- __operation_id__: _string_
- __service_fee__: _number_
- __network_fee__: _number_
### NewInvoiceResponse
- __invoice__: _string_
### ClosureMigration
- __closes_at_unix__: _number_
## Enums ## Enums
### The enumerators used in the messages ### The enumerators used in the messages

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -328,6 +328,7 @@ message GetUserOperationsRequest{
int64 latestOutgoingTx = 4; int64 latestOutgoingTx = 4;
int64 latestIncomingUserToUserPayment = 5; int64 latestIncomingUserToUserPayment = 5;
int64 latestOutgoingUserToUserPayment = 6; int64 latestOutgoingUserToUserPayment = 6;
int64 max_size = 7;
} }
enum UserOperationType { enum UserOperationType {
INCOMING_TX =0; INCOMING_TX =0;
@ -362,7 +363,7 @@ message GetUserOperationsResponse{
UserOperations latestOutgoingTxOperations=3; UserOperations latestOutgoingTxOperations=3;
UserOperations latestIncomingTxOperations=4; UserOperations latestIncomingTxOperations=4;
UserOperations latestOutgoingUserToUserPayemnts=5; UserOperations latestOutgoingUserToUserPayemnts=5;
UserOperations latestIncomingUserToUserPayemnts=6 ; UserOperations latestIncomingUserToUserPayemnts=6;
} }
message AddProductRequest { message AddProductRequest {

View file

@ -426,7 +426,7 @@ export default class {
identifier = o.invoice identifier = o.invoice
} else if (o.address) { } else if (o.address) {
identifier = o.address; identifier = o.address;
} else if(o.user_address) { } else if (o.user_address) {
identifier = o.user_address.address; identifier = o.user_address.address;
} else if (type === Types.UserOperationType.INCOMING_USER_TO_USER && o.from_user) { } else if (type === Types.UserOperationType.INCOMING_USER_TO_USER && o.from_user) {
identifier = o.from_user.user_id identifier = o.from_user.user_id
@ -452,12 +452,12 @@ export default class {
async GetUserOperations(userId: string, req: Types.GetUserOperationsRequest): Promise<Types.GetUserOperationsResponse> { async GetUserOperations(userId: string, req: Types.GetUserOperationsRequest): Promise<Types.GetUserOperationsResponse> {
const [outgoingInvoices, outgoingTransactions, incomingInvoices, incomingTransactions, incomingUserToUser, outgoingUserToUser] = await Promise.all([ const [outgoingInvoices, outgoingTransactions, incomingInvoices, incomingTransactions, incomingUserToUser, outgoingUserToUser] = await Promise.all([
this.storage.paymentStorage.GetUserInvoicePayments(userId, req.latestOutgoingInvoice), this.storage.paymentStorage.GetUserInvoicePayments(userId, req.latestOutgoingInvoice, req.max_size),
this.storage.paymentStorage.GetUserTransactionPayments(userId, req.latestOutgoingTx), this.storage.paymentStorage.GetUserTransactionPayments(userId, req.latestOutgoingTx, req.max_size),
this.storage.paymentStorage.GetUserInvoicesFlaggedAsPaid(userId, req.latestIncomingInvoice), this.storage.paymentStorage.GetUserInvoicesFlaggedAsPaid(userId, req.latestIncomingInvoice, req.max_size),
this.storage.paymentStorage.GetUserReceivingTransactions(userId, req.latestIncomingTx), this.storage.paymentStorage.GetUserReceivingTransactions(userId, req.latestIncomingTx, req.max_size),
this.storage.paymentStorage.GetUserToUserReceivedPayments(userId, req.latestIncomingUserToUserPayment), this.storage.paymentStorage.GetUserToUserReceivedPayments(userId, req.latestIncomingUserToUserPayment, req.max_size),
this.storage.paymentStorage.GetUserToUserSentPayments(userId, req.latestOutgoingUserToUserPayment) this.storage.paymentStorage.GetUserToUserSentPayments(userId, req.latestOutgoingUserToUserPayment, req.max_size)
]) ])
return { return {
latestIncomingInvoiceOperations: this.mapOperations(incomingInvoices, Types.UserOperationType.INCOMING_INVOICE, true), latestIncomingInvoiceOperations: this.mapOperations(incomingInvoices, Types.UserOperationType.INCOMING_INVOICE, true),

View file

@ -35,7 +35,7 @@ export default class {
return entityManager.getRepository(AddressReceivingTransaction).save(newAddressTransaction) return entityManager.getRepository(AddressReceivingTransaction).save(newAddressTransaction)
} }
GetUserReceivingTransactions(userId: string, fromIndex: number, entityManager = this.DB): Promise<AddressReceivingTransaction[]> { GetUserReceivingTransactions(userId: string, fromIndex: number, take = 50, entityManager = this.DB): Promise<AddressReceivingTransaction[]> {
return entityManager.getRepository(AddressReceivingTransaction).find({ return entityManager.getRepository(AddressReceivingTransaction).find({
where: { where: {
user_address: { user: { user_id: userId } }, user_address: { user: { user_id: userId } },
@ -44,7 +44,8 @@ export default class {
}, },
order: { order: {
paid_at_unix: 'DESC' paid_at_unix: 'DESC'
} },
take
}) })
} }
@ -70,7 +71,7 @@ export default class {
return entityManager.getRepository(UserReceivingInvoice).update(invoice.serial_id, i) return entityManager.getRepository(UserReceivingInvoice).update(invoice.serial_id, i)
} }
GetUserInvoicesFlaggedAsPaid(userId: string, fromIndex: number, entityManager = this.DB): Promise<UserReceivingInvoice[]> { GetUserInvoicesFlaggedAsPaid(userId: string, fromIndex: number, take = 50, entityManager = this.DB): Promise<UserReceivingInvoice[]> {
return entityManager.getRepository(UserReceivingInvoice).find({ return entityManager.getRepository(UserReceivingInvoice).find({
where: { where: {
user: { user: {
@ -81,7 +82,8 @@ export default class {
}, },
order: { order: {
paid_at_unix: 'DESC' paid_at_unix: 'DESC'
} },
take
}) })
} }
@ -129,7 +131,7 @@ export default class {
return entityManager.getRepository(UserInvoicePayment).save(newPayment) return entityManager.getRepository(UserInvoicePayment).save(newPayment)
} }
GetUserInvoicePayments(userId: string, fromIndex: number, entityManager = this.DB): Promise<UserInvoicePayment[]> { GetUserInvoicePayments(userId: string, fromIndex: number, take = 50, entityManager = this.DB): Promise<UserInvoicePayment[]> {
return entityManager.getRepository(UserInvoicePayment).find({ return entityManager.getRepository(UserInvoicePayment).find({
where: { where: {
user: { user: {
@ -140,7 +142,8 @@ export default class {
}, },
order: { order: {
paid_at_unix: 'DESC' paid_at_unix: 'DESC'
} },
take
}) })
} }
@ -162,7 +165,7 @@ export default class {
return entityManager.getRepository(UserTransactionPayment).save(newTx) return entityManager.getRepository(UserTransactionPayment).save(newTx)
} }
GetUserTransactionPayments(userId: string, fromIndex: number, entityManager = this.DB): Promise<UserTransactionPayment[]> { GetUserTransactionPayments(userId: string, fromIndex: number, take = 50, entityManager = this.DB): Promise<UserTransactionPayment[]> {
return entityManager.getRepository(UserTransactionPayment).find({ return entityManager.getRepository(UserTransactionPayment).find({
where: { where: {
user: { user: {
@ -173,7 +176,8 @@ export default class {
}, },
order: { order: {
paid_at_unix: 'DESC' paid_at_unix: 'DESC'
} },
take
}) })
} }
@ -233,7 +237,7 @@ export default class {
return entityManager.getRepository(UserToUserPayment).save(newKey) return entityManager.getRepository(UserToUserPayment).save(newKey)
} }
GetUserToUserReceivedPayments(userId: string, fromIndex: number, entityManager = this.DB) { GetUserToUserReceivedPayments(userId: string, fromIndex: number, take = 50, entityManager = this.DB) {
return entityManager.getRepository(UserToUserPayment).find({ return entityManager.getRepository(UserToUserPayment).find({
where: { where: {
to_user: { to_user: {
@ -244,11 +248,12 @@ export default class {
}, },
order: { order: {
paid_at_unix: 'DESC' paid_at_unix: 'DESC'
} },
take
}) })
} }
GetUserToUserSentPayments(userId: string, fromIndex: number, entityManager = this.DB) { GetUserToUserSentPayments(userId: string, fromIndex: number, take = 50, entityManager = this.DB) {
return entityManager.getRepository(UserToUserPayment).find({ return entityManager.getRepository(UserToUserPayment).find({
where: { where: {
from_user: { from_user: {
@ -259,7 +264,8 @@ export default class {
}, },
order: { order: {
paid_at_unix: 'DESC' paid_at_unix: 'DESC'
} },
take
}) })
} }