make sorting optional
This commit is contained in:
		
							parent
							
								
									40f24236fd
								
							
						
					
					
						commit
						bb91b629f7
					
				@ -176,7 +176,7 @@ const resolvers = {
 | 
				
			|||||||
      })
 | 
					      })
 | 
				
			||||||
      return wallet
 | 
					      return wallet
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    wallets: async (parent, { includeReceivers = true, includeSenders = true, onlyEnabled = false }, { me, models }) => {
 | 
					    wallets: async (parent, { includeReceivers = true, includeSenders = true, onlyEnabled = false, prioritySort = undefined }, { me, models }) => {
 | 
				
			||||||
      if (!me) {
 | 
					      if (!me) {
 | 
				
			||||||
        throw new GqlAuthenticationError()
 | 
					        throw new GqlAuthenticationError()
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@ -202,7 +202,7 @@ const resolvers = {
 | 
				
			|||||||
      const out = await models.wallet.findMany({
 | 
					      const out = await models.wallet.findMany({
 | 
				
			||||||
        where: filter,
 | 
					        where: filter,
 | 
				
			||||||
        orderBy: {
 | 
					        orderBy: {
 | 
				
			||||||
          priority: 'asc'
 | 
					          priority: prioritySort
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
      return out
 | 
					      return out
 | 
				
			||||||
 | 
				
			|||||||
@ -67,7 +67,7 @@ const typeDefs = `
 | 
				
			|||||||
    numBolt11s: Int!
 | 
					    numBolt11s: Int!
 | 
				
			||||||
    connectAddress: String!
 | 
					    connectAddress: String!
 | 
				
			||||||
    walletHistory(cursor: String, inc: String): History
 | 
					    walletHistory(cursor: String, inc: String): History
 | 
				
			||||||
    wallets(includeReceivers: Boolean, includeSenders: Boolean, onlyEnabled: Boolean): [Wallet!]!
 | 
					    wallets(includeReceivers: Boolean, includeSenders: Boolean, onlyEnabled: Boolean, prioritySort: String): [Wallet!]!
 | 
				
			||||||
    wallet(id: ID!): Wallet
 | 
					    wallet(id: ID!): Wallet
 | 
				
			||||||
    walletByType(type: String!): Wallet
 | 
					    walletByType(type: String!): Wallet
 | 
				
			||||||
    walletLogs(type: String, from: String, to: String, cursor: String): WalletLog!
 | 
					    walletLogs(type: String, from: String, to: String, cursor: String): WalletLog!
 | 
				
			||||||
 | 
				
			|||||||
@ -198,9 +198,19 @@ export const WALLETS = gql`
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
`
 | 
					`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const BEST_WALLETS = gql`
 | 
				
			||||||
 | 
					  query BestWallets {
 | 
				
			||||||
 | 
					    wallets (includeSenders: true, includeReceivers: true, onlyEnabled: true, prioritySort: "asc") {
 | 
				
			||||||
 | 
					      id
 | 
				
			||||||
 | 
					      priority
 | 
				
			||||||
 | 
					      type
 | 
				
			||||||
 | 
					      updatedAt
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					`
 | 
				
			||||||
export const BEST_SEND_WALLETS = gql`
 | 
					export const BEST_SEND_WALLETS = gql`
 | 
				
			||||||
  query SendWallets {
 | 
					  query BestWallets {
 | 
				
			||||||
    wallets (includeSenders: true, includeReceivers: false, onlyEnabled: true) {
 | 
					    wallets (includeSenders: true, includeReceivers: false, onlyEnabled: true, prioritySort: "asc") {
 | 
				
			||||||
      id
 | 
					      id
 | 
				
			||||||
      priority
 | 
					      priority
 | 
				
			||||||
      type
 | 
					      type
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user