Angular Firestore Multiple where

I’m trying to learn multiple parameter. Why it is still returning all collection values. it is not filtering. Thank you.

this.afsEmployeesRef = this.apiService.firestore.collection(’employees’, ref =>
ref.where(‘companyid’, ‘==’, this.settingsService.userCompany[0].companyid)
.where(‘active’, ‘==’, 1)
.orderBy(‘lastname’, ‘asc’)
.orderBy(‘firstname’, ‘asc’)
.orderBy(‘middlename’, ‘asc’)
);

  if (this.selected_department != 'All'){
    this.afsEmployeesRef.ref.where('departmentid', '==', this.selected_department);
  }
  if (this.selected_location != 'All'){
    this.afsEmployeesRef.ref.where('locationid', '==', this.selected_location);
  }
  if (this.selected_role != 'All'){
    this.afsEmployeesRef.ref.where('role', '==', this.selected_role);
  }
  if (this.selected_shift != 'All'){
    this.afsEmployeesRef.ref.where('shiftid', '==', this.selected_shift);
  }
  
 this.afsEmployeesRef.snapshotChanges().subscribe(data => {
      this.employees = data.map(e => {
        return {
          id: e.payload.doc.id,
          ...e.payload.doc.data()
        };
      });
      resolve(this.employees);
  });

Source: Angular Questions