refactored getAppointmentsByContraints to be consistent