make sorting optional
This commit is contained in:
		
							parent
							
								
									40f24236fd
								
							
						
					
					
						commit
						bb91b629f7
					
				@ -176,7 +176,7 @@ const resolvers = {
 | 
			
		||||
      })
 | 
			
		||||
      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) {
 | 
			
		||||
        throw new GqlAuthenticationError()
 | 
			
		||||
      }
 | 
			
		||||
@ -202,7 +202,7 @@ const resolvers = {
 | 
			
		||||
      const out = await models.wallet.findMany({
 | 
			
		||||
        where: filter,
 | 
			
		||||
        orderBy: {
 | 
			
		||||
          priority: 'asc'
 | 
			
		||||
          priority: prioritySort
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
      return out
 | 
			
		||||
 | 
			
		||||
@ -67,7 +67,7 @@ const typeDefs = `
 | 
			
		||||
    numBolt11s: Int!
 | 
			
		||||
    connectAddress: String!
 | 
			
		||||
    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
 | 
			
		||||
    walletByType(type: String!): Wallet
 | 
			
		||||
    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`
 | 
			
		||||
  query SendWallets {
 | 
			
		||||
    wallets (includeSenders: true, includeReceivers: false, onlyEnabled: true) {
 | 
			
		||||
  query BestWallets {
 | 
			
		||||
    wallets (includeSenders: true, includeReceivers: false, onlyEnabled: true, prioritySort: "asc") {
 | 
			
		||||
      id
 | 
			
		||||
      priority
 | 
			
		||||
      type
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user