From c4e6cee68ad3c168c07383a1286bdccc1f103219 Mon Sep 17 00:00:00 2001 From: BenjaVR Date: Mon, 18 Feb 2019 23:00:52 +0100 Subject: [PATCH] Subscribes (from repository) are now ordered by creation time instead of updated time --- src/components/students/StudentsTable.tsx | 2 +- src/services/repositories/DepartmentsRepository.ts | 2 +- src/services/repositories/EducationsRepository.ts | 2 +- src/services/repositories/SchoolsRepository.ts | 2 +- src/services/repositories/StudentsRepository.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/students/StudentsTable.tsx b/src/components/students/StudentsTable.tsx index 3a5e2fc..ee5b4c0 100644 --- a/src/components/students/StudentsTable.tsx +++ b/src/components/students/StudentsTable.tsx @@ -55,10 +55,10 @@ class StudentsTable extends React.Component selectedStudent !== undefined ? this.handleDeleteInternshipForStudent(selectedStudent) : {}; - const columns = this.getTableColumns(); const departmentsNameForStudent = selectedStudent !== undefined ? this.getDepartmentNameForStudent(selectedStudent) : undefined; + const columns = this.getTableColumns(); return ( void): () => void { return FirestoreRefs.getDepartmentCollectionRef() - .orderBy(nameof("updatedTimestamp"), "desc") + .orderBy(nameof("createdTimestamp"), "desc") .onSnapshot((querySnapshot) => { const departmentEntities = FirebaseModelMapper.mapDocsToObjects(querySnapshot.docs); const departments = departmentEntities.map((entity) => Department.fromEntity(entity)); diff --git a/src/services/repositories/EducationsRepository.ts b/src/services/repositories/EducationsRepository.ts index 047318a..d45ebee 100644 --- a/src/services/repositories/EducationsRepository.ts +++ b/src/services/repositories/EducationsRepository.ts @@ -10,7 +10,7 @@ export class EducationsRepository { public static subscribeToEducations(onListen: (educations: Education[]) => void): () => void { return FirestoreRefs.getEducationCollectionRef() - .orderBy(nameof("updatedTimestamp"), "desc") + .orderBy(nameof("createdTimestamp"), "desc") .onSnapshot((querySnapshot) => { const educationEntities = FirebaseModelMapper.mapDocsToObjects(querySnapshot.docs); const educations = educationEntities.map((entity) => Education.fromEntity(entity)); diff --git a/src/services/repositories/SchoolsRepository.ts b/src/services/repositories/SchoolsRepository.ts index 08b8f89..1a0aa89 100644 --- a/src/services/repositories/SchoolsRepository.ts +++ b/src/services/repositories/SchoolsRepository.ts @@ -9,7 +9,7 @@ export class SchoolsRepository { public static subscribeToSchools(onListen: (schools: School[]) => void): () => void { return FirestoreRefs.getSchoolCollectionRef() - .orderBy(nameof("updatedTimestamp"), "desc") + .orderBy(nameof("createdTimestamp"), "desc") .onSnapshot((querySnapshot) => { const schoolEntities = FirebaseModelMapper.mapDocsToObjects(querySnapshot.docs); const schools = schoolEntities.map((entity) => School.fromEntity(entity)); diff --git a/src/services/repositories/StudentsRepository.ts b/src/services/repositories/StudentsRepository.ts index f50cfe1..f784027 100644 --- a/src/services/repositories/StudentsRepository.ts +++ b/src/services/repositories/StudentsRepository.ts @@ -11,7 +11,7 @@ export class StudentsRepository { public static subscribeToStudents(onListen: (students: Student[]) => void): () => void { return FirestoreRefs.getStudentCollectionRef() - .orderBy(nameof("updatedTimestamp"), "desc") + .orderBy(nameof("createdTimestamp"), "desc") .onSnapshot((querySnapshot) => { const studentEntities = FirebaseModelMapper.mapDocsToObjects(querySnapshot.docs); const students = studentEntities.map((entity) => Student.fromEntity(entity));