From 010c3531ebc50e24a1add3f31a06f6e1e0bd6465 Mon Sep 17 00:00:00 2001 From: magnus2142 <magnus.bredeli@hotmail.com> Date: Tue, 3 May 2022 09:16:43 +0200 Subject: [PATCH] fixed course link bug --- bbcli/cli.py | 2 +- bbcli/commands/contents.py | 2 +- bbcli/services/contents_services.py | 1 - bbcli/services/utils/content_builder.py | 4 ++-- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bbcli/cli.py b/bbcli/cli.py index f1b10fb..4ec36de 100644 --- a/bbcli/cli.py +++ b/bbcli/cli.py @@ -135,7 +135,7 @@ create.add_command(create_document) create.add_command(create_file) create.add_command(create_web_link) create.add_command(create_folder) -# create.add_command(create_courselink) +create.add_command(create_courselink) create.add_command(upload_attachment) create.add_command(create_assignment_from_contents) diff --git a/bbcli/commands/contents.py b/bbcli/commands/contents.py index 32b7290..d75f1ce 100644 --- a/bbcli/commands/contents.py +++ b/bbcli/commands/contents.py @@ -198,8 +198,8 @@ def create_folder(ctx: click.core.Context, course_id: str, parent_id: str, title @click.command(name='course-link', help='Create course link content\n\nRedirects user to the target content') @click.option('-c', '--course', 'course_id', required=True, type=str, help='COURSE ID') @click.option('-f', '--folder', 'parent_id', required=True, type=str, help='FOLDER ID') +@click.option('-t', '--target', 'target_id', required=True, type=str, help='TARGET ID') @click.argument('title', required=True, type=str) -@click.argument('target_id', required=True, type=str) @click.option('-j', '--json', 'print_json', required=False, is_flag=True, help='Print the data in json format') @click.option('-md', '--markdown', required=False, is_flag=True, help='Use this flag if you want to use markdown in body') @standard_options diff --git a/bbcli/services/contents_services.py b/bbcli/services/contents_services.py index e56f098..d82379b 100644 --- a/bbcli/services/contents_services.py +++ b/bbcli/services/contents_services.py @@ -189,7 +189,6 @@ def create_folder(session: requests.Session, course_id: str, parent_id: str,titl return response -# TODO:FUNKER IKKE PGA targetType def create_courselink(session: requests.Session, course_id: str, parent_id: str, title: str, target_id: str, standard_options: StandardOptions, is_markdown: bool) -> Dict: diff --git a/bbcli/services/utils/content_builder.py b/bbcli/services/utils/content_builder.py index e02bb4a..3526ad4 100644 --- a/bbcli/services/utils/content_builder.py +++ b/bbcli/services/utils/content_builder.py @@ -71,7 +71,7 @@ class Builder(ABC): # ModulePage @abstractmethod - def add_content_handler_courselink(self, target_id: str, target_type: str = 'Unset') -> Builder: + def add_content_handler_courselink(self, target_id: str, target_type: str = 'Forum') -> Builder: pass @@ -204,7 +204,7 @@ class ContentBuilder(Builder): }) return self - def add_content_handler_courselink(self, target_id: str, target_type: str = 'Unset') -> Builder: + def add_content_handler_courselink(self, target_id: str, target_type: str = 'Content') -> Builder: self._product.add({ 'contentHandler': { 'id': 'resource/x-bb-courselink', -- GitLab