mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 23:58:31 -06:00
starting to resurect tests
This commit is contained in:
@@ -4,10 +4,7 @@ import {
|
||||
LocalCourseSettings,
|
||||
localCourseYamlUtils,
|
||||
} from "@/models/local/localCourse";
|
||||
import {
|
||||
directoryOrFileExists,
|
||||
hasFileSystemEntries,
|
||||
} from "./utils/fileSystemUtils";
|
||||
import { directoryOrFileExists } from "./utils/fileSystemUtils";
|
||||
import {
|
||||
LocalAssignment,
|
||||
localAssignmentMarkdown,
|
||||
@@ -53,6 +50,15 @@ export const fileStorageService = {
|
||||
return courseNamesFromDirectories;
|
||||
},
|
||||
|
||||
async getAllCoursesSettings() {
|
||||
const courses = await fileStorageService.getCourseNames();
|
||||
|
||||
const settings = await Promise.all(
|
||||
courses.map(async (c) => await fileStorageService.getCourseSettings(c))
|
||||
);
|
||||
return settings;
|
||||
},
|
||||
|
||||
async getCourseSettings(courseName: string): Promise<LocalCourseSettings> {
|
||||
const courseDirectory = path.join(basePath, courseName);
|
||||
const settingsPath = path.join(courseDirectory, "settings.yml");
|
||||
@@ -97,6 +103,11 @@ export const fileStorageService = {
|
||||
const modules = await Promise.all(modulePromises);
|
||||
return modules.sort((a, b) => a.localeCompare(b));
|
||||
},
|
||||
async createModule(courseName: string, moduleName: string) {
|
||||
const courseDirectory = path.join(basePath, courseName);
|
||||
|
||||
await fs.mkdir(courseDirectory + "/" + moduleName, { recursive: true });
|
||||
},
|
||||
|
||||
async getAssignmentNames(courseName: string, moduleName: string) {
|
||||
const filePath = path.join(basePath, courseName, moduleName, "assignments");
|
||||
@@ -263,7 +274,6 @@ export const fileStorageService = {
|
||||
}
|
||||
|
||||
const directories = await fs.readdir(basePath, { withFileTypes: true });
|
||||
console.log(directories);
|
||||
const emptyDirectories = (
|
||||
await Promise.all(
|
||||
directories
|
||||
@@ -282,4 +292,10 @@ export const fileStorageService = {
|
||||
|
||||
return emptyDirectories;
|
||||
},
|
||||
|
||||
async createCourseFolderForTesting(courseName: string) {
|
||||
const courseDirectory = path.join(basePath, courseName);
|
||||
|
||||
await fs.mkdir(courseDirectory, { recursive: true });
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user