fetch data from firebase and query based upon users preferences

I am trying to fetch data from firebase and based upon what the user has set for their preferences, have that data present itself on a viewController. How I am fetching the data is,

    func fetchPost() {
    
    topCardView = nil
    var previousCardView: CardView?
    Database.database().reference().child("Post").observe(.childAdded, with: { (snapshot) in
        
            if let userDictionary = snapshot.value as? [String: AnyObject] {
                
                let poster = Poster(dictionary: userDictionary as [String : AnyObject])
                let cardView = self.setupCardFromUser(poster: poster)
                self.cardViewModels.append(poster.toCardViewModel())
                
                if let currentUser = Auth.auth().currentUser?.uid,
                    currentUser == poster.fromId {
                    cardView.removeFromSuperview()
                    } else if self.topCardView == nil {
                      self.topCardView = cardView
                    }
                
                previousCardView?.nextCardView = cardView
                previousCardView = cardView
                
        }
    
    }, withCancel: nil)
   
}

the code above, shows the data that's being fetched and stored on the users VC. how I am setting the users preferences is as,

func saveSelectedToFirebase() {
    print("Saving our settings data into Firestore")
         guard let uid = Auth.auth().currentUser?.uid else { return }
        
         let requiredText = selectedItems.joined(separator: ", ")
         let selectedData: [String: Any] = [
             "uid": uid,
             "skills": requiredText
          
         ]
         
         self.updateSelectedIntoDatabseWithUID(uid: uid, values: selectedData as [String : AnyObject])
         print("Finished saving user info")
         self.dismiss(animated: true, completion: {
             print("Dismissal complete")
         })
}

the selected items are an array of strings. If the users selectedItems match the post category, Then I would like to post to be present on the users vc. Same with cost, if the users price matches the post cost, I would like it to be present. Only in this order. If the users selected items doesn't match the post categories, there's no reason to have it present.

Just for an addition, this is how I am allowing users to make a post.

  @objc func handlePost() { 
    guard let uid = Auth.auth().currentUser?.uid else { return }
          Database.database().reference().child("users").child(uid).observeSingleEvent(of: .value, with: { (snapshot) in
          guard let dictionary = snapshot.value as? [String : Any] else { return }
          let user = User(dictionary: dictionary as [String : AnyObject])

  let docData: [String: Any] = [
   
        "category": category,
        "price": cost,

        
    ]
    self.postJobDataIntoDatabseWithUID(uid: uid, values: docData as [String : AnyObject])
    
    print("Finished saving user info")
    self.dismiss(animated: true, completion: {
        print("Dismissal complete")
    })
   
        
    }
 })
}


private func postJobDataIntoDatabseWithUID(uid: String, values: [String: AnyObject]) {
      let ref = Database.database().reference()
        let usersReference = ref.child("jobPost").child(uid)
               usersReference.updateChildValues(values, withCompletionBlock: { (err, ref) in
                
    
}

My question, is in order for me to query these items, should I fetch the users preferences first, and then fetch the post that matches? or do I have to fetch the post then tries to manipulate the items to match the user's preferences.