diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2026-08-05 11:51:51 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2026-08-05 11:51:51 +0200 |
| commit | 582df8885a3573a728394b473b826616f8969316 (patch) | |
| tree | 9c21db03f4fbfd9956ee398e0d9194ebfa5b3234 /src/group-fetch.ts | |
| parent | 46ac53e11b49a7f9cdb92c3559b05f41ce90122f (diff) | |
| download | bycs-sol-582df8885a3573a728394b473b826616f8969316.tar.gz bycs-sol-582df8885a3573a728394b473b826616f8969316.zip | |
convert a lot of js to typescript and use a single graduation DB
Diffstat (limited to 'src/group-fetch.ts')
| -rw-r--r-- | src/group-fetch.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/group-fetch.ts b/src/group-fetch.ts new file mode 100644 index 0000000..de0991d --- /dev/null +++ b/src/group-fetch.ts @@ -0,0 +1,18 @@ +import { fetchStudents } from "./student-ENV.ts"; +import { Group, buildGroups, _groups } from "./group.ts"; + +/** + * Fetch all Groups and return them as a map. + */ +async function fetchGroups() { + if (_groups.size) { + return _groups; + } + + // Fetch all students and build the groups from them + const students = await fetchStudents(); + buildGroups(students); + return _groups; +} + +export { Group, buildGroups, fetchGroups }; |
