diff --git a/app/domain/__init__.py b/app/domain/__init__.py index b73080e7..908fbe13 100644 --- a/app/domain/__init__.py +++ b/app/domain/__init__.py @@ -1 +1,5 @@ from domain.message import IrisMessage, IrisMessageRole +from domain.course import Course +from domain.exercise import ProgrammingExercise +from domain.submission import ProgrammingSubmission +from domain.codehint import CodeHint diff --git a/app/domain/codehint.py b/app/domain/codehint.py new file mode 100644 index 00000000..1819491c --- /dev/null +++ b/app/domain/codehint.py @@ -0,0 +1,15 @@ +class ProgrammingExerciseSolutionEntry: + def __init__(self, file_path: str, previous_line: int, line: int, previous_code: str, code: str): + self.file_path = file_path + self.previous_line = previous_line + self.line = line + self.previous_code = previous_code + self.code = code + + +class CodeHint: + def __init__(self, title: str, description: str, content: str, solution_entries: [ProgrammingExerciseSolutionEntry]): + self.title = title + self.description = description + self.content = content + self.solution_entries = solution_entries diff --git a/app/domain/course.py b/app/domain/course.py new file mode 100644 index 00000000..e5681bd3 --- /dev/null +++ b/app/domain/course.py @@ -0,0 +1,4 @@ +class Course: + def __init__(self, title, description): + self.title = title + self.description = description diff --git a/app/domain/dtos.py b/app/domain/dtos.py new file mode 100644 index 00000000..f1cbe778 --- /dev/null +++ b/app/domain/dtos.py @@ -0,0 +1,50 @@ +from domain import Course, ProgrammingExercise, IrisMessage, ProgrammingSubmission, CodeHint + + +class ProgrammingExerciseTutorChatDTO: + def __init__(self, + course: Course, + exercise: ProgrammingExercise, + submission: ProgrammingSubmission, + chat_history: [IrisMessage] + ): + self.course = course + self.exercise = exercise + self.submission = submission + self.chat_history = chat_history + + +class CodeEditorChatDTO: + def __init__(self, + problem_statement: str, + solution_repository: dict[str, str], + template_repository: dict[str, str], + test_repository: dict[str, str], + chat_history: [IrisMessage] + ): + self.problem_statement = problem_statement + self.solution_repository = solution_repository + self.template_repository = template_repository + self.test_repository = test_repository + self.chat_history = chat_history + + +class CodeEditorAdaptDTO: + def __init__(self, + problem_statement: str, + solution_repository: dict[str, str], + template_repository: dict[str, str], + test_repository: dict[str, str], + instructions: str + ): + self.problem_statement = problem_statement + self.solution_repository = solution_repository + self.template_repository = template_repository + self.test_repository = test_repository + self.chat_history = instructions + + +class HestiaDTO: + def __init__(self, code_hint: CodeHint, exercise: ProgrammingExercise): + self.code_hint = code_hint + self.exercise = exercise diff --git a/app/domain/exercise.py b/app/domain/exercise.py new file mode 100644 index 00000000..b7ca9cab --- /dev/null +++ b/app/domain/exercise.py @@ -0,0 +1,4 @@ +class ProgrammingExercise: + def __init__(self, title: str, problem_statement: str): + self.title = title + self.problem_statement = problem_statement diff --git a/app/domain/submission.py b/app/domain/submission.py new file mode 100644 index 00000000..12d45a2a --- /dev/null +++ b/app/domain/submission.py @@ -0,0 +1,11 @@ +class BuildLogEntry: + def __init__(self, time: str, message: str): + self.time = time + self.message = message + + +class ProgrammingSubmission: + def __init__(self, commit_hash: str, build_failed: bool, build_log_entries: [BuildLogEntry]): + self.commit_hash = commit_hash + self.build_failed = build_failed + self.build_log_entries = build_log_entries