Skip to content
Snippets Groups Projects
Commit 892e4950 authored by kelly.nguyen's avatar kelly.nguyen
Browse files

add cmd for export assignment

parent a55df5e8
No related branches found
No related tags found
No related merge requests found
Pipeline #33279 failed
...@@ -5,6 +5,7 @@ import AssignmentUnpublishCommand from './subcommands/AssignmentUnpublishComman ...@@ -5,6 +5,7 @@ import AssignmentUnpublishCommand from './subcommands/AssignmentUnpublishComman
import AssignmentCheckCommand from './subcommands/AssignmentCheckCommand.js'; import AssignmentCheckCommand from './subcommands/AssignmentCheckCommand.js';
import AssignmentRunCommand from './subcommands/AssignmentRunCommand.js'; import AssignmentRunCommand from './subcommands/AssignmentRunCommand.js';
import AssignmentCorrectionCommand from './subcommands/correction/AssignmentCorrectionCommand.js'; import AssignmentCorrectionCommand from './subcommands/correction/AssignmentCorrectionCommand.js';
import AssignmentExportCommand from './subcommands/AssignmentExportCommand.js';
class AssignmentCommand extends CommanderCommand { class AssignmentCommand extends CommanderCommand {
...@@ -22,6 +23,7 @@ class AssignmentCommand extends CommanderCommand { ...@@ -22,6 +23,7 @@ class AssignmentCommand extends CommanderCommand {
AssignmentPublishCommand.registerOnCommand(this.command); AssignmentPublishCommand.registerOnCommand(this.command);
AssignmentUnpublishCommand.registerOnCommand(this.command); AssignmentUnpublishCommand.registerOnCommand(this.command);
AssignmentCorrectionCommand.registerOnCommand(this.command); AssignmentCorrectionCommand.registerOnCommand(this.command);
AssignmentExportCommand.registerOnCommand(this.command);
} }
protected async commandAction(): Promise<void> { protected async commandAction(): Promise<void> {
......
import CommanderCommand from '../../CommanderCommand.js';
// import ExerciseRunHelper from '../../../helpers/Dojo/ExerciseRunHelper.js';
// import GlobalHelper from '../../../helpers/GlobalHelper.js';
import DojoBackendManager from '../../../managers/DojoBackendManager.js';
class AssignmentExportCommand extends CommanderCommand {
protected commandName: string = 'export';
protected defineCommand() {
this.command
.description('create a new repository for an assignment')
.argument('<id or namespace>', 'name or url (http/s or ssh) of the assignment')
.action(this.commandAction.bind(this));
}
protected async commandAction(idOrNamespace: string): Promise<void> {
const tmp = DojoBackendManager.exportAssignment(idOrNamespace);
console.log(tmp);
}
}
export default new AssignmentExportCommand();
\ No newline at end of file
...@@ -222,6 +222,14 @@ class DojoBackendManager { ...@@ -222,6 +222,14 @@ class DojoBackendManager {
return false; return false;
} }
} }
public async exportAssignment(idOrNamespace: string) {
try {
return (await axios.get<DojoBackendResponse<null>>(DojoBackendHelper.getApiUrl(ApiRoute.ASSIGNMENT_ARCHIVE, { assignmentNameOrUrl: idOrNamespace}))).data.data;
} catch ( error ) {
return undefined;
}
}
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment