Skip to content

Lectures: Merge Attachment Unit and Video Unit #10575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 148 commits into
base: develop
Choose a base branch
from

Conversation

sebastianloose
Copy link
Contributor

@sebastianloose sebastianloose commented Mar 24, 2025

⚠️ Do not deploy - contains database migration ⚠️

Checklist

General

Server

  • I strictly followed the server coding and design guidelines.
  • I added multiple integration tests (Spring) related to the features (with a high test coverage).
  • I documented the Java code using JavaDoc style.

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data (e.g. using paging).
  • I strictly followed the principle of data economy for all client-server REST calls.
  • I strictly followed the client coding and design guidelines.
  • Following the theming guidelines, I specified colors only in the theming variable files and checked that the changes look consistent in both the light and the dark theme.
  • I added multiple integration tests (Jest) related to the features (with a high test coverage), while following the test guidelines.
  • I added authorities to all new routes and checked the course groups for displaying navigation elements (links, buttons).
  • I documented the TypeScript code using JSDoc style.
  • I added multiple screenshots/screencasts of my UI changes.
  • I translated all newly inserted strings into English and German.

Motivation and Context

To enable the linking of attachments to lecture transcriptions, the video unit and attachment unit have been merged into a single attachment-video unit. In the future, this unit can be sent to Pyris to simultaneously ingest transcriptions and slides. This integration is essential for providing Iris with the best context when answering questions about specific lecture topics.

Description

  • Video unit was deleted
  • attachment video unit now contains a video source and can display a video player
  • an attachment video unit must either contain an attachment, a video source or both
  • attachment video unit release date and name are no longer saved in the attachment but in the unit itself
  • already existing video units will be converted to attachment video units without an attachment

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Lecture
  1. Log in to Artemis
  2. Go to a lecture
  3. Create a new File/Video Unit
  4. Enter a name and upload an attachment and save the new unit
  5. Try to edit the newly created unit and save it
  6. Create a new File/Video Unit
  7. Enter a name and specify a video source and save the new unit
  8. Try also to edit this Unit
  9. Create a new File/Video Unit
  10. Enter a name, a video source and upload a file and save the new unit
  11. Also try to edit this unit
  12. If you inserted a valid video source you should also be able to watch the video when clicking on a unit with video

Testserver States

You can manage test servers using Helios. Check environment statuses in the environment list. To deploy to a test server, go to the CI/CD page, find your PR or branch, and trigger the deployment.

Review Progress

Performance Review

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance even for very large courses with more than 2000 students.
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance even for very large courses with more than 2000 students.

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

Screenshots

grafik
grafik

Summary by CodeRabbit

  • New Features

    • Introduced "Attachment Video Units" as a unified type for video and file lecture units, allowing video sources to be embedded alongside attachments.
    • Added support for video URL validation and embedding in lecture units.
    • Updated lecture unit forms and management to handle video-specific fields and validation.
    • Enhanced lecture unit display to include video playback within the unit card.
  • Refactor

    • Replaced all references to "Attachment Unit" and "Video Unit" with "Attachment Video Unit" throughout the application.
    • Consolidated and renamed services, repositories, models, and components to focus on video attachment units.
    • Removed legacy video unit components, services, and tests.
  • Bug Fixes

    • Improved error messages and validation for video attachment units.
  • Documentation

    • Updated translation keys and help texts to reflect the new video attachment unit terminology.
  • Style

    • Updated UI icons and styles to visually distinguish video attachment units.
  • Tests

    • Refactored and updated integration and unit tests to cover the new attachment video unit functionality.
  • Chores

    • Cleaned up obsolete files and code related to the old attachment and video unit types.

@sebastianloose sebastianloose marked this pull request as ready for review March 26, 2025 18:02
@sebastianloose sebastianloose requested a review from a team as a code owner March 26, 2025 18:02
Copy link

github-actions bot commented Apr 3, 2025

There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions.

@isabellagessl isabellagessl requested review from a team and krusche as code owners April 5, 2025 14:56
@github-actions github-actions bot removed the stale label Apr 6, 2025
…' of github.com:ls1intum/Artemis into feature/lectures/combine-video-unit-and-attachment-unit
Copy link
Contributor

coderabbitai bot commented Apr 7, 2025

Walkthrough

This change set systematically refactors the codebase to replace the concepts of "AttachmentUnit" and "VideoUnit" with a unified "AttachmentVideoUnit" entity. All backend and frontend references, including domain models, repositories, services, REST controllers, Angular components, routing, and test cases, have been updated to reflect this new structure. The "VideoUnit" entity and its associated logic have been removed, while "AttachmentVideoUnit" now encapsulates both file attachments and video sources. Corresponding updates were made to internationalization files, validation logic, and UI components to support video attachments. All related test cases and data handling have been migrated to use the new entity.

Changes

Files/Paths (grouped) Change Summary
src/main/java/de/tum/cit/aet/artemis/core/service/FilePathService.java, FileService.java Renamed all references from "attachment unit" to "attachment video unit" and updated method names and logic to use AttachmentVideoUnit.
src/main/java/de/tum/cit/aet/artemis/core/web/FileResource.java Replaced all uses of AttachmentUnit with AttachmentVideoUnit, updated endpoints, parameter names, and repository/service injections accordingly.
src/main/java/de/tum/cit/aet/artemis/iris/api/IrisLectureApi.java, service/pyris/PyrisWebhookService.java Updated all API and service methods to operate on AttachmentVideoUnit instead of AttachmentUnit or VideoUnit. Adjusted method signatures, internal logic, and documentation.
src/main/java/de/tum/cit/aet/artemis/iris/service/pyris/dto/chat/lecture/PyrisLectureChatPipelineExecutionDTO.java, service/session/IrisLectureChatSessionService.java Changed DTOs and service logic to use courseId and lectureId primitives instead of DTO objects.
src/main/java/de/tum/cit/aet/artemis/lecture/domain/Attachment.java, Slide.java Replaced attachmentUnit fields and methods with attachmentVideoUnit in domain entities.
src/main/java/de/tum/cit/aet/artemis/lecture/domain/AttachmentVideoUnit.java Renamed class from AttachmentUnit to AttachmentVideoUnit, added videoSource field, updated relationships, and removed redundant methods.
src/main/java/de/tum/cit/aet/artemis/lecture/domain/LectureUnit.java Updated JSON subtypes annotation to use AttachmentVideoUnit for "attachment" and removed "video" type.
src/main/java/de/tum/cit/aet/artemis/lecture/domain/VideoUnit.java Removed the VideoUnit entity class.
src/main/java/de/tum/cit/aet/artemis/lecture/repository/AttachmentVideoUnitRepository.java, SlideRepository.java Updated repositories to operate on AttachmentVideoUnit, renamed methods and queries, and adjusted join conditions and parameter names.
src/main/java/de/tum/cit/aet/artemis/lecture/repository/VideoUnitRepository.java Removed the VideoUnitRepository interface.
src/main/java/de/tum/cit/aet/artemis/lecture/service/AttachmentUnitService.java Removed the old AttachmentUnitService.
src/main/java/de/tum/cit/aet/artemis/lecture/service/AttachmentVideoUnitService.java Added new service for managing AttachmentVideoUnit creation, update, file handling, and related logic.
src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureService.java, LectureUnitImportService.java, LectureUnitProcessingService.java, LectureUnitService.java, SlideSplitterService.java, SlideUnhideService.java, AttachmentService.java Replaced all handling of AttachmentUnit and VideoUnit with AttachmentVideoUnit in service logic, method signatures, and internal processing.
src/main/java/de/tum/cit/aet/artemis/lecture/web/AttachmentResource.java Updated to use AttachmentVideoUnit for preserving unit references during attachment updates.
src/main/java/de/tum/cit/aet/artemis/lecture/web/AttachmentVideoUnitResource.java Refactored from AttachmentUnitResource to handle AttachmentVideoUnit entities, updated endpoints, method names, and internal logic.
src/main/java/de/tum/cit/aet/artemis/lecture/web/LectureResource.java, LectureTranscriptionResource.java Removed all AttachmentUnit and VideoUnit handling, updated to use AttachmentVideoUnit for filtering and processing.
src/main/webapp/app/atlas/overview/competency-accordion/competency-accordion.component.html, course-competencies/course-competencies-details.component.html, course-competencies-details.component.ts, learning-path-lecture-unit/learning-path-lecture-unit.component.html, learning-path-lecture-unit.component.ts Updated all logic and templates to use LectureUnitType.ATTACHMENT_VIDEO and the AttachmentVideoUnitComponent, removed references to video and attachment units.
src/main/webapp/app/core/course/overview/course-dashboard/course-dashboard.service.ts Updated lecture unit type mapping to use ATTACHMENT_VIDEO, removed handling for VIDEO.
src/main/webapp/app/core/navbar/navbar.component.ts Updated breadcrumb and navigation logic to use attachment video units.
src/main/webapp/app/environments/environment.override.ts Added new environment override file with debug and version constants.
src/main/webapp/app/lecture/manage/lecture-units/attachment-unit-form/attachment-unit-form.component.html, create-attachment-unit/create-attachment-unit.component.html, edit-attachment-unit/edit-attachment-unit.component.html, create-video-unit/create-video-unit.component.html, edit-video-unit/edit-video-unit.component.html, video-unit-form/video-unit-form.component.html, video-unit-form/video-unit-form.component.ts Deleted old forms and components for attachment units and video units.
src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit-form/attachment-video-unit-form.component.html, attachment-video-unit-form.component.ts Added new form and logic for AttachmentVideoUnit, including video source validation and URL transformation.
src/main/webapp/app/lecture/manage/lecture-units/attachment-video-units/attachment-video-units.component.html, attachment-video-units.component.ts Updated processing and validation logic to handle video units, renamed methods and services accordingly.
src/main/webapp/app/lecture/manage/lecture-units/create-attachment-video-unit/create-attachment-video-unit.component.html, create-attachment-video-unit.component.ts Added new components for creating attachment video units, updated logic and validation for video source.
src/main/webapp/app/lecture/manage/lecture-units/edit-attachment-video-unit/edit-attachment-video-unit.component.html, edit-attachment-video-unit.component.ts Added/updated components for editing attachment video units, replaced all references to old unit types.
src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management.route.ts Updated routing to use attachment video unit components and resolvers, removed old routes.
src/main/webapp/app/lecture/manage/lecture-units/lecture-units.component.html, lecture-units.component.ts Removed video unit form and logic, replaced with attachment video unit handling throughout.
src/main/webapp/app/lecture/manage/lecture-units/unit-creation-card/unit-creation-card.component.html, unit-creation-card.component.ts Replaced video unit creation buttons and icons with attachment video unit equivalents.
src/main/webapp/app/lecture/manage/pdf-preview/pdf-preview.component.html, pdf-preview.component.ts Updated preview logic to operate on AttachmentVideoUnit instead of AttachmentUnit.
src/main/webapp/app/lecture/overview/course-lectures/attachment-video-unit/attachment-video-unit.component.html, attachment-video-unit.component.scss, attachment-video-unit.component.ts Enhanced component to support video playback, updated icons, labels, and validation for video sources.
src/main/webapp/app/lecture/overview/course-lectures/video-unit/video-unit.component.html, video-unit.component.ts Removed video unit overview components.
src/main/webapp/app/lecture/shared/entities/attachment.model.ts, lecture-unit/attachmentVideoUnit.model.ts, lecture-unit/lectureUnit.model.ts Updated models to use AttachmentVideoUnit, removed VideoUnit, and updated enums, icons, and tooltips for lecture unit types.
src/main/webapp/app/lecture/shared/entities/lecture-unit/videoUnit.model.ts Removed the VideoUnit class from the model.
src/main/webapp/app/lecture/shared/entities/lecture.model.ts Updated import to use IngestionState from the new video unit model.
src/main/webapp/app/shared/markdown-editor/monaco/markdown-editor-monaco.component.html, value-item.model.ts, model/actions/communication/lecture-attachment-reference.action.ts Updated all references and logic to use AttachmentVideoUnit for attachment references and value items.
src/main/webapp/i18n/de/lecture.json, en/lecture.json Updated error message keys to reference attachment video units.
src/main/webapp/i18n/de/lectureUnit.json, en/lectureUnit.json Removed video unit section, updated and expanded keys and messages for attachment video units, including video-specific validation and UI text.
src/test/java/de/tum/cit/aet/artemis/atlas/AbstractAtlasIntegrationTest.java, atlas/competency/AbstractCompetencyPrerequisiteIntegrationTest.java, atlas/competency/CourseCompetencyIntegrationTest.java, atlas/service/LearningObjectServiceTest.java, core/FileIntegrationTest.java, iris/PyrisLectureIngestionTest.java, iris/PyrisLectureTranscriptionIngestionTest.java, lecture/AttachmentVideoUnitIntegrationTest.java, lecture/AttachmentVideoUnitsIntegrationTest.java, lecture/LectureIntegrationTest.java, lecture/LectureTranscriptionIntegrationTest.java, lecture/LectureUnitIntegrationTest.java, lecture/LectureUnitServiceTest.java Updated all test classes to use AttachmentVideoUnit, replaced test repository injections, updated test data and assertions, removed or renamed test cases for video units.
src/test/java/de/tum/cit/aet/artemis/lecture/VideoUnitIntegrationTest.java Removed video unit integration tests.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI as Angular UI
    participant API as REST API
    participant Service as AttachmentVideoUnitService
    participant Repo as AttachmentVideoUnitRepository
    participant File as FileService

    User->>UI: Create/Edit Attachment Video Unit (form submit)
    UI->>API: POST/PUT /attachment-video-units/...
    API->>Service: createAttachmentVideoUnit(...) / updateAttachmentVideoUnit(...)
    Service->>Repo: Save AttachmentVideoUnit
    Service->>File: Handle file upload (if present)
    File-->>Service: File path/URL
    Service-->>API: AttachmentVideoUnit DTO
    API-->>UI: AttachmentVideoUnit DTO
    UI-->>User: Show updated video unit (with file/video)
Loading

Suggested labels

feature, modeling, programming, quiz, text

Suggested reviewers

  • krusche
  • ole-ve
  • bassner

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (22)
src/main/webapp/app/environments/environment.override.ts (2)

4-6: Informative API Guidance Through Comments

The inline comments provide valuable guidance regarding the root URL for API calls and CORS configuration in production mode. These instructions are clear and should help maintain correct configuration.


7-7: I18N_HASH Definition with Potential Documentation Enhancement

The constant I18N_HASH is defined correctly. To improve maintainability, consider adding a brief comment explaining its role (e.g., whether it is used for cache busting or versioning i18n resources).

src/main/webapp/i18n/en/lecture.json (1)

99-99: Update error message text to match the key change

While the key has been updated from attachmentUnitIDError to attachmentVideoUnitIDError to match the new entity name, the error message itself still refers to "Attachment Unit" without mentioning "Video". This could potentially be confusing to users.

-                "attachmentVideoUnitIDError": "Invalid Attachment Unit or Attachment Unit ID.",
+                "attachmentVideoUnitIDError": "Invalid Attachment Video Unit or Attachment Video Unit ID.",
src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit-form/attachment-video-unit-form.component.html (2)

64-71: Consider adding aria-label for better accessibility.

The file input component could benefit from an explicit aria-label to improve accessibility for screen readers.

<input
    #fileInput
    id="fileInput"
    type="file"
    class="custom-file-input"
    [accept]="acceptedFileExtensionsFileBrowser"
    (change)="onFileChange($event)"
    aria-describedby="fileHelp"
+   aria-label="{{ 'artemisApp.attachmentVideoUnit.createAttachmentVideoUnit.file' | artemisTranslate }}"
    [placeholder]="'artemisApp.attachmentVideoUnit.createAttachmentVideoUnit.chooseFile' | artemisTranslate"
    (click)="fileInputTouched = true"
/>

126-130: Add aria-label to the transform button.

For better accessibility, add an aria-label to the transform button since it only contains an icon.

<button 
    id="transformButton" 
    type="button" 
    class="btn btn-sm btn-primary" 
    [disabled]="!isTransformable" 
    (click)="setEmbeddedVideoUrl($event)"
+   aria-label="{{ 'artemisApp.attachmentVideoUnit.createAttachmentVideoUnit.transformUrl' | artemisTranslate }}"
>
    <fa-icon [icon]="faArrowLeft" />
</button>
src/main/webapp/app/lecture/overview/course-lectures/attachment-video-unit/attachment-video-unit.component.html (1)

38-45: Well-implemented video player integration

The conditional rendering of the video player is well implemented, only displaying when a video URL is available. The implementation follows responsive design principles with the appropriate Bootstrap classes.

Consider adding an accessibility description or title for the video iframe to improve screen reader support.

-                <iframe id="videoFrame" class="rounded" [src]="videoUrl() | safeResourceUrl" allow="fullscreen"></iframe>
+                <iframe id="videoFrame" class="rounded" [src]="videoUrl() | safeResourceUrl" [title]="'Video: ' + getFileName()" allow="fullscreen"></iframe>
src/main/java/de/tum/cit/aet/artemis/lecture/domain/AttachmentVideoUnit.java (1)

79-83: Consider updating the type string for consistency

The type string returned is still "attachment" despite this now being an attachment-video unit. This might create confusion or issues in consumers that rely on this type string to distinguish between different unit types.

@Override
public String getType() {
-    return "attachment";
+    return "attachment-video";
}
src/main/webapp/app/lecture/manage/pdf-preview/pdf-preview.component.ts (2)

129-148: Consider refactoring to reduce non-null assertions.

The update handling logic has been correctly modified to use the attachmentVideoUnit signal. However, there are multiple non-null assertions (!) when accessing the signal values, which could be improved for code safety.

Consider storing the signal value in a local variable when used multiple times:

-else if (this.attachmentVideoUnit()) {
+else if (this.attachmentVideoUnit()) {
+    const unit = this.attachmentVideoUnit()!;
+    const unitLecture = unit.lecture!;
+    
-    this.attachmentToBeEdited.set(this.attachmentVideoUnit()!.attachment!);
+    this.attachmentToBeEdited.set(unit.attachment!);
     this.attachmentToBeEdited()!.version!++;
     this.attachmentToBeEdited()!.uploadDate = dayjs();

     const formData = new FormData();
     formData.append('file', pdfFile);
     formData.append('attachment', objectToJsonBlob(this.attachmentToBeEdited()!));
-    formData.append('attachmentVideoUnit', objectToJsonBlob(this.attachmentVideoUnit()!));
+    formData.append('attachmentVideoUnit', objectToJsonBlob(unit));

-    this.attachmentVideoUnitService.update(this.attachmentVideoUnit()!.lecture!.id!, this.attachmentVideoUnit()!.id!, formData).subscribe({
+    this.attachmentVideoUnitService.update(unitLecture.id!, unit.id!, formData).subscribe({
         next: () => {
             this.alertService.success('artemisApp.attachment.pdfPreview.attachmentUpdateSuccess');
-            this.router.navigate(['course-management', this.course()?.id, 'lectures', this.attachmentVideoUnit()!.lecture!.id, 'unit-management']);
+            this.router.navigate(['course-management', this.course()?.id, 'lectures', unitLecture.id, 'unit-management']);
         },

166-176: Similar improvement opportunity for delete method.

The delete attachment logic has been correctly updated, but it has the same pattern of multiple non-null assertions that could be improved.

Consider storing the signal value in a local variable when used multiple times:

-else if (this.attachmentVideoUnit()) {
+else if (this.attachmentVideoUnit()) {
+    const unit = this.attachmentVideoUnit()!;
+    const unitLecture = unit.lecture!;
+    
-    this.lectureUnitService.delete(this.attachmentVideoUnit()!.id!, this.attachmentVideoUnit()!.lecture!.id!).subscribe({
+    this.lectureUnitService.delete(unit.id!, unitLecture.id!).subscribe({
         next: () => {
-            this.router.navigate(['course-management', this.course()!.id, 'lectures', this.attachmentVideoUnit()!.lecture!.id, 'unit-management']);
+            this.router.navigate(['course-management', this.course()!.id, 'lectures', unitLecture.id, 'unit-management']);
             this.dialogErrorSource.next('');
         },
src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management.component.ts (1)

322-323: Complete the TODO for transcription ingestion.

There's a TODO comment about ingesting transcriptions that should be addressed to complete the functionality of the attachment-video unit integration.

Would you like me to help implement the transcription ingestion functionality or create a tracking issue for this task?

src/main/java/de/tum/cit/aet/artemis/lecture/service/AttachmentVideoUnitService.java (4)

65-74: Javadoc wording for the new unit type

The Javadoc states "Creates a new attachment unit" but the method name and implementation clearly reference "AttachmentVideoUnit." Consider updating the documentation for clarity.

 /**
- * Creates a new attachment unit for the given lecture.
+ * Creates a new attachment video unit for the given lecture.
  */

78-84: Reassigning lecture field after setting it to null

Setting the lecture field to null (line 78) and then reassigning it can be confusing. Adding an explanatory comment or extracting the relevant logic could clarify this approach to prevent index column errors.


93-152: Method size and responsibilities

The updateAttachmentVideoUnit method handles multiple operations (updating competencies, attachments, slides, etc.). Splitting it into smaller helper methods would improve readability and maintainability.


185-187: Duplicate assignment of release date

existingAttachment.setReleaseDate(updateAttachment.getReleaseDate()); is repeated (lines 185 and 187). Consolidate to reduce duplication.

- existingAttachment.setReleaseDate(updateAttachment.getReleaseDate());
  existingAttachment.setName(updateAttachment.getName());
- existingAttachment.setReleaseDate(updateAttachment.getReleaseDate());
+ existingAttachment.setReleaseDate(updateAttachment.getReleaseDate());
  existingAttachment.setName(updateAttachment.getName());
src/main/java/de/tum/cit/aet/artemis/core/service/FilePathService.java (1)

147-164: Robust path parsing for slides

actualPathForPublicAttachmentVideoUnitFilePath manages both standard file URLs and slide directories. Consider verifying path segment counts before calling path.getName(4), to avoid potential IndexOutOfBoundsException if the path is malformed.

src/main/webapp/app/lecture/overview/course-lectures/attachment-video-unit/attachment-video-unit.component.ts (1)

39-42: Use regex literal notation instead of RegExp constructor.

The RegExp constructor requires escaping backslashes in the string, which makes the pattern harder to read and maintain.

-    private readonly videoUrlAllowList = [
-        // TUM-Live. Example: 'https://live.rbg.tum.de/w/test/26?video_only=1'
-        RegExp('^https://live\\.rbg\\.tum\\.de/w/\\w+/\\d+(/(CAM|COMB|PRES))?\\?video_only=1$'),
-    ];
+    private readonly videoUrlAllowList = [
+        // TUM-Live. Example: 'https://live.rbg.tum.de/w/test/26?video_only=1'
+        /^https:\/\/live\.rbg\.tum\.de\/w\/\w+\/\d+(\/(?:CAM|COMB|PRES))?\\?video_only=1$/,
+    ];
🧰 Tools
🪛 Biome (1.9.4)

[error] 41-41: Use a regular expression literal instead of the RegExp constructor.

Regular expression literals avoid some escaping required in a string literal, and are easier to analyze statically.
Safe fix: Use a literal notation instead.

(lint/complexity/useRegexLiterals)

src/main/java/de/tum/cit/aet/artemis/core/web/FileResource.java (1)

136-140: Constructor parameter ordering could be improved.

The constructor parameters are not ordered consistently with the field declarations (lines 104-156). Consider reordering parameters to match field declaration order for better maintainability.

src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit-form/attachment-video-unit-form.component.ts (2)

61-62: Consider improving validation error message.

The validation error could be more specific about what makes a valid video URL to help users correct their input.

- return { invalidVideoUrl: true };
+ return { invalidVideoUrl: 'URL must be from TUM-Live or a supported video platform (YouTube, Vimeo, etc.)' };

231-241: Video URL extraction could be more robust.

The extractEmbeddedUrl method assumes the URL is valid without checking, which could lead to errors. Consider adding a try-catch block.

extractEmbeddedUrl(videoUrl: string) {
+   try {
      const url = new URL(videoUrl);
      if (isTumLiveUrl(url)) {
          url.searchParams.set('video_only', '1');
          return url.toString();
      }
      return urlParser.create({
          videoInfo: urlParser.parse(videoUrl)!,
          format: 'embed',
      });
+   } catch (error) {
+       console.error('Failed to extract embedded URL:', error);
+       return videoUrl; // Return original URL if parsing fails
+   }
}
src/main/java/de/tum/cit/aet/artemis/lecture/web/AttachmentVideoUnitResource.java (3)

130-136: Remove debug logging statements.

Multiple debug logging statements with the same message are redundant and should be consolidated or removed from production code.

- log.debug("REST request to update an attachment unit : {}", attachmentVideoUnit);
- AttachmentVideoUnit existingAttachmentVideoUnit = attachmentVideoUnitRepository.findWithSlidesAndCompetenciesByIdElseThrow(attachmentVideoUnitId);
- log.debug("REST request to update an attachment unit 1: {}", attachmentVideoUnit);
- checkAttachmentVideoUnitCourseAndLecture(existingAttachmentVideoUnit, lectureId);
- log.debug("REST request to update an attachment unit 2: {}", attachmentVideoUnit);
- authorizationCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.EDITOR, existingAttachmentVideoUnit.getLecture().getCourse(), null);
-
- log.debug("REST request to update an attachment unit 3: {}", attachmentVideoUnit);
+ log.debug("REST request to update an attachment unit : {}", attachmentVideoUnit);
+ AttachmentVideoUnit existingAttachmentVideoUnit = attachmentVideoUnitRepository.findWithSlidesAndCompetenciesByIdElseThrow(attachmentVideoUnitId);
+ checkAttachmentVideoUnitCourseAndLecture(existingAttachmentVideoUnit, lectureId);
+ authorizationCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.EDITOR, existingAttachmentVideoUnit.getLecture().getCourse(), null);

144-145: Remove unnecessary debug logging.

The debug logging statement on line 144 is unnecessary and should be removed.

- log.debug("REST request to update an attachment unit 4: {}", attachmentVideoUnit);
-

174-176: Improve error message for attachment/video validation.

The error message refers to "a attachment" which has a grammatical error. Consider improving the clarity of this message.

- throw new BadRequestAlertException("A attachment must have a an attachment or a video source", ENTITY_NAME, "videosourceAndAttachment");
+ throw new BadRequestAlertException("An attachment video unit must have either an attachment or a video source", ENTITY_NAME, "videosourceAndAttachment");
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2696734 and 60772f0.

⛔ Files ignored due to path filters (2)
  • src/main/resources/config/liquibase/changelog/20250326161400_changelog.xml is excluded by !**/*.xml
  • src/main/resources/config/liquibase/master.xml is excluded by !**/*.xml
📒 Files selected for processing (107)
  • src/main/java/de/tum/cit/aet/artemis/communication/domain/notification/GroupNotificationFactory.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/core/service/FilePathService.java (5 hunks)
  • src/main/java/de/tum/cit/aet/artemis/core/service/FileService.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/core/web/FileResource.java (8 hunks)
  • src/main/java/de/tum/cit/aet/artemis/iris/api/IrisLectureApi.java (2 hunks)
  • src/main/java/de/tum/cit/aet/artemis/iris/service/pyris/PyrisWebhookService.java (7 hunks)
  • src/main/java/de/tum/cit/aet/artemis/iris/service/pyris/dto/chat/lecture/PyrisLectureChatPipelineExecutionDTO.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/iris/service/session/IrisLectureChatSessionService.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/domain/Attachment.java (2 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/domain/AttachmentVideoUnit.java (2 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/domain/LectureUnit.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/domain/Slide.java (2 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/domain/VideoUnit.java (0 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/repository/AttachmentVideoUnitRepository.java (2 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/repository/LectureUnitMetricsRepository.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/repository/SlideRepository.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/repository/VideoUnitRepository.java (0 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/AttachmentUnitService.java (0 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/AttachmentVideoUnitService.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureService.java (4 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureUnitImportService.java (4 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureUnitProcessingService.java (4 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureUnitService.java (3 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/SlideSplitterService.java (3 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/web/AttachmentResource.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/web/AttachmentVideoUnitResource.java (7 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/web/LectureResource.java (2 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/web/LectureTranscriptionResource.java (2 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/web/VideoUnitResource.java (0 hunks)
  • src/main/webapp/app/atlas/overview/competency-accordion/competency-accordion.component.html (1 hunks)
  • src/main/webapp/app/atlas/overview/course-competencies/course-competencies-details.component.html (1 hunks)
  • src/main/webapp/app/atlas/overview/course-competencies/course-competencies-details.component.ts (2 hunks)
  • src/main/webapp/app/atlas/overview/learning-path-lecture-unit/learning-path-lecture-unit.component.html (1 hunks)
  • src/main/webapp/app/atlas/overview/learning-path-lecture-unit/learning-path-lecture-unit.component.ts (2 hunks)
  • src/main/webapp/app/communication/posting-content.components.ts (1 hunks)
  • src/main/webapp/app/core/course/overview/course-dashboard/course-dashboard.service.ts (1 hunks)
  • src/main/webapp/app/core/navbar/navbar.component.ts (2 hunks)
  • src/main/webapp/app/environments/environment.override.ts (1 hunks)
  • src/main/webapp/app/lecture/manage/attachment.service.ts (1 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/attachment-unit-form/attachment-unit-form.component.html (0 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit-form/attachment-video-unit-form.component.html (1 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit-form/attachment-video-unit-form.component.ts (8 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit.service.ts (3 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/attachment-video-units/attachment-video-units.component.html (4 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/attachment-video-units/attachment-video-units.component.ts (9 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/create-attachment-unit/create-attachment-unit.component.html (0 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/create-attachment-video-unit/create-attachment-video-unit.component.html (1 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/create-attachment-video-unit/create-attachment-video-unit.component.ts (3 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/create-video-unit/create-video-unit.component.html (0 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/create-video-unit/create-video-unit.component.ts (0 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/edit-attachment-unit/edit-attachment-unit.component.html (0 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/edit-attachment-video-unit/edit-attachment-video-unit.component.html (1 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/edit-attachment-video-unit/edit-attachment-video-unit.component.ts (5 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/edit-video-unit/edit-video-unit.component.html (0 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/edit-video-unit/edit-video-unit.component.ts (0 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management-resolve.service.ts (1 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management.component.html (4 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management.component.scss (0 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management.component.ts (13 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management.route.ts (3 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/lecture-units.component.html (1 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/lecture-units.component.ts (8 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/lectureUnit.service.ts (6 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/unit-creation-card/unit-creation-card.component.html (2 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/unit-creation-card/unit-creation-card.component.ts (2 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/video-unit-form/video-unit-form.component.html (0 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/video-unit-form/video-unit-form.component.ts (0 hunks)
  • src/main/webapp/app/lecture/manage/lecture-units/videoUnit.service.ts (0 hunks)
  • src/main/webapp/app/lecture/manage/lecture-update.component.html (3 hunks)
  • src/main/webapp/app/lecture/manage/lecture-update.component.ts (1 hunks)
  • src/main/webapp/app/lecture/manage/lecture.component.ts (1 hunks)
  • src/main/webapp/app/lecture/manage/lecture.service.ts (1 hunks)
  • src/main/webapp/app/lecture/manage/pdf-preview/pdf-preview.component.html (2 hunks)
  • src/main/webapp/app/lecture/manage/pdf-preview/pdf-preview.component.ts (7 hunks)
  • src/main/webapp/app/lecture/overview/course-lectures/attachment-video-unit/attachment-video-unit.component.html (2 hunks)
  • src/main/webapp/app/lecture/overview/course-lectures/attachment-video-unit/attachment-video-unit.component.scss (1 hunks)
  • src/main/webapp/app/lecture/overview/course-lectures/attachment-video-unit/attachment-video-unit.component.ts (4 hunks)
  • src/main/webapp/app/lecture/overview/course-lectures/course-lecture-details.component.html (1 hunks)
  • src/main/webapp/app/lecture/overview/course-lectures/course-lecture-details.component.ts (4 hunks)
  • src/main/webapp/app/lecture/overview/course-lectures/video-unit/video-unit.component.html (0 hunks)
  • src/main/webapp/app/lecture/overview/course-lectures/video-unit/video-unit.component.ts (0 hunks)
  • src/main/webapp/app/lecture/shared/entities/attachment.model.ts (2 hunks)
  • src/main/webapp/app/lecture/shared/entities/lecture-unit/attachmentVideoUnit.model.ts (1 hunks)
  • src/main/webapp/app/lecture/shared/entities/lecture-unit/lectureUnit.model.ts (1 hunks)
  • src/main/webapp/app/lecture/shared/entities/lecture-unit/videoUnit.model.ts (0 hunks)
  • src/main/webapp/app/lecture/shared/entities/lecture.model.ts (1 hunks)
  • src/main/webapp/app/shared/markdown-editor/monaco/markdown-editor-monaco.component.html (3 hunks)
  • src/main/webapp/app/shared/markdown-editor/value-item.model.ts (1 hunks)
  • src/main/webapp/app/shared/monaco-editor/model/actions/communication/lecture-attachment-reference.action.ts (5 hunks)
  • src/main/webapp/i18n/de/lecture.json (1 hunks)
  • src/main/webapp/i18n/de/lectureUnit.json (4 hunks)
  • src/main/webapp/i18n/en/lecture.json (1 hunks)
  • src/main/webapp/i18n/en/lectureUnit.json (4 hunks)
  • src/test/java/de/tum/cit/aet/artemis/atlas/AbstractAtlasIntegrationTest.java (2 hunks)
  • src/test/java/de/tum/cit/aet/artemis/atlas/competency/AbstractCompetencyPrerequisiteIntegrationTest.java (8 hunks)
  • src/test/java/de/tum/cit/aet/artemis/atlas/competency/CourseCompetencyIntegrationTest.java (1 hunks)
  • src/test/java/de/tum/cit/aet/artemis/atlas/service/LearningObjectServiceTest.java (1 hunks)
  • src/test/java/de/tum/cit/aet/artemis/core/FileIntegrationTest.java (8 hunks)
  • src/test/java/de/tum/cit/aet/artemis/iris/PyrisLectureIngestionTest.java (10 hunks)
  • src/test/java/de/tum/cit/aet/artemis/iris/PyrisLectureTranscriptionIngestionTest.java (4 hunks)
  • src/test/java/de/tum/cit/aet/artemis/lecture/AttachmentVideoUnitIntegrationTest.java (6 hunks)
  • src/test/java/de/tum/cit/aet/artemis/lecture/AttachmentVideoUnitsIntegrationTest.java (12 hunks)
  • src/test/java/de/tum/cit/aet/artemis/lecture/LectureIntegrationTest.java (8 hunks)
  • src/test/java/de/tum/cit/aet/artemis/lecture/LectureTranscriptionIntegrationTest.java (1 hunks)
  • src/test/java/de/tum/cit/aet/artemis/lecture/LectureUnitIntegrationTest.java (2 hunks)
  • src/test/java/de/tum/cit/aet/artemis/lecture/LectureUnitServiceTest.java (3 hunks)
  • src/test/java/de/tum/cit/aet/artemis/lecture/VideoUnitIntegrationTest.java (0 hunks)
⛔ Files not processed due to max files limit (30)
  • src/test/java/de/tum/cit/aet/artemis/lecture/test_repository/AttachmentVideoUnitTestRepository.java
  • src/test/java/de/tum/cit/aet/artemis/lecture/test_repository/SlideTestRepository.java
  • src/test/java/de/tum/cit/aet/artemis/lecture/util/LectureFactory.java
  • src/test/java/de/tum/cit/aet/artemis/lecture/util/LectureUtilService.java
  • src/test/javascript/spec/component/competencies/competency-accordion.component.spec.ts
  • src/test/javascript/spec/component/learning-paths/components/learning-path-lecture-unit.component.spec.ts
  • src/test/javascript/spec/component/lecture-unit/attachment-unit/attachment-unit-form.component.spec.ts
  • src/test/javascript/spec/component/lecture-unit/attachment-unit/attachment-video-unit-form.component.spec.ts
  • src/test/javascript/spec/component/lecture-unit/attachment-unit/attachment-video-unit.component.spec.ts
  • src/test/javascript/spec/component/lecture-unit/attachment-unit/attachment-video-unit.service.spec.ts
  • src/test/javascript/spec/component/lecture-unit/attachment-unit/attachment-video-units.component.spec.ts
  • src/test/javascript/spec/component/lecture-unit/attachment-unit/create-attachment-video-unit.component.spec.ts
  • src/test/javascript/spec/component/lecture-unit/attachment-unit/edit-attachment-video-unit.component.spec.ts
  • src/test/javascript/spec/component/lecture-unit/lecture-unit-management.component.spec.ts
  • src/test/javascript/spec/component/lecture-unit/lecture-unit.service.spec.ts
  • src/test/javascript/spec/component/lecture-unit/video-unit/create-video-unit.component.spec.ts
  • src/test/javascript/spec/component/lecture-unit/video-unit/edit-video-unit.component.spec.ts
  • src/test/javascript/spec/component/lecture-unit/video-unit/video-unit-form.component.spec.ts
  • src/test/javascript/spec/component/lecture-unit/video-unit/video-unit.component.spec.ts
  • src/test/javascript/spec/component/lecture-unit/video-unit/video-unit.service.spec.ts
  • src/test/javascript/spec/component/lecture/lecture-units.component.spec.ts
  • src/test/javascript/spec/component/lecture/lecture-update.component.spec.ts
  • src/test/javascript/spec/component/lecture/lecture.component.spec.ts
  • src/test/javascript/spec/component/lecture/pdf-preview/pdf-preview.component.spec.ts
  • src/test/javascript/spec/component/overview/course-competencies/course-competencies-details.component.spec.ts
  • src/test/javascript/spec/component/overview/course-lectures/course-lecture-details.component.spec.ts
  • src/test/javascript/spec/component/shared/monaco-editor/monaco-editor-communication-action.integration.spec.ts
  • src/test/javascript/spec/helpers/mocks/service/mock-attachment-video-units.service.ts
  • src/test/javascript/spec/helpers/sample/metis-sample-data.ts
  • supporting_scripts/lecture-transcription/.gitignore
💤 Files with no reviewable changes (19)
  • src/main/webapp/app/lecture/manage/lecture-units/create-video-unit/create-video-unit.component.html
  • src/main/webapp/app/lecture/manage/lecture-units/create-attachment-unit/create-attachment-unit.component.html
  • src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management.component.scss
  • src/main/webapp/app/lecture/manage/lecture-units/video-unit-form/video-unit-form.component.html
  • src/main/webapp/app/lecture/manage/lecture-units/edit-video-unit/edit-video-unit.component.ts
  • src/main/webapp/app/lecture/manage/lecture-units/edit-video-unit/edit-video-unit.component.html
  • src/main/webapp/app/lecture/overview/course-lectures/video-unit/video-unit.component.ts
  • src/main/webapp/app/lecture/manage/lecture-units/attachment-unit-form/attachment-unit-form.component.html
  • src/main/java/de/tum/cit/aet/artemis/lecture/domain/VideoUnit.java
  • src/main/webapp/app/lecture/manage/lecture-units/edit-attachment-unit/edit-attachment-unit.component.html
  • src/main/webapp/app/lecture/shared/entities/lecture-unit/videoUnit.model.ts
  • src/main/webapp/app/lecture/manage/lecture-units/videoUnit.service.ts
  • src/main/webapp/app/lecture/overview/course-lectures/video-unit/video-unit.component.html
  • src/main/java/de/tum/cit/aet/artemis/lecture/repository/VideoUnitRepository.java
  • src/test/java/de/tum/cit/aet/artemis/lecture/VideoUnitIntegrationTest.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/AttachmentUnitService.java
  • src/main/webapp/app/lecture/manage/lecture-units/create-video-unit/create-video-unit.component.ts
  • src/main/webapp/app/lecture/manage/lecture-units/video-unit-form/video-unit-form.component.ts
  • src/main/java/de/tum/cit/aet/artemis/lecture/web/VideoUnitResource.java
🧰 Additional context used
📓 Path-based instructions (5)
`src/main/java/**/*.java`: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,de...

src/main/java/**/*.java: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports

  • src/main/java/de/tum/cit/aet/artemis/lecture/web/AttachmentResource.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/repository/LectureUnitMetricsRepository.java
  • src/main/java/de/tum/cit/aet/artemis/communication/domain/notification/GroupNotificationFactory.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/domain/LectureUnit.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/repository/SlideRepository.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureUnitService.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/web/LectureTranscriptionResource.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureUnitImportService.java
  • src/main/java/de/tum/cit/aet/artemis/core/service/FileService.java
  • src/main/java/de/tum/cit/aet/artemis/iris/service/session/IrisLectureChatSessionService.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/SlideSplitterService.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/domain/Attachment.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/domain/Slide.java
  • src/main/java/de/tum/cit/aet/artemis/core/service/FilePathService.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/web/LectureResource.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureUnitProcessingService.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/AttachmentVideoUnitService.java
  • src/main/java/de/tum/cit/aet/artemis/iris/api/IrisLectureApi.java
  • src/main/java/de/tum/cit/aet/artemis/iris/service/pyris/dto/chat/lecture/PyrisLectureChatPipelineExecutionDTO.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/domain/AttachmentVideoUnit.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/repository/AttachmentVideoUnitRepository.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureService.java
  • src/main/java/de/tum/cit/aet/artemis/core/web/FileResource.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/web/AttachmentVideoUnitResource.java
  • src/main/java/de/tum/cit/aet/artemis/iris/service/pyris/PyrisWebhookService.java
`src/main/webapp/**/*.ts`: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalC...

src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

  • src/main/webapp/app/lecture/manage/lecture.component.ts
  • src/main/webapp/app/lecture/manage/lecture-units/unit-creation-card/unit-creation-card.component.ts
  • src/main/webapp/app/lecture/manage/attachment.service.ts
  • src/main/webapp/app/lecture/manage/lecture-update.component.ts
  • src/main/webapp/app/environments/environment.override.ts
  • src/main/webapp/app/lecture/shared/entities/lecture.model.ts
  • src/main/webapp/app/lecture/overview/course-lectures/course-lecture-details.component.ts
  • src/main/webapp/app/shared/markdown-editor/value-item.model.ts
  • src/main/webapp/app/lecture/manage/lecture-units/lectureUnit.service.ts
  • src/main/webapp/app/atlas/overview/learning-path-lecture-unit/learning-path-lecture-unit.component.ts
  • src/main/webapp/app/lecture/manage/lecture.service.ts
  • src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management-resolve.service.ts
  • src/main/webapp/app/core/course/overview/course-dashboard/course-dashboard.service.ts
  • src/main/webapp/app/lecture/shared/entities/attachment.model.ts
  • src/main/webapp/app/atlas/overview/course-competencies/course-competencies-details.component.ts
  • src/main/webapp/app/communication/posting-content.components.ts
  • src/main/webapp/app/core/navbar/navbar.component.ts
  • src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management.component.ts
  • src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management.route.ts
  • src/main/webapp/app/lecture/manage/lecture-units/lecture-units.component.ts
  • src/main/webapp/app/lecture/shared/entities/lecture-unit/attachmentVideoUnit.model.ts
  • src/main/webapp/app/lecture/manage/pdf-preview/pdf-preview.component.ts
  • src/main/webapp/app/lecture/shared/entities/lecture-unit/lectureUnit.model.ts
  • src/main/webapp/app/lecture/manage/lecture-units/attachment-video-units/attachment-video-units.component.ts
  • src/main/webapp/app/lecture/manage/lecture-units/create-attachment-video-unit/create-attachment-video-unit.component.ts
  • src/main/webapp/app/lecture/overview/course-lectures/attachment-video-unit/attachment-video-unit.component.ts
  • src/main/webapp/app/lecture/manage/lecture-units/edit-attachment-video-unit/edit-attachment-video-unit.component.ts
  • src/main/webapp/app/shared/monaco-editor/model/actions/communication/lecture-attachment-reference.action.ts
  • src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit-form/attachment-video-unit-form.component.ts
  • src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit.service.ts
`src/main/webapp/**/*.html`: @if and @for are new and valid Angular syntax replacing *ngIf and *ngFor. They should always be used over the old style.

src/main/webapp/**/*.html: @if and @for are new and valid Angular syntax replacing *ngIf and *ngFor. They should always be used over the old style.

  • src/main/webapp/app/atlas/overview/competency-accordion/competency-accordion.component.html
  • src/main/webapp/app/lecture/manage/lecture-update.component.html
  • src/main/webapp/app/lecture/manage/pdf-preview/pdf-preview.component.html
  • src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management.component.html
  • src/main/webapp/app/lecture/overview/course-lectures/attachment-video-unit/attachment-video-unit.component.html
  • src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit-form/attachment-video-unit-form.component.html
  • src/main/webapp/app/atlas/overview/learning-path-lecture-unit/learning-path-lecture-unit.component.html
  • src/main/webapp/app/lecture/manage/lecture-units/attachment-video-units/attachment-video-units.component.html
  • src/main/webapp/app/lecture/manage/lecture-units/edit-attachment-video-unit/edit-attachment-video-unit.component.html
  • src/main/webapp/app/atlas/overview/course-competencies/course-competencies-details.component.html
  • src/main/webapp/app/shared/markdown-editor/monaco/markdown-editor-monaco.component.html
  • src/main/webapp/app/lecture/overview/course-lectures/course-lecture-details.component.html
  • src/main/webapp/app/lecture/manage/lecture-units/create-attachment-video-unit/create-attachment-video-unit.component.html
  • src/main/webapp/app/lecture/manage/lecture-units/unit-creation-card/unit-creation-card.component.html
  • src/main/webapp/app/lecture/manage/lecture-units/lecture-units.component.html
`src/test/java/**/*.java`: test_naming: descriptive; test_size: small_specific; fixed_data: true; junit5_features: true; assert_use: assertThat; assert_specificity: true; archunit_...

src/test/java/**/*.java: test_naming: descriptive; test_size: small_specific; fixed_data: true; junit5_features: true; assert_use: assertThat; assert_specificity: true; archunit_use: enforce_package_rules; db_query_count_tests: track_performance; util_service_factory_pattern: true; avoid_db_access: true; mock_strategy: static_mocks; context_restart_minimize: true

  • src/test/java/de/tum/cit/aet/artemis/atlas/service/LearningObjectServiceTest.java
  • src/test/java/de/tum/cit/aet/artemis/lecture/LectureUnitIntegrationTest.java
  • src/test/java/de/tum/cit/aet/artemis/iris/PyrisLectureTranscriptionIngestionTest.java
  • src/test/java/de/tum/cit/aet/artemis/lecture/LectureTranscriptionIntegrationTest.java
  • src/test/java/de/tum/cit/aet/artemis/atlas/AbstractAtlasIntegrationTest.java
  • src/test/java/de/tum/cit/aet/artemis/atlas/competency/CourseCompetencyIntegrationTest.java
  • src/test/java/de/tum/cit/aet/artemis/lecture/LectureUnitServiceTest.java
  • src/test/java/de/tum/cit/aet/artemis/atlas/competency/AbstractCompetencyPrerequisiteIntegrationTest.java
  • src/test/java/de/tum/cit/aet/artemis/lecture/LectureIntegrationTest.java
  • src/test/java/de/tum/cit/aet/artemis/lecture/AttachmentVideoUnitIntegrationTest.java
  • src/test/java/de/tum/cit/aet/artemis/core/FileIntegrationTest.java
  • src/test/java/de/tum/cit/aet/artemis/lecture/AttachmentVideoUnitsIntegrationTest.java
  • src/test/java/de/tum/cit/aet/artemis/iris/PyrisLectureIngestionTest.java
`src/main/webapp/i18n/de/**/*.json`: German language translations should be informal (dutzen) and should never be formal (sietzen). So the user should always be addressed with "du/...

src/main/webapp/i18n/de/**/*.json: German language translations should be informal (dutzen) and should never be formal (sietzen). So the user should always be addressed with "du/dein" and never with "sie/ihr".

  • src/main/webapp/i18n/de/lecture.json
  • src/main/webapp/i18n/de/lectureUnit.json
🧠 Learnings (1)
src/test/java/de/tum/cit/aet/artemis/atlas/competency/CourseCompetencyIntegrationTest.java (1)
Learnt from: julian-christl
PR: ls1intum/Artemis#8052
File: src/test/java/de/tum/in/www1/artemis/lecture/CompetencyIntegrationTest.java:310-310
Timestamp: 2025-04-07T13:18:44.502Z
Learning: Modifications to parameters in `competencyProgressUtilService.createCompetencyProgress` for debugging purposes are considered irrelevant to the test outcomes but helpful for clarity during debugging.
🧬 Code Definitions (20)
src/test/java/de/tum/cit/aet/artemis/atlas/service/LearningObjectServiceTest.java (1)
src/test/java/de/tum/cit/aet/artemis/lecture/util/LectureFactory.java (1)
  • LectureFactory (23-119)
src/test/java/de/tum/cit/aet/artemis/lecture/LectureUnitIntegrationTest.java (1)
src/main/webapp/app/lecture/manage/lecture-units/create-attachment-video-unit/create-attachment-video-unit.component.ts (1)
  • createAttachmentVideoUnit (45-90)
src/test/java/de/tum/cit/aet/artemis/iris/PyrisLectureTranscriptionIngestionTest.java (1)
src/main/webapp/app/lecture/manage/lecture-units/create-attachment-video-unit/create-attachment-video-unit.component.ts (1)
  • createAttachmentVideoUnit (45-90)
src/test/java/de/tum/cit/aet/artemis/lecture/LectureTranscriptionIntegrationTest.java (1)
src/main/webapp/app/lecture/manage/lecture-units/create-attachment-video-unit/create-attachment-video-unit.component.ts (1)
  • createAttachmentVideoUnit (45-90)
src/test/java/de/tum/cit/aet/artemis/atlas/competency/CourseCompetencyIntegrationTest.java (1)
src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit.service.ts (1)
  • findById (20-24)
src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management-resolve.service.ts (1)
src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit.service.ts (1)
  • Injectable (11-81)
src/test/java/de/tum/cit/aet/artemis/atlas/competency/AbstractCompetencyPrerequisiteIntegrationTest.java (1)
src/main/webapp/app/lecture/manage/lecture-units/create-attachment-video-unit/create-attachment-video-unit.component.ts (1)
  • createAttachmentVideoUnit (45-90)
src/test/java/de/tum/cit/aet/artemis/lecture/LectureIntegrationTest.java (2)
src/main/webapp/app/lecture/manage/lecture-units/create-attachment-video-unit/create-attachment-video-unit.component.ts (1)
  • createAttachmentVideoUnit (45-90)
src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit.service.ts (1)
  • findById (20-24)
src/main/webapp/app/lecture/manage/lecture-units/lecture-units.component.ts (1)
src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit-form/attachment-video-unit-form.component.ts (1)
  • AttachmentVideoUnitFormData (17-20)
src/main/webapp/app/lecture/manage/lecture-units/create-attachment-video-unit/create-attachment-video-unit.component.ts (2)
src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit-form/attachment-video-unit-form.component.ts (2)
  • Component (85-246)
  • AttachmentVideoUnitFormData (17-20)
src/main/webapp/app/lecture/manage/lecture-units/edit-attachment-video-unit/edit-attachment-video-unit.component.ts (1)
  • Component (15-115)
src/main/java/de/tum/cit/aet/artemis/lecture/service/AttachmentVideoUnitService.java (4)
src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureUnitImportService.java (1)
  • Profile (29-162)
src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureUnitProcessingService.java (1)
  • Profile (42-319)
src/main/java/de/tum/cit/aet/artemis/core/service/FilePathService.java (1)
  • Profile (18-273)
src/main/java/de/tum/cit/aet/artemis/lecture/service/SlideSplitterService.java (1)
  • Profile (36-117)
src/main/java/de/tum/cit/aet/artemis/lecture/repository/AttachmentVideoUnitRepository.java (4)
src/main/java/de/tum/cit/aet/artemis/core/web/FileResource.java (1)
  • Profile (95-777)
src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureUnitProcessingService.java (1)
  • Profile (42-319)
src/main/java/de/tum/cit/aet/artemis/core/service/FilePathService.java (1)
  • Profile (18-273)
src/main/java/de/tum/cit/aet/artemis/lecture/service/AttachmentVideoUnitService.java (1)
  • Profile (32-229)
src/test/java/de/tum/cit/aet/artemis/lecture/AttachmentVideoUnitIntegrationTest.java (2)
src/test/java/de/tum/cit/aet/artemis/lecture/util/LectureFactory.java (1)
  • LectureFactory (23-119)
src/main/webapp/app/lecture/manage/lecture-units/create-attachment-video-unit/create-attachment-video-unit.component.ts (1)
  • createAttachmentVideoUnit (45-90)
src/main/webapp/app/lecture/overview/course-lectures/attachment-video-unit/attachment-video-unit.component.ts (3)
src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit-form/attachment-video-unit-form.component.ts (1)
  • Component (85-246)
src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management.component.ts (1)
  • Component (34-359)
src/main/webapp/app/lecture/manage/lecture-units/create-attachment-video-unit/create-attachment-video-unit.component.ts (1)
  • Component (15-91)
src/main/webapp/app/lecture/manage/lecture-units/edit-attachment-video-unit/edit-attachment-video-unit.component.ts (5)
src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management.component.ts (1)
  • Component (34-359)
src/main/webapp/app/lecture/manage/lecture-units/attachment-video-units/attachment-video-units.component.ts (1)
  • Component (34-272)
src/main/webapp/app/lecture/manage/lecture-units/create-attachment-video-unit/create-attachment-video-unit.component.ts (1)
  • Component (15-91)
src/main/webapp/app/lecture/manage/lecture-update.component.ts (1)
  • Component (32-351)
src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit-form/attachment-video-unit-form.component.ts (1)
  • AttachmentVideoUnitFormData (17-20)
src/main/webapp/app/shared/monaco-editor/model/actions/communication/lecture-attachment-reference.action.ts (1)
src/main/webapp/app/shared/util/markdown.util.ts (1)
  • sanitizeStringForMarkdownEditor (12-25)
src/test/java/de/tum/cit/aet/artemis/iris/PyrisLectureIngestionTest.java (1)
src/test/java/de/tum/cit/aet/artemis/lecture/util/LectureFactory.java (1)
  • LectureFactory (23-119)
src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit-form/attachment-video-unit-form.component.ts (3)
src/main/webapp/app/lecture/manage/lecture-units/lecture-units.component.ts (1)
  • Component (25-285)
src/main/webapp/app/lecture/manage/lecture-units/create-attachment-video-unit/create-attachment-video-unit.component.ts (1)
  • Component (15-91)
src/main/webapp/app/lecture/overview/course-lectures/attachment-video-unit/attachment-video-unit.component.ts (1)
  • Component (28-149)
src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit.service.ts (2)
src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management-resolve.service.ts (1)
  • Injectable (10-25)
src/main/webapp/app/lecture/manage/lecture-units/attachment-video-units/attachment-video-units.component.ts (1)
  • LectureUnitInformationDTO (28-32)
src/main/java/de/tum/cit/aet/artemis/lecture/web/AttachmentVideoUnitResource.java (1)
src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureUnitProcessingService.java (1)
  • Profile (42-319)
🪛 Biome (1.9.4)
src/main/webapp/app/lecture/overview/course-lectures/attachment-video-unit/attachment-video-unit.component.ts

[error] 41-41: Use a regular expression literal instead of the RegExp constructor.

Regular expression literals avoid some escaping required in a string literal, and are easier to analyze statically.
Safe fix: Use a literal notation instead.

(lint/complexity/useRegexLiterals)

⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Build and Push Docker Image / Build Docker Image for ls1intum/artemis
  • GitHub Check: Build and Push Docker Image / Build Docker Image for ls1intum/artemis
  • GitHub Check: server-tests
  • GitHub Check: Analyse
🔇 Additional comments (301)
src/main/webapp/app/environments/environment.override.ts (2)

1-1: Clear File Header Warning

The header comment clearly warns not to modify this file manually since it gets overwritten during the build process. This is helpful for developers.


2-3: Correct Constant Declarations

The constants __DEBUG_INFO_ENABLED__ and __VERSION__ are declared with appropriate values according to the application requirements. Their definitions follow the expected export pattern.

src/main/webapp/app/lecture/overview/course-lectures/attachment-video-unit/attachment-video-unit.component.scss (1)

1-4: Looks good!

Simple and clean CSS class implementation for adding adequate spacing around the video player.

src/main/webapp/app/atlas/overview/competency-accordion/competency-accordion.component.html (1)

87-87: LGTM - Type check updated for merged unit.

The condition has been properly updated to check for the new ATTACHMENT_VIDEO type instead of the previous ATTACHMENT type, which aligns with the PR's objective of merging attachment and video units.

src/main/webapp/i18n/de/lecture.json (1)

99-99: Key name updated to reflect new unit type.

Translation key has been renamed from "attachmentUnitIDError" to "attachmentVideoUnitIDError" to maintain consistency with the merged attachment-video unit concept. The translation itself appropriately uses informal language (dutzen) as required by coding guidelines.

src/test/java/de/tum/cit/aet/artemis/atlas/service/LearningObjectServiceTest.java (1)

89-89: Factory method updated correctly.

The test now properly uses generateAttachmentVideoUnit() instead of the previous generateAttachmentUnit() method, maintaining test functionality with the updated domain model. This change aligns with the PR objective of merging attachment and video units.

src/main/webapp/app/shared/markdown-editor/value-item.model.ts (1)

6-6: Property rename aligns with PR objectives

The property has been correctly renamed from attachmentUnits to attachmentVideoUnits to reflect the integration of video unit and attachment unit entities. This change maintains consistency with other similar changes throughout the codebase.

src/main/webapp/app/lecture/manage/attachment.service.ts (1)

29-32: Properly updated property references

The code has been correctly updated to check for attachmentVideoUnit instead of what was previously attachmentUnit. The nullifying of the lecture and competencyLinks properties is maintained to avoid potential issues when sending the attachment to the server.

src/main/java/de/tum/cit/aet/artemis/lecture/repository/LectureUnitMetricsRepository.java (1)

32-32: Query JOIN condition correctly updated

The JOIN condition in the SQL query has been properly updated to use a.attachmentVideoUnit.id instead of the previous field name, ensuring that the query works correctly with the new entity relationship structure.

src/main/java/de/tum/cit/aet/artemis/lecture/web/AttachmentResource.java (1)

122-122: Method reference updated to match new domain model

The code correctly updates the reference from getAttachmentUnit() to getAttachmentVideoUnit(), aligning with the PR objective of transitioning from separate attachment and video units to a unified attachment-video unit.

src/main/webapp/app/lecture/shared/entities/lecture.model.ts (1)

7-7: Import updated to reference new unified model

The import statement has been correctly updated to reference the IngestionState type from the new combined attachmentVideoUnit.model instead of the previous attachmentUnit.model. This is consistent with the architectural refactoring described in the PR objectives.

src/main/webapp/app/lecture/manage/lecture.component.ts (1)

19-19: Import path updated to point to new model

The import statement has been correctly updated to reference the IngestionState from the new attachmentVideoUnit.model. This change maintains consistency across the frontend codebase with the architectural refactoring described in the PR.

src/main/java/de/tum/cit/aet/artemis/communication/domain/notification/GroupNotificationFactory.java (1)

68-69: Method reference updated to reflect domain model changes

The code correctly updates the condition to check for getAttachmentVideoUnit() instead of getAttachmentUnit(), maintaining the same functionality while adapting to the unified attachment-video unit model.

src/main/webapp/app/lecture/manage/lecture-update.component.ts (1)

305-305: Route path updated to use attachment-video-units

This navigation path update is consistent with the PR objective of merging attachment and video units into a unified attachment-video-unit. The routing structure follows Angular best practices with proper resource hierarchy.

src/main/webapp/app/lecture/manage/lecture.service.ts (1)

10-10: Import statement updated for IngestionState

The import statement has been properly updated to reference the new attachmentVideoUnit.model instead of attachmentUnit.model, aligning with the unified attachment-video unit structure.

src/main/webapp/app/core/course/overview/course-dashboard/course-dashboard.service.ts (1)

122-135:

❓ Verification inconclusive

Updated lecture unit type mapping to reflect unit merger

The mapToLectureUnitType method has been updated to map the AttachmentUnit type to ATTACHMENT_VIDEO instead of just ATTACHMENT. The case for VideoUnit has been removed as part of the unit merger.

This change ensures consistent type mapping throughout the application but might affect any code that relies on the previous mapping behavior.


🏁 Script executed:

#!/bin/bash
# Search for any remaining references to LectureUnitType.VIDEO that might need updating
rg "LectureUnitType\.VIDEO" --type ts

Length of output: 39


Below is the updated review comment with a note to double-check that no lingering VideoUnit references remain. I've also included a further search script for reference.


Updated Lecture Unit Mapping – Please Verify No Residual 'VideoUnit' References

The method mapToLectureUnitType now maps 'de.tum.cit.aet.artemis.lecture.domain.AttachmentUnit' to LectureUnitType.ATTACHMENT_VIDEO. In doing so, it removes the previous VideoUnit handling as part of the unit merger. An initial search for LectureUnitType.VIDEO produced no output, but please manually verify that no references to de.tum.cit.aet.artemis.lecture.domain.VideoUnit remain elsewhere in the codebase.

  • Confirm no use of de.tum.cit.aet.artemis.lecture.domain.VideoUnit is present.
  • Ensure that all code relying on the earlier mapping has been updated accordingly.

For further verification, you may run:


🏁 Script executed:

#!/bin/bash
# Search for any references to the old VideoUnit domain type
rg "de\.tum\.cit\.aet\.artemis\.lecture\.domain\.VideoUnit" --type ts

Length of output: 193


Updated Lecture Unit Mapping – Verify for Residual Video References

The method mapToLectureUnitType has been updated in src/main/webapp/app/core/course/overview/course-dashboard/course-dashboard.service.ts so that 'de.tum.cit.aet.artemis.lecture.domain.AttachmentUnit' now maps to LectureUnitType.ATTACHMENT_VIDEO, and the previous handling for the old VideoUnit has been removed as part of the unit merger. Automated searches for LectureUnitType.VIDEO and for references to de.tum.cit.aet.artemis.lecture.domain.VideoUnit produced no matches. However, please manually verify that no other part of the codebase relies on these removed mappings.

  • Confirm no reference to LectureUnitType.VIDEO exists.
  • Verify that no usages of de.tum.cit.aet.artemis.lecture.domain.VideoUnit remain.
src/main/webapp/app/lecture/manage/pdf-preview/pdf-preview.component.html (2)

9-11: Updated template to handle attachmentVideoUnit

The template has been properly updated to check for and display the attachmentVideoUnit information, aligning with the unified attachment-video approach.

The modern Angular syntax (@if/@else) is correctly used as per the coding guidelines.


58-62: Updated navigation logic for attachmentVideoUnit

The router link has been updated to handle the case when an attachmentVideoUnit is available instead of an attachment.

This change ensures proper navigation in the UI while maintaining consistent behavior between attachment and video units.

src/test/java/de/tum/cit/aet/artemis/atlas/competency/CourseCompetencyIntegrationTest.java (1)

323-323: Repository type updated to match new entity structure.

The test has been updated to use attachmentVideoUnitRepository instead of what was likely attachmentUnitRepository previously, which aligns with the PR's objective of merging attachment and video units into a single entity type.

src/main/webapp/app/lecture/manage/lecture-units/edit-attachment-video-unit/edit-attachment-video-unit.component.html (1)

1-3: LGTM: Edit form structure follows Angular component patterns.

The component template correctly uses the new Angular syntax with the lecture unit layout and attachment-video unit form, binding the necessary properties and events.

src/main/webapp/app/lecture/manage/lecture-units/create-attachment-video-unit/create-attachment-video-unit.component.html (1)

1-3: LGTM: Create form structure follows Angular component patterns.

The component template correctly uses the new Angular syntax with the lecture unit layout and attachment-video unit form. The isEditMode property is appropriately set to false for creation mode.

src/main/webapp/app/atlas/overview/course-competencies/course-competencies-details.component.html (1)

61-62: Successfully consolidated attachment and video unit types.

The switch case has been updated to replace the separate ATTACHMENT and VIDEO cases with a single ATTACHMENT_VIDEO case, maintaining the same completion event handling. This aligns with the PR's objective of merging these unit types.

src/main/webapp/app/lecture/manage/lecture-update.component.html (7)

67-68: Translation keys properly updated for video unit integration.

The translation keys are correctly updated to use attachmentVideoUnit instead of attachmentUnit, reflecting the merge of attachment and video units.


75-77: Successfully updated informative text translation keys.

All informative text references have been correctly updated to use the new attachmentVideoUnit namespace, maintaining consistency with the merged unit type.


83-84: File label and help text properly updated.

The file field label and help text now correctly reference the attachment video unit translation keys.


87-87: Tooltip translation key properly updated.

The tooltip translation key now correctly uses the new attachment video unit namespace.


98-98: File placeholder translation key properly updated.

The file input placeholder now correctly references the attachment video unit translation key.


104-104: Error message translation key properly updated.

The validation error message now correctly uses the attachment video unit namespace.


119-119: Process units button text updated correctly.

The button translation key has been properly updated to the new attachment video unit namespace.

src/main/webapp/app/atlas/overview/learning-path-lecture-unit/learning-path-lecture-unit.component.ts (2)

9-9: Import correctly updated to use the unified component.

The import statement now correctly references the new consolidated AttachmentVideoUnitComponent instead of separate components.


19-19: Component imports updated to use the unified video unit component.

The component's imports array now correctly includes the consolidated AttachmentVideoUnitComponent, replacing the previously separate unit components.

src/main/webapp/app/communication/posting-content.components.ts (1)

166-169: Variable name updated for consistency with merged unit type.

The variable name has been properly updated from attachmentUnitRefDir to attachmentVideoUnitRefDir to reflect the consolidation of attachment and video units, and its usage has been updated accordingly.

src/main/java/de/tum/cit/aet/artemis/lecture/domain/LectureUnit.java (1)

48-54: JsonSubTypes annotation correctly updated for the merged unit type.

The @JsonSubTypes annotation has been properly updated to use AttachmentVideoUnit.class for the "attachment" type, and the "video" type entry has been removed, correctly reflecting the merging of these unit types.

src/main/webapp/app/lecture/shared/entities/attachment.model.ts (2)

5-5: Updated import to use the new unified AttachmentVideoUnit

This change correctly updates the import statement to use the new combined AttachmentVideoUnit instead of the previous AttachmentUnit, aligning with the PR objective to integrate video and attachment units.


23-23: Updated property type to use the new unified entity type

The property has been correctly renamed from attachmentUnit to attachmentVideoUnit with the appropriate type. This change aligns with the PR objective to facilitate linking attachments to lecture transcriptions.

src/main/java/de/tum/cit/aet/artemis/lecture/web/LectureTranscriptionResource.java (3)

34-34: Updated import to use the new unified AttachmentVideoUnit

The import statement has been correctly updated to use the new AttachmentVideoUnit class instead of the previous VideoUnit, aligning with the overall refactoring approach.


137-141: Updated instance check to use the new unified type

The instance check has been properly updated to verify if the lectureUnit is an instance of AttachmentVideoUnit instead of VideoUnit. The error message has also been appropriately updated to reflect this change.


143-143: Updated type cast to the new unified type

The type cast has been properly updated to cast the lectureUnit to AttachmentVideoUnit instead of VideoUnit, ensuring consistent usage of the new unified type throughout the codebase.

src/main/webapp/app/lecture/manage/lecture-units/unit-creation-card/unit-creation-card.component.ts (2)

2-2: Updated icon import to reflect the new unified functionality

The import statement has been appropriately updated to include faFileVideo instead of faFileUpload, which better represents the unified attachment-video unit functionality.


31-31: Updated icon property to use the file-video icon

The property has been correctly renamed and typed to use the faFileVideo icon, providing a more appropriate visual representation for the unified attachment-video unit in the UI.

src/main/java/de/tum/cit/aet/artemis/lecture/web/LectureResource.java (2)

212-212: Updated method call to use the new unified type filter

The method call has been correctly updated from filterActiveAttachmentUnits to filterActiveAttachmentVideoUnits to reflect the changes in the entity model, ensuring consistent handling of the new unified type.


340-340: Updated filtering method to handle the new unified type

The filtering method call has been properly updated to filterActiveAttachmentVideoUnits, maintaining consistency with the entity model changes throughout the codebase.

src/main/webapp/app/lecture/shared/entities/lecture-unit/attachmentVideoUnit.model.ts (1)

5-5: Proper implementation of the merged AttachmentVideoUnit class.

The class has been correctly renamed from AttachmentUnit to AttachmentVideoUnit and includes the new videoSource property. The constructor properly initializes with the new LectureUnitType.ATTACHMENT_VIDEO type.

Also applies to: 9-9, 13-13

src/test/java/de/tum/cit/aet/artemis/lecture/LectureTranscriptionIntegrationTest.java (1)

62-62: Correctly updated unit creation method to use the new combined type.

The test now uses createAttachmentVideoUnit(false) instead of the previous createVideoUnit(), properly aligning with the PR objectives to merge video units and attachment units.

src/test/java/de/tum/cit/aet/artemis/lecture/LectureUnitIntegrationTest.java (1)

23-23: Test updated appropriately to use the new AttachmentVideoUnit type.

The import has been correctly updated, and the test now uses AttachmentVideoUnit with the createAttachmentVideoUnit(false) method, properly reflecting the unit type consolidation in the PR.

Also applies to: 77-77, 83-83

src/test/java/de/tum/cit/aet/artemis/atlas/AbstractAtlasIntegrationTest.java (1)

40-40: Repository reference properly updated to match the new unit type.

The repository import and field declaration have been correctly updated to reference AttachmentVideoUnitTestRepository instead of AttachmentUnitTestRepository, maintaining consistency with the merged unit type.

Also applies to: 109-109

src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit-form/attachment-video-unit-form.component.html (1)

1-179: Well-structured form implementation following Angular best practices.

The form correctly implements reactive forms with proper validation, internationalization, and error handling. The component uses the modern @if and @for syntax as required by the coding guidelines instead of the older *ngIf and *ngFor directives.

src/main/java/de/tum/cit/aet/artemis/core/service/FileService.java (2)

363-364: Correctly updated path references for attachment video units.

The path check is appropriately updated to use the new getAttachmentVideoUnitFilePath() method, aligning with the overall refactoring to unify attachment and video units.


366-367: Properly updated path check for slide subpath.

Path check for the slide subpath correctly maintained along with the update to the main attachment video unit path.

src/main/java/de/tum/cit/aet/artemis/lecture/repository/SlideRepository.java (1)

18-18: Updated repository method signature to match entity renaming.

Method signature has been properly updated from findSlideByAttachmentUnitIdAndSlideNumber to findSlideByAttachmentVideoUnitIdAndSlideNumber to reflect the entity naming change.

src/main/webapp/app/core/navbar/navbar.component.ts (2)

297-297: Updated breadcrumb translation key to match new entity naming.

The breadcrumb translation key has been correctly updated from attachmentUnit to attachmentVideoUnit to match the entity renaming.


642-642: Updated navigation case statement for attachment video units.

The case statement in the switch block has been properly updated from attachment-units to attachment-video-units to match the route changes.

src/test/java/de/tum/cit/aet/artemis/lecture/LectureUnitServiceTest.java (3)

14-14: LGTM: Import updated to match refactored unit type

The import has been correctly updated to reflect the merged entity AttachmentVideoUnit.


48-48: LGTM: Method call updated to use the new merged unit

The utility method call has been properly updated to create an AttachmentVideoUnit instead of separate attachment/video units.


92-92: LGTM: Unit instantiation correctly updated

The instantiation has been properly updated to use AttachmentVideoUnit instead of AttachmentUnit.

src/main/webapp/app/lecture/overview/course-lectures/course-lecture-details.component.ts (4)

11-11: LGTM: Import updated to reflect merged unit type

The import statement has been correctly updated to use the new AttachmentVideoUnit type.


28-28: LGTM: Import updated for the new component

The import correctly references the new AttachmentVideoUnitComponent that replaces the separate components.


53-53: LGTM: Component declaration updated in imports array

The component declaration in the imports array has been properly updated to use AttachmentVideoUnitComponent.


144-146: LGTM: Filter condition updated to use the new unit type

The filter condition has been correctly updated to check for LectureUnitType.ATTACHMENT_VIDEO instead of the separate types.

src/main/webapp/app/atlas/overview/learning-path-lecture-unit/learning-path-lecture-unit.component.html (1)

15-16: LGTM: Switch case updated to use new unit type and component

The switch case has been properly updated to use the new LectureUnitType.ATTACHMENT_VIDEO type and the corresponding jhi-attachment-video-unit component. The code also correctly uses the new Angular @case syntax as specified in the coding guidelines.

src/test/java/de/tum/cit/aet/artemis/iris/PyrisLectureTranscriptionIngestionTest.java (3)

56-56: LGTM: Variable renamed to reflect its new purpose

The variable has been appropriately renamed from attachmentUnit to textUnit to reflect the changes in the test structure.


66-69: LGTM: Initialization updated to use new unit types

The initialization code has been correctly updated to create attachment-video units and a text unit instead of separate attachment and video units. This aligns with the PR objective to merge the units.


123-125: LGTM: Test method updated to use text unit instead of attachment unit

The test method and request path have been properly updated to use textUnit, keeping the test coverage appropriate for the refactored functionality.

src/main/webapp/app/atlas/overview/course-competencies/course-competencies-details.component.ts (1)

34-34: Component import updated to match unified attachment-video unit structure.

The import and usage of AttachmentVideoUnitComponent correctly implements the unified attachment-video unit approach mentioned in the PR objectives. This component now replaces the previously separate attachment and video unit components.

Also applies to: 57-57

src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management.component.html (6)

18-18: Updated class binding to use the new unified unit type.

The class binding for lecture units now correctly checks for LectureUnitType.ATTACHMENT_VIDEO instead of the previous attachment type, aligning with the PR's goal of unifying attachment and video units.


37-39: Style binding logic updated for unified attachment-video unit.

The style binding now correctly checks whether the unit is of type ATTACHMENT_VIDEO and has an attachment, which is consistent with the PR's objective of supporting units that can have either attachments, videos, or both.


47-51: Badge condition updated to match new unit structure.

The badge display condition now checks for both LectureUnitType.ATTACHMENT_VIDEO and presence of an attachment, correctly implementing the new dual-purpose unit type. This ensures the attachment version is only shown when relevant.


55-57: Unit component switch case updated to use the new component.

The switch case now correctly renders the new <jhi-attachment-video-unit> component for the ATTACHMENT_VIDEO type, completing the transition from separate components to a unified one.


71-71: Lecture ingestion condition updated for new unit type.

The condition for enabling lecture ingestion functionality has been properly updated to check for the new ATTACHMENT_VIDEO unit type, maintaining this feature's availability with the refactored units.


110-119: Router link path updated to use new unit endpoint.

The router link now correctly points to the new attachment-video-units endpoint instead of the previous attachment-units endpoint, ensuring proper navigation within the application.

src/main/webapp/app/shared/markdown-editor/monaco/markdown-editor-monaco.component.html (3)

156-156: Updated iteration to use new attachment-video units collection.

The template now correctly iterates over lecture.attachmentVideoUnits instead of the previous attachmentUnits, aligning with the structural changes implemented in the PR.


168-169: Parameter name updated in method call for attachment units.

The parameter being passed to executeInCurrentEditor has been correctly updated from attachmentUnit to attachmentVideoUnit to reflect the new unified unit structure.


184-185: Parameter name updated in method call for slides.

The parameter name has been correctly updated from attachmentUnit to attachmentVideoUnit when executing actions for slides, maintaining consistency with the unified unit model.

src/main/java/de/tum/cit/aet/artemis/iris/service/pyris/dto/chat/lecture/PyrisLectureChatPipelineExecutionDTO.java (1)

13-14: DTO parameter structure optimized using primitive types.

The record constructor has been updated to use primitive long types for course and lecture IDs instead of the previous PyrisCourseDTO object. This change:

  1. Simplifies the data transfer object
  2. Follows Java best practices of preferring primitives when appropriate
  3. Reduces unnecessary object creation
  4. Aligns with the overall refactoring approach in the PR

This change maintains the same functionality while improving the code structure.

src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureUnitService.java (5)

167-169: Clean implementation of merged AttachmentVideoUnit type check

The code correctly checks if the lecture unit is an instance of AttachmentVideoUnit and uses pattern matching for variable assignment, which follows best practices for type checking in Java.


169-170: Slide handling well preserved in transition

The conditional logic for attachment and slide handling has been properly maintained while transitioning from the previous AttachmentUnit to the new AttachmentVideoUnit type.


174-174: Properly maintained Pyris integration

The integration with the Pyris database has been correctly updated to work with the new AttachmentVideoUnit type.


232-240: Well documented method with clear expectations

The method documentation has been updated to accurately reflect the new type requirements. The Javadoc clearly explains the method behavior and return values.


245-252: Type check and casting handled correctly

The type check and casting for AttachmentVideoUnit have been implemented correctly, ensuring proper data flow to the Pyris database.

src/main/webapp/app/lecture/overview/course-lectures/course-lecture-details.component.html (1)

76-78: Correctly consolidated component rendering for attachment and video

The separate case statements for LectureUnitType.ATTACHMENT and LectureUnitType.VIDEO have been properly merged into a single case for LectureUnitType.ATTACHMENT_VIDEO with the appropriate component.

src/main/webapp/app/lecture/manage/lecture-units/lectureUnit.service.ts (6)

10-10: Properly updated import statement

The import statement has been correctly updated to reflect the new AttachmentVideoUnit type.


61-65: Date conversion updated for new type

The conditional logic in convertLectureUnitDatesFromClient has been properly updated to check for LectureUnitType.ATTACHMENT_VIDEO and cast to the new type.


89-92: Response date conversion properly updated

The convertLectureUnitResponseDatesFromServer method has been correctly updated to handle the new type.


106-109: Server date conversion updated consistently

The convertLectureUnitDateFromServer method has been consistently updated to handle the new type.


139-147: Name retrieval logic updated for merged type

The getLectureUnitName method has been correctly modified to access the name property via the new type.


149-157: Release date retrieval updated consistently

The getLectureUnitReleaseDate method has been properly updated to access the release date via the new type.

src/main/webapp/app/lecture/overview/course-lectures/attachment-video-unit/attachment-video-unit.component.html (2)

4-5: Improved conditional display of download button

The showViewIsolatedButton property now dynamically shows based on the presence of an attachment, which is a better user experience than the previous static true value. The button label has also been appropriately updated to reflect the new component purpose.


14-14: Translation keys updated for new component type

All translation keys have been correctly updated from artemisApp.attachmentUnit to artemisApp.attachmentVideoUnit to reflect the merged component.

Also applies to: 20-20, 26-26

src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management-resolve.service.ts (2)

7-8: LGTM: Imports updated correctly

The imports have been correctly updated to reference the new AttachmentVideoUnit model and service, aligning with the PR's objective of merging the attachment unit and video unit types.


11-12: LGTM: Class updated correctly

Class name and service injection properly updated to match the new entity type.

src/main/java/de/tum/cit/aet/artemis/iris/service/session/IrisLectureChatSessionService.java (1)

89-90: Code simplified by removing intermediate DTO

The refactoring correctly simplifies the code by directly passing the course and lecture IDs to the DTO constructor rather than creating an intermediate PyrisCourseDTO object. This aligns with the Java coding guideline of using minimal DTOs.

src/main/webapp/app/lecture/manage/lecture-units/unit-creation-card/unit-creation-card.component.html (2)

15-17: UI updated correctly to reflect new entity model

The link button for creating attachment video units has been properly implemented with the correct ID, icon, and translation key, aligning with the PR objective of merging attachment and video units.


28-30: UI updated correctly for event-based creation

The event-based button for creating attachment video units has been properly implemented with the correct event handler parameter (unitType.ATTACHMENT_VIDEO).

src/test/java/de/tum/cit/aet/artemis/lecture/LectureIntegrationTest.java (10)

33-34: LGTM: Import updated correctly

The import has been correctly updated to reference the new AttachmentVideoUnit type, removing the previous separate unit types.


81-82: LGTM: Variable names updated consistently

The variable names have been updated consistently to reflect the new entity model, with attachmentOfAttachmentVideoUnit and attachmentVideoUnit replacing their previous counterparts.

Also applies to: 89-90


119-121: LGTM: Test setup updated correctly

The test setup code has been properly updated to use the new entity creation method and variable assignments.


125-126: LGTM: Test lecture unit collection updated correctly

The lecture unit collection now correctly includes the new attachment-video unit in place of the separate entities.


256-258: LGTM: Video unit with slides test updated correctly

The test for lecture units with slides has been properly updated to use attachment-video units instead of separate attachment and video units.


264-268: LGTM: Assertions updated to reflect merged entity model

The assertions have been correctly adjusted to account for the reduced number of units (since two unit types were merged into one) and the new type casting.


271-274: LGTM: Detail assertions updated correctly

The assertions for the lecture with details view have been properly updated to reflect the new entity structure.


338-340: Test method name and logic updated consistently

The test method name and implementation have been updated to correctly reflect the new entity model, checking that attachment video units are filtered out when not released.

Also applies to: 348-349


356-357: LGTM: Assertion updated for teaching assistant access

The assertion for teaching assistant access has been correctly updated to check for attachment video units instead of separate attachment and video units.


363-364: LGTM: Competency link test updated properly

The test for competency links has been updated to properly use the new entity type.

src/test/java/de/tum/cit/aet/artemis/atlas/competency/AbstractCompetencyPrerequisiteIntegrationTest.java (7)

37-37: Updated import statement aligns with merged unit type

The import statement has been properly updated to reflect the transition from AttachmentUnit to the merged AttachmentVideoUnit type.


60-60: Field type updated consistently

The field declaration has been properly renamed from attachmentUnitOfLectureOne to attachmentVideoUnitOfLectureOne with the appropriate type.


104-105: Method reference updated correctly

The test utility method call has been updated from createAttachmentUnit to createAttachmentVideoUnit with proper name assignment.


107-109: Link creation and type casting updated

The CompetencyLectureUnitLink creation and type casting have been appropriately modified to use the new AttachmentVideoUnit type.


119-119: List elements correctly reference the new variable name

The list construction in List.of() has been updated to use the renamed attachmentVideoUnitOfLectureOne variable.


295-295: Assertion updated to check the correct unit type

The assertion for lecture unit links has been correctly updated to verify the presence of the attachmentVideoUnitOfLectureOne ID.


413-413: Repository method calls consistently use the renamed variable

All repository method calls for deleting lecture unit links have been updated to use the attachmentVideoUnitOfLectureOne ID consistently.

Also applies to: 567-567, 696-696

src/main/java/de/tum/cit/aet/artemis/lecture/domain/Slide.java (3)

20-21: Entity field updated while maintaining database schema compatibility

The field has been updated from AttachmentUnit to AttachmentVideoUnit type while keeping the existing database column name attachment_unit_id. This approach maintains database backward compatibility while introducing the new domain model.


30-32: Getter method properly updated to return new type

The getter method has been correctly updated to return the AttachmentVideoUnit type.


34-36: Setter method properly updated to accept new parameter type

The setter method has been correctly updated to accept an AttachmentVideoUnit parameter.

src/main/webapp/app/lecture/manage/lecture-units/attachment-video-units/attachment-video-units.component.html (5)

4-4: Updated translation keys for header and table elements

Translation keys have been correctly updated from attachmentUnit to attachmentVideoUnit to reflect the unit type merger.

Also applies to: 11-11, 13-13, 15-16


74-75: Button translation updated

The add row button now correctly uses the new attachmentVideoUnit translation key.


80-81: Warning message and information lines updated

The warning messages about slide removal and associated information have been updated to use the new translation keys.

Also applies to: 84-88, 96-97


105-106: Alert message translation updated

The no units detected alert message now correctly uses the new translation key.


109-112: Tooltip and method call updated

The tooltip translation key and method call have been updated from createAttachmentUnits() to createAttachmentVideoUnits() to reflect the new functionality.

src/main/java/de/tum/cit/aet/artemis/lecture/domain/Attachment.java (3)

61-62: Entity field updated while preserving database schema

The field type has been updated from AttachmentUnit to AttachmentVideoUnit while maintaining the original database column name attachment_unit_id. This approach ensures database compatibility during the type transition.


128-130: Getter method correctly updated for new type

The getter method has been properly updated to return the AttachmentVideoUnit type.


132-134: Setter method correctly updated for new parameter type

The setter method has been properly updated to accept an AttachmentVideoUnit parameter.

src/main/webapp/app/lecture/shared/entities/lecture-unit/lectureUnit.model.ts (2)

6-6: Implementation aligns with PR objectives

The update to import faDownload and the renaming of LectureUnitType from ATTACHMENT to ATTACHMENT_VIDEO properly implements the requested merge of attachment and video units.

Also applies to: 11-11


18-19: Consistent refactoring of icon mappings and tooltips

The icons and tooltips have been correctly updated to reference the consolidated ATTACHMENT_VIDEO type, maintaining application functionality while removing the redundant VIDEO type.

Also applies to: 25-25

src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureUnitImportService.java (4)

20-21: Import statement properly updated

The import statement has been correctly updated to use AttachmentVideoUnit instead of separate AttachmentUnit and VideoUnit classes, aligning with the PR objectives.


74-75: Method renamed and logic updated appropriately

The method reference has been correctly renamed from autoUpdateAttachmentUnitsInPyris to autoUpdateAttachmentVideoUnitsInPyris and the filtering logic updated to use the new AttachmentVideoUnit type.


96-113: Case statement properly refactored

The switch case implementation has been correctly updated to handle AttachmentVideoUnit instead of separate AttachmentUnit and VideoUnit cases. All necessary properties are properly set, and the attachment relationship is correctly maintained.


152-153: Path resolution updated correctly

The file path resolution has been properly updated to use getAttachmentVideoUnitFilePath() instead of getAttachmentUnitFilePath(), maintaining consistency with the other changes in the PR.

src/main/webapp/i18n/de/lectureUnit.json (5)

14-14: Localization key updated properly

The unit creation card text has been correctly updated from "attachment" to "attachmentVideo", maintaining the informal tone (dutzen) required by the German localization guidelines.


82-87: Section renamed correctly while preserving content

The section has been properly renamed from "attachmentUnit" to "attachmentVideoUnit" and "createAttachmentUnits" to "createAttachmentVideoUnits", maintaining consistent naming across the application.


129-133: Placeholder text updated properly

The placeholder text has been properly generalized from referring specifically to a file unit to referring to a unit that could contain either a file or video or both.


148-155: New video functionality properly localized

The newly added fields for video URL functionality are properly localized with appropriate German translations, maintaining the informal tone (dutzen) as required.


156-158: Edit section renamed consistently

The edit section has been properly renamed from "editAttachmentUnit" to "editAttachmentVideoUnit", maintaining naming consistency with the rest of the changes.

src/main/java/de/tum/cit/aet/artemis/lecture/service/SlideSplitterService.java (5)

29-30: Class imports and JavaDoc updated correctly

The import statement has been updated to use AttachmentVideoUnit, and the class JavaDoc has been properly updated to reflect the new terminology.

Also applies to: 34-35


54-58: Method signature and JavaDoc properly refactored

The method signature and accompanying JavaDoc have been correctly updated to use AttachmentVideoUnit instead of AttachmentUnit, maintaining code consistency.


62-63: Method calls and error logging updated consistently

The method call to splitAttachmentVideoUnitIntoSingleSlides and the error logging have been properly updated to reference the new type.

Also applies to: 65-66


73-78: JavaDoc and method implementation properly updated

The JavaDoc parameters and method implementation have been correctly updated to reflect the AttachmentVideoUnit type changes.


88-91: File paths and entity relationships correctly updated

The slide filename generation, file path resolution using FilePathService.getAttachmentVideoUnitFilePath(), and the slide entity relationship have all been properly updated to reflect the AttachmentVideoUnit type.

Also applies to: 95-96, 100-101

src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureService.java (4)

88-102: Method signature and implementation properly refactored

The method has been correctly renamed and updated to filter AttachmentVideoUnit instances instead of the former separate unit types. This aligns with the PR objective of merging attachment and video units.


154-160: Deletion logic correctly handles the new unified unit type

The code properly retrieves and filters for AttachmentVideoUnit instances before performing deletion operations in Pyris. This ensures that the integration with external services remains functional after the unit type consolidation.


182-189: Ingestion implementation correctly updated

The logic for ingesting lectures in Pyris has been properly updated to work with the new AttachmentVideoUnit type. The stream filtering and mapping operations correctly handle the type conversion.


199-202: Transcription ingestion signature updated correctly

The method signature now accepts an AttachmentVideoUnit parameter instead of the previous video unit type, consistent with the PR's objective of unifying attachment and video units.

src/main/java/de/tum/cit/aet/artemis/lecture/domain/AttachmentVideoUnit.java (3)

20-28: Well structured class for the unified attachment and video capabilities

The class name and structure correctly reflect the merged functionality, and the addition of the videoSource field enables the unified unit to handle video content. This implementation aligns well with the PR objective of allowing a single unit to contain both attachments and video sources.


29-35: Relationship mappings correctly updated

The one-to-one and one-to-many relationships have been properly updated to reference attachmentVideoUnit in their mappings, ensuring that the related entities (Attachment and Slides) maintain proper bidirectional relationships.


55-61: Video source accessor methods implemented correctly

These new getter and setter methods provide appropriate access to the video source field, enabling the unit to function with video content as outlined in the PR objectives.

src/test/java/de/tum/cit/aet/artemis/iris/PyrisLectureIngestionTest.java (4)

85-89: Test setup correctly updated for AttachmentVideoUnit

The initialization code properly uses the new unit type with the updated utility methods. The test maintains its original purpose while using the new unified unit type.


94-108: Test method name and implementation aligned with new unit type

The test case name and implementation have been properly updated to reference the new unit type. This test verifies that the auto-ingestion functionality works correctly with the unified unit.


152-156: Type casting in deletion test correctly updated

The test properly casts to the new unit type when checking the Pyris deletion functionality. All references to the former unit types have been consistently replaced.


176-183: Instance check and type casting properly updated in status test

The test correctly uses instanceof check and casting to work with the new unit type, ensuring tests continue to function as expected after the unit type consolidation.

src/main/webapp/app/lecture/manage/lecture-units/attachment-video-units/attachment-video-units.component.ts (5)

1-7: Import statement properly updated

The component correctly imports the new AttachmentVideoUnitService to work with the unified unit type.


34-43: Component metadata and class name updated for consistency

The component selector, template path, and class name have all been properly updated to reflect the new unit type. This ensures consistent naming throughout the application.


67-68: Comment accurately references the backend resource

The comment has been updated to reference the correct resource class name, maintaining accuracy and consistency.


159-178: Creation method updated with proper naming

The method for creating units has been properly renamed while maintaining the same functionality, ensuring consistency with the new unit type terminology.


220-271: Validation method translation keys properly updated

All translation keys in the validation method have been consistently updated to reference the new unit type, ensuring error messages are clear and consistent.

src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureUnitProcessingService.java (5)

36-36: Appropriate import update for entity refactoring.

The import change correctly reflects the transition from AttachmentUnit to the new combined AttachmentVideoUnit type, aligning with the PR's objective to merge attachment and video units.


54-54: Service dependency properly updated to match refactoring.

The service dependency has been consistently updated from AttachmentUnitService to AttachmentVideoUnitService in both the field declaration and constructor injection, following proper constructor injection pattern per coding guidelines.

Also applies to: 62-62, 66-66


77-80: Return type and variable type correctly updated.

The method signature and internal variable type have been properly updated to reflect the transition to AttachmentVideoUnit, maintaining type consistency throughout the method.


86-86: Entity instantiation and comments accurately reflect the new type.

The instantiation has been correctly updated to use AttachmentVideoUnit instead of AttachmentUnit, and the surrounding comments have been updated to match the new naming convention.

Also applies to: 103-104


111-115: Service method calls properly updated.

Method calls have been updated to use the new AttachmentVideoUnitService methods and variable naming follows the new convention consistently.

src/main/webapp/app/lecture/manage/lecture-units/lecture-units.component.html (1)

38-46: Component updates correctly reflect new entity type.

The refactoring from AttachmentUnit to AttachmentVideoUnit has been consistently applied to:

  1. The condition check (isAttachmentVideoUnitFormOpen)
  2. The component tag (jhi-attachment-video-unit-form)
  3. The event handler (createEditAttachmentVideoUnit)
  4. The form data binding (attachmentVideoUnitFormData)

This follows the Angular styleguide and correctly maintains the component's functionality with the new entity type.

src/main/webapp/app/lecture/manage/pdf-preview/pdf-preview.component.ts (3)

5-6: Imports, fields, and service dependencies properly updated.

The component has been correctly updated to use AttachmentVideoUnit and AttachmentVideoUnitService in imports, field declarations, and service injection.

Also applies to: 36-36, 41-41, 55-55


83-90: Attachment handling logic properly updated.

The component correctly updates its data handling to use the new attachmentVideoUnit signal and subscription when loading attachment files.


97-98: Clean resource management properly updated.

The component correctly unsubscribes from the renamed subscription to prevent memory leaks, following Angular best practices.

src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management.component.ts (8)

13-13: Imports appropriately updated.

The imports have been correctly updated to reference the new AttachmentVideoUnit type and the corresponding component.

Also applies to: 22-22


102-103: Router links updated for the new unit type.

The routerEditLinksBase mapping has been correctly updated to include the new unit type route.


205-206: Dialog messages updated for consistency.

The delete question and confirmation text keys have been correctly updated to reference the new unit type.

Also applies to: 220-221


251-254: View button availability logic updated.

The method now correctly checks for the PDF attachment in the AttachmentVideoUnit type.


262-262: Edit button availability updated.

The edit button availability check now correctly includes the new unit type.


286-287: Version retrieval properly updated.

The method now correctly retrieves the attachment version from the AttachmentVideoUnit type.


293-295: Helper method added for attachment checking.

The new hasAttachment method is a clean addition that improves code readability when checking if an AttachmentVideoUnit has an associated attachment.


343-357: Method signature improved for type safety.

The getIcon method now explicitly accepts an AttachmentVideoUnit parameter instead of a generic type, improving type safety and making the code more maintainable.

src/main/java/de/tum/cit/aet/artemis/lecture/service/AttachmentVideoUnitService.java (4)

32-34: Appropriate usage of @Profile and @service

Annotations @Profile(PROFILE_CORE) and @service are properly applied, aligning with Spring best practices.


36-63: Constructor injection follows recommended guidelines

All dependencies are injected through the constructor, satisfying inversion of control principles. No issues found.


85-92: Ensure resilience for file upload errors

If the file upload fails in createAttachment, no exception is caught or transformed. Consider adding error handling or rollback logic to maintain data integrity.


219-229: Efficient trimming of Lecture data before sending to the client

Nullifying references (e.g., lecture units, attachments, posts) effectively reduces potential payload size and prevents exposing unnecessary data. Good approach.

src/main/java/de/tum/cit/aet/artemis/core/service/FilePathService.java (4)

66-68: New path method aligns with feature rename

getAttachmentVideoUnitFilePath() appropriately reflects the new "attachment-video" unit. No issues found.


138-138: Redirect to specialized resolver

Forwarding to actualPathForPublicAttachmentVideoUnitFilePath ensures consistent handling of attachment video unit paths.


236-238: Consistent mapping to public path method

Using publicPathForActualAttachmentVideoUnitFilePath for the appropriate path prefix is consistent with the overall refactor.


246-260: Slide path logic and ID parsing

The code gracefully parses the attachment video unit ID and slide ID from the path, throwing a FilePathParsingException on failure. The approach is sound, but consider verifying path structure early if user input can be malformed.

src/main/java/de/tum/cit/aet/artemis/lecture/repository/AttachmentVideoUnitRepository.java (3)

18-25: Repository rename to AttachmentVideoUnit reflects new domain entity

Updating the repository name and domain import to AttachmentVideoUnit aligns with the refactoring effort.


33-38: Filtering by AttachmentVideoUnit subtype

Using AND TYPE (lectureUnit) = AttachmentVideoUnit ensures only AttachmentVideoUnit entities are fetched. The default method findAllByLectureIdAndAttachmentTypeElseThrow is clear in purpose, throwing an exception on empty results.

Also applies to: 41-56


59-66: Fetching slides and competencies in a single query

The query joins slides and competency links, preventing N+1 queries. The findWithSlidesAndCompetenciesByIdElseThrow method is straightforward and properly raises an exception if not found.

Also applies to: 68-70

src/main/webapp/i18n/en/lectureUnit.json (2)

14-14: The localization key change reflects the merged unit functionality.

The key has been updated from "attachment" to "attachmentVideo" which correctly indicates that this unit type now handles both file attachments and videos.


82-170: Comprehensive localization updates for the merged attachment-video functionality.

The translation keys have been properly renamed from "attachmentUnit" to "attachmentVideoUnit" and new keys have been added for video-specific functionality (lines 148-154). This ensures the UI will correctly represent the new combined functionality.

src/main/webapp/app/lecture/overview/course-lectures/attachment-video-unit/attachment-video-unit.component.ts (3)

56-67: Good implementation of the video URL validation.

The computed property correctly checks if the video source exists and validates it against the whitelist or parses it using the video URL parser. This ensures only valid video sources are accepted.


82-88: Well-implemented helper methods for checking attachment and video presence.

These methods improve code readability by encapsulating the null/undefined checks in descriptive method names.


93-97: Good adaptation of the icon logic for video sources.

The method now correctly returns the video icon when a video source is present, maintaining the existing file type icon logic for attachments.

src/main/webapp/app/lecture/manage/lecture-units/edit-attachment-video-unit/edit-attachment-video-unit.component.ts (4)

5-9: Properly updated imports for the renamed components and services.

The imports have been updated to reflect the new naming convention of "AttachmentVideoUnit" instead of "AttachmentUnit".


26-31: Correctly updated form references and model types.

The @ViewChild reference and property types have been updated for consistency with the renamed components.


51-66: Form data structure properly updated to include video source.

The response handling now correctly sets up the form data, including the new videoSource property from the attachment video unit.


76-97: Updated update method with proper handling of video source.

The updateAttachmentVideoUnit method now correctly extracts and sets the videoSource property from the form data.

src/main/webapp/app/lecture/manage/lecture-units/lecture-units.component.ts (2)

196-205: Good implementation of video source handling.

The code correctly sets the video source property on the attachment video unit when provided. This properly implements the feature of attaching videos to lecture units.


268-282: Correctly prepares form data for editing attachment video units.

The switch case for LectureUnitType.ATTACHMENT_VIDEO now properly includes the video source in the form data structure.

src/main/java/de/tum/cit/aet/artemis/iris/api/IrisLectureApi.java (6)

12-12: Import updated for new entity type.

The import statement is correctly updated to use the new AttachmentVideoUnit type, which is part of the migration from separate attachment and video units to a unified type.


29-33: Documentation updated to reflect API changes.

The JavaDoc has been properly updated to reflect the new parameter type, ensuring that the documentation stays in sync with the implementation changes.


35-37: Method signature and implementation updated correctly.

The method signature and implementation have been updated to use the new AttachmentVideoUnit type, maintaining the same functionality while adapting to the unified type system.


44-48: Parameter type updated in method signature and implementation.

The parameter type has been correctly changed from a list of AttachmentUnit to a list of AttachmentVideoUnit entities, with the corresponding method call updated.


53-60: Method and documentation updated to reflect new naming convention.

Both the JavaDoc reference and method signature have been properly updated to use the new entity type and consistent naming convention throughout.


65-76: Transcriptions method updated to new entity model.

The method for adding transcriptions to the Pyris DB has been correctly updated to use AttachmentVideoUnit instead of separate video units, with documentation properly reflecting these changes.

src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit.service.ts (12)

2-2: Model import updated to use new entity type.

The import has been correctly updated to use the new AttachmentVideoUnit model, which aligns with the backend changes.


7-7: Updated import path for DTO.

The import path has been updated to reflect the new component structure, ensuring proper type definitions throughout the service.


9-9: Response type updated to match new entity.

The EntityResponseType definition has been updated to use the AttachmentVideoUnit type, maintaining type safety across HTTP responses.


14-14: Service class name updated for clarity.

The service class name has been updated from AttachmentUnitService to AttachmentVideoUnitService to accurately reflect its purpose after the entity merge.


20-24: Updated method parameter name and API endpoint.

The findById method has been updated with the new parameter name and API endpoint path, maintaining consistent naming throughout the codebase.


31-36: Create method API endpoint updated.

The create method's API endpoint has been updated to use the new resource path, aligning with the backend changes.


38-50: Update method signature and endpoint adjusted.

The update method has been properly updated with the new parameter name and API endpoint path, ensuring consistent interaction with the backend.


53-54: Updated endpoint for getting split units data.

The API endpoint in the getSplitUnitsData method has been updated to use the new resource path.


57-58: Updated endpoint for creating units.

The API endpoint in the createUnits method has been updated to use the new resource path.


63-64: Updated endpoint for uploading slides.

The API endpoint in the uploadSlidesForProcessing method has been updated to use the new resource path.


68-69: Updated endpoint for getting slides to remove.

The API endpoint in the getSlidesToRemove method has been updated to use the new resource path.


75-80: Updated parameter name and endpoint for file retrieval.

Both the parameter name and API endpoint in the getAttachmentFile method have been updated to align with the new entity type.

src/test/java/de/tum/cit/aet/artemis/core/FileIntegrationTest.java (9)

47-47: Updated imports for new entity types.

The imports have been correctly updated to use the new AttachmentVideoUnit and its repository, which is necessary for the test modifications.

Also applies to: 53-53


66-66: Repository reference updated to new type.

The repository field has been updated to use the AttachmentVideoUnitTestRepository, aligning with the entity changes.


130-144: Test method updated to use new entity type.

The test method has been renamed and updated to create and use an AttachmentVideoUnit instead of an AttachmentUnit, correctly reflecting the entity changes while maintaining test coverage.


232-236: Stream mapping updated for new entity type.

The stream operation has been updated to correctly cast LectureUnit to AttachmentVideoUnit instead of the previous type, ensuring proper type handling.


293-294: Method calls updated to use new upload method.

The calls to the upload method have been updated to use uploadAttachmentVideoUnit instead of the previous method, ensuring test consistency.

Also applies to: 298-299, 309-310


313-314: Repository query updated for new entity type.

The repository query now correctly uses attachmentVideoUnitRepo to find entities by lecture ID and attachment type.


319-328: Upload method updated for new entity type.

The upload method has been renamed and updated to work with AttachmentVideoUnit instead of AttachmentUnit, including proper initialization and API endpoint changes.


350-365: Test method for file access updated.

The test method has been renamed and updated to create, save, and retrieve an AttachmentVideoUnit instead of an AttachmentUnit, with the corresponding API endpoint changes.


369-390: Filename sanitization test updated.

The test method for filename sanitization has been updated to work with AttachmentVideoUnit, ensuring that this functionality continues to work with the new entity type.

src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management.route.ts (5)

5-5: Updated resolver import.

The import has been correctly updated to use the AttachmentVideoUnitResolve resolver, which is necessary for the route configuration changes.


33-39: Process route path and component updated.

The route path, component import, and page title for processing attachments have been updated to reflect the new entity type, maintaining route functionality.


42-50: Create route path and component updated.

The route path, component import, and page title for creating new attachments have been updated to align with the merged entity type.


69-76: Edit route path and component updated.

The route path, component import, and page title for editing attachments have been updated to use the new entity type and naming conventions.


78-83: View route path and resolver updated.

The route path and resolver property for viewing attachments have been updated to use the new entity type, ensuring proper data resolution during navigation.

src/main/webapp/app/lecture/manage/lecture-units/create-attachment-video-unit/create-attachment-video-unit.component.ts (7)

5-10: Import statements properly updated for new AttachmentVideoUnit model.

The imports have been correctly updated to reference the new AttachmentVideoUnit model and related services, which aligns with the PR objective to unify attachment and video units.


16-20: Component metadata properly updated.

The component selector, template URL, and imports have been correctly updated to reflect the new attachment video unit naming convention, following Angular style guidelines.


26-28: ViewChild and property declarations properly updated.

The references have been updated to use AttachmentVideoUnitFormComponent and initialize an AttachmentVideoUnit instance, maintaining proper Angular patterns.


45-51: Updated validation logic correctly accounts for both attachment and video scenarios.

The validation logic now properly handles the case where either a file attachment or a video source is required (along with a name), which accommodates the new combined unit type functionality.


60-65: AttachmentVideoUnit property initialization properly handles video source.

The new combined unit now correctly sets both the file attachment properties and the video source property, with a proper default for competencyLinks to avoid null references.


71-75: Form data preparation correctly handles conditional attachment inclusion.

The code now intelligently appends the file and attachment data only when a file is provided, while always including the attachmentVideoUnit data. This supports the PR's goal of allowing units with just video sources.


77-89: Service call and error handling properly updated.

The service reference has been updated to use attachmentVideoUnitService, maintaining consistent error handling while adapting to the new unit type.

src/main/webapp/app/shared/monaco-editor/model/actions/communication/lecture-attachment-reference.action.ts (6)

6-6: Import and interface updates correctly handle the new AttachmentVideoUnit type.

The import statement and related interfaces (LectureWithDetails and LectureAttachmentReferenceActionArgs) have been properly updated to use the new AttachmentVideoUnit type.

Also applies to: 19-19, 26-26


64-64: Filtering logic updated to use correct lecture unit type.

The code now correctly filters lecture units using the LectureUnitType.ATTACHMENT_VIDEO constant, aligning with the new merged unit type structure.


103-107: Reference type handling updated for attachment video units.

The conditional block now correctly checks for args.attachmentVideoUnit and calls the appropriate insertion method, maintaining the same error handling approach.


110-114: Slide reference handling updated to use AttachmentVideoUnit.

The conditional block for handling slide references now correctly expects an attachmentVideoUnit parameter instead of an attachmentUnit.


139-147: insertSlideReference method signature and implementation updated.

The method now correctly takes an attachmentVideoUnit parameter and uses its name in the formatted string for slide references.


149-152: AttachmentVideoUnit reference insertion method properly implemented.

The renamed method correctly inserts a reference to an attachment video unit using the appropriate formatting and sanitization.

src/test/java/de/tum/cit/aet/artemis/lecture/AttachmentVideoUnitsIntegrationTest.java (6)

32-42: Import statements and class declaration properly updated.

The import statements and class declaration have been updated to reference AttachmentVideoUnit instead of AttachmentUnit, maintaining consistent naming.


47-47: Repository field declaration updated.

The repository field has been updated to reference AttachmentVideoUnitTestRepository, which aligns with the new entity type.


103-109: API endpoints updated in test methods.

The API endpoints have been correctly updated from /attachment-units/ to /attachment-video-units/, ensuring tests match the new backend API structure.


171-176: Test method renamed to reflect new entity type.

The test method has been renamed from getAttachmentUnitsData_asInstructor_shouldGetUnitsInformationVideo to getAttachmentVideoUnitsData_asInstructor_shouldGetUnitsInformationVideo, maintaining consistent naming.


249-260: Unit creation test properly updated for AttachmentVideoUnit.

The test method for creating attachment units now correctly references AttachmentVideoUnit throughout, including in the API call, response handling, and repository verification.


287-289: Slide removal test uses proper AttachmentVideoUnit references.

The link references in the attachment path retrieval now correctly use the new entity structure with AttachmentVideoUnit.

Also applies to: 295-296

src/test/java/de/tum/cit/aet/artemis/lecture/AttachmentVideoUnitIntegrationTest.java (8)

44-56: Import statements and class declaration properly updated.

The import statements and class declaration have been updated to reference AttachmentVideoUnit instead of AttachmentUnit, following JUnit 5 conventions for test naming.


66-66: Repository field and field declarations updated.

The repository field and instance variables have been updated to reference AttachmentVideoUnit, ensuring consistent entity references throughout the test class.

Also applies to: 84-84, 98-99


110-111: HTTP request builder methods updated for new entity type.

The methods for building HTTP requests now correctly reference AttachmentVideoUnit and use the updated API endpoints (/attachment-video-units/).

Also applies to: 115-140


156-156: Helper method renamed to match new entity type.

The helper method has been renamed from createAttachmentUnitPdf to createAttachmentVideoUnitPdf, maintaining consistent naming across the test class.


208-218: Test method properly updated for AttachmentVideoUnit.

The test method for updating lecture attachment units now correctly references AttachmentVideoUnit throughout, including variable declarations, method calls, and result validation.


224-237: Unit creation test properly validates competency links.

The test method correctly verifies that competency links are preserved in the created AttachmentVideoUnit and that the progress API is properly called for the new entity type.


307-314: Helper method updated to persist AttachmentVideoUnit.

The method for persisting attachment units with a lecture now correctly uses the AttachmentVideoUnit repository and casting, maintaining proper entity relationships.


354-364: Delete test correctly handles AttachmentVideoUnit resources.

The test for deleting attachment units now properly references AttachmentVideoUnit throughout and verifies the correct competency progress API call.

src/main/java/de/tum/cit/aet/artemis/core/web/FileResource.java (9)

77-77: Import reflects the domain model transition.

The import change from AttachmentUnit to AttachmentVideoUnit aligns with the PR objective of merging attachment and video units into a single entity.


81-81: Repository dependency updated for new domain model.

The repository change from AttachmentUnitRepository to AttachmentVideoUnitRepository correctly aligns with the domain model changes.


112-112: Repository field type updated for new entity.

The field type change from attachmentUnitRepository to attachmentVideoUnitRepository maintains proper dependency handling.


146-146: Field assignment for new repository.

The field assignment correctly sets the repository dependency.


484-486: Repository method usage properly updated.

The code correctly uses the new repository to find attachment-video units with specific lecture ID and attachment type.


500-512: API endpoint renamed and updated correctly.

The endpoint, method signature, documentation, and implementation have been properly updated to reflect the new entity type. This maintains consistent API naming conventions.


522-540: File endpoint renamed and updated correctly.

The endpoint path, method name, and implementation have been updated to use the new entity type, maintaining consistent API design.


537-538: Validation method name updated.

The validation method name has been updated from checkAttachmentUnitExistsInCourseOrThrow to checkAttachmentVideoUnitExistsInCourseOrThrow for consistency.


562-595: Slide endpoint renamed and logic updated.

The endpoint, method name, and implementation have been updated to use the new entity type for slide retrieval. The FilePathService usage is also updated to reference the correct path.

src/main/webapp/app/lecture/manage/lecture-units/attachment-video-unit-form/attachment-video-unit-form.component.ts (13)

1-5: Added imports for video URL handling.

New imports (especially line 4 - js-video-url-parser) are added to support video URL parsing and validation, which is essential for the merged attachment-video unit functionality.


17-20: Interface renamed for clarity.

The interface has been renamed from AttachmentUnitFormData to AttachmentVideoUnitFormData to reflect the merged entity type.


29-31: Added video source properties.

New properties for videoSource and urlHelper are added to support video functionality in the merged unit type.


40-47: Well-structured utility functions for URL validation.

The utility functions isTumLiveUrl and isVideoOnlyTumUrl are well-designed to encapsulate specific URL validation logic, making the code more maintainable.


49-66: Comprehensive URL transformation validator.

The videoSourceTransformUrlValidator function properly handles various edge cases and provides appropriate validation for video URLs that can be transformed.


68-83: Implemented video source URL validator.

The videoSourceUrlValidator function properly validates the final video source URL format.


85-90: Component name and selector updated.

The component name and selector have been updated to reflect the new entity type.


117-121: Added video source signal and validator references.

The component correctly adds a signal for video source state management and references to the validator functions.


128-130: Form controls added for video source.

Form controls for videoSource and urlHelper are properly added with appropriate validators.


135-137: Form validation updated for video source.

The isFormValid computed property now correctly checks for either a file or video source to be present, ensuring that form validation works for both attachment and video scenarios.


182-188: Added accessor methods for video form controls.

Proper getter methods are added for accessing the video-related form controls.


216-222: Utility method to check transformable URLs.

The isTransformable getter properly checks if a URL can be transformed into an embedded video URL.


224-241: Video URL transformation methods added.

Methods for setting and extracting embedded video URLs have been properly implemented, supporting both TUM-Live URLs and other video platforms through the URL parser.

src/main/java/de/tum/cit/aet/artemis/lecture/web/AttachmentVideoUnitResource.java (14)

42-44: Updated imports for merged entity type.

Imports correctly reflect the domain model change from separate attachment and video units to a merged AttachmentVideoUnit.


46-48: Updated repository and service imports.

Repository and service imports correctly updated to match the new entity type.


55-69: Class renamed and field types updated.

The class name and field types have been updated to reflect the merged entity type, maintaining consistency throughout the controller.


79-92: Constructor updated for new dependencies.

The constructor properly initializes the new repository and service dependencies.


101-110: GET endpoint updated for merged entity.

The endpoint, method signature, and implementation have been properly updated to use the new entity type.


124-147: PUT endpoint updated for merged entity.

The endpoint, method signature, and implementation have been properly updated to use the new entity type.


160-193: POST endpoint updated for merged entity.

The endpoint, method signature, and implementation have been properly updated to use the new entity type.


174-176: Added validation for attachment or video source.

Important validation added to ensure an attachment video unit has either an attachment or a video source, which aligns with the PR objective of supporting both types in a single unit.


184-190: Service methods updated for merged entity.

Service method calls properly updated to use the new entity type and handle both attachment and video aspects.


202-221: Upload endpoint updated for merged entity.

The endpoint, method signature, and implementation have been properly updated to reference the new entity type in documentation and logging.


231-255: Split endpoint updated for merged entity.

The endpoint, method signature, and implementation have been properly updated to use the new entity type.


265-283: Data endpoint updated for merged entity.

The endpoint, method signature, and implementation have been properly updated to use the new entity type.


293-310: Slides-to-remove endpoint updated for merged entity.

The endpoint documentation has been properly updated to reference the new entity type.


318-325: Validation method updated for merged entity.

The validation method has been properly renamed and updated to check the lecture association for the new entity type.

src/main/java/de/tum/cit/aet/artemis/iris/service/pyris/PyrisWebhookService.java (14)

43-43: LGTM! Import changes align with PR objectives.

The import of AttachmentVideoUnit is appropriate and directly supports the PR goal of transitioning to a unified attachment-video unit model.


90-90: Method signature correctly updated for the new unified model.

The parameter type change from what was likely VideoUnit to AttachmentVideoUnit aligns with the PR objectives of merging the two unit types.


108-108: API usage updated to match new class structure.

The method call now correctly uses getVideoSource() instead of the previous method (likely getSource()), maintaining consistency with the new unified model.


138-140: Type check and error message appropriately updated.

The instance check and error message have been updated to use AttachmentVideoUnit, which is consistent with the PR's goal of merging unit types.


142-142: Cast operation properly updated for the new model.

The code now correctly casts to AttachmentVideoUnit to access the getVideoSource() method.


166-168: Method signature correctly updated with proper path resolution.

The attachmentToBase64 method now accepts AttachmentVideoUnit and properly accesses the attachment link.


177-188: Method correctly adapted for the new unified model.

The processAttachmentForUpdate method has been properly updated to work with AttachmentVideoUnit. All field accesses are appropriately updated.


191-195: Method properly updated for the new unified model.

The processAttachmentForDeletion method now correctly accepts AttachmentVideoUnit parameter.


204-210: Method name and signature properly refactored.

The method has been renamed from what was likely autoUpdateAttachmentUnitsInPyris to autoUpdateAttachmentVideoUnitsInPyris with parameter type updated to match, maintaining consistency throughout the codebase.


220-228: Method signature and implementation properly updated.

The deleteLectureFromPyrisDB method signature now accepts List<AttachmentVideoUnit> and the internal logic has been updated accordingly.


238-244: Parameter type and error logging updated correctly.

The method properly uses the new AttachmentVideoUnit type, and the error logging message correctly references "Attachment" rather than the previous entity type.


254-258: Method parameters and documentation consistently updated.

The method parameters and documentation correctly refer to toUpdateAttachmentVideoUnits following the merged entity model.


268-273: Method signature and implementation consistently updated.

The executeLectureAdditionWebhook method and its documentation now consistently reference AttachmentVideoUnit instead of the previous entity types.


329-330: Filter condition properly updated for new entity model.

The stream filter now correctly checks for instances of AttachmentVideoUnit, maintaining consistency with the PR objectives.

Comment on lines 14 to 23
resolve(route: ActivatedRouteSnapshot): Observable<AttachmentVideoUnit> {
const lectureId = route.params['lectureId'];
const attachmentUnitId = route.params['attachmentUnitId'];
if (attachmentUnitId) {
return this.attachmentUnitService.findById(attachmentUnitId, lectureId).pipe(
filter((response: HttpResponse<AttachmentUnit>) => response.ok),
map((attachmentUnit: HttpResponse<AttachmentUnit>) => attachmentUnit.body!),
const attachmentVideoUnitId = route.params['attachmentUnitId'];
if (attachmentVideoUnitId) {
return this.attachmentVideoUnitService.findById(attachmentVideoUnitId, lectureId).pipe(
filter((response: HttpResponse<AttachmentVideoUnit>) => response.ok),
map((attachmentVideoUnit: HttpResponse<AttachmentVideoUnit>) => attachmentVideoUnit.body!),
);
}
return of(new AttachmentUnit());
return of(new AttachmentVideoUnit());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Parameter naming inconsistency needs attention

The parameter is extracted as attachmentVideoUnitId but the route parameter is still named 'attachmentUnitId'. This inconsistency should be fixed to maintain clarity and prevent future bugs.

-const attachmentVideoUnitId = route.params['attachmentUnitId'];
+const attachmentVideoUnitId = route.params['attachmentVideoUnitId'];

Let's check if the route parameter has been updated in the routing configuration:


🏁 Script executed:

#!/bin/bash
# Check if the routing configuration has been updated
rg -A 1 "attachmentUnitId|attachmentVideoUnitId" --type ts

Length of output: 5845


Rename route parameter to attachmentVideoUnitId for consistency

In src/main/webapp/app/lecture/manage/lecture-units/lecture-unit-management-resolve.service.ts the resolver currently extracts the route parameter as attachmentUnitId even though the routing configuration and other parts of the application (e.g., in lecture-unit-management.route.ts and edit-attachment-video-unit.component.ts) use attachmentVideoUnitId. This inconsistency can lead to errors during parameter passing. Please update the code as follows:

-const attachmentVideoUnitId = route.params['attachmentUnitId'];
+const attachmentVideoUnitId = route.params['attachmentVideoUnitId'];

This change ensures uniformity across the codebase and guards against future bugs.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
resolve(route: ActivatedRouteSnapshot): Observable<AttachmentVideoUnit> {
const lectureId = route.params['lectureId'];
const attachmentUnitId = route.params['attachmentUnitId'];
if (attachmentUnitId) {
return this.attachmentUnitService.findById(attachmentUnitId, lectureId).pipe(
filter((response: HttpResponse<AttachmentUnit>) => response.ok),
map((attachmentUnit: HttpResponse<AttachmentUnit>) => attachmentUnit.body!),
const attachmentVideoUnitId = route.params['attachmentUnitId'];
if (attachmentVideoUnitId) {
return this.attachmentVideoUnitService.findById(attachmentVideoUnitId, lectureId).pipe(
filter((response: HttpResponse<AttachmentVideoUnit>) => response.ok),
map((attachmentVideoUnit: HttpResponse<AttachmentVideoUnit>) => attachmentVideoUnit.body!),
);
}
return of(new AttachmentUnit());
return of(new AttachmentVideoUnit());
resolve(route: ActivatedRouteSnapshot): Observable<AttachmentVideoUnit> {
const lectureId = route.params['lectureId'];
- const attachmentVideoUnitId = route.params['attachmentUnitId'];
+ const attachmentVideoUnitId = route.params['attachmentVideoUnitId'];
if (attachmentVideoUnitId) {
return this.attachmentVideoUnitService.findById(attachmentVideoUnitId, lectureId).pipe(
filter((response: HttpResponse<AttachmentVideoUnit>) => response.ok),
map((attachmentVideoUnit: HttpResponse<AttachmentVideoUnit>) => attachmentVideoUnit.body!),
);
}
return of(new AttachmentVideoUnit());
}

Comment on lines +198 to +205
private void handleFile(MultipartFile file, Attachment attachment, boolean keepFilename, Long attachmentVideoUnitId) {
if (file != null && !file.isEmpty()) {
Path basePath = FilePathService.getAttachmentVideoUnitFilePath().resolve(attachmentVideoUnitId.toString());
Path savePath = fileService.saveFile(file, basePath, keepFilename);
attachment.setLink(FilePathService.publicPathForActualPathOrThrow(savePath, attachmentVideoUnitId).toString());
attachment.setUploadDate(ZonedDateTime.now());
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

File type validation for security

Currently, only emptiness is checked (line 199). Consider validating the file type to mitigate potential security risks or malicious uploads.

Comment on lines +163 to 166
createEditAttachmentVideoUnit(attachmentVideoUnitFormData: AttachmentVideoUnitFormData): void {
if (!attachmentVideoUnitFormData?.formProperties?.name || !attachmentVideoUnitFormData?.fileProperties?.file || !attachmentVideoUnitFormData?.fileProperties?.fileName) {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Validation may be too restrictive for video-only units.

The current validation requires a file and filename, which doesn't align with the PR objective of allowing units with "either an attachment, a video source, or both". Consider updating the validation to allow units with only a video source.

-        if (!attachmentVideoUnitFormData?.formProperties?.name || !attachmentVideoUnitFormData?.fileProperties?.file || !attachmentVideoUnitFormData?.fileProperties?.fileName) {
+        const { name, videoSource } = attachmentVideoUnitFormData?.formProperties || {};
+        const { file, fileName } = attachmentVideoUnitFormData?.fileProperties || {};
+        
+        if (!name || (!(file && fileName) && !videoSource)) {
             return;
         }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
createEditAttachmentVideoUnit(attachmentVideoUnitFormData: AttachmentVideoUnitFormData): void {
if (!attachmentVideoUnitFormData?.formProperties?.name || !attachmentVideoUnitFormData?.fileProperties?.file || !attachmentVideoUnitFormData?.fileProperties?.fileName) {
return;
}
createEditAttachmentVideoUnit(attachmentVideoUnitFormData: AttachmentVideoUnitFormData): void {
const { name, videoSource } = attachmentVideoUnitFormData?.formProperties || {};
const { file, fileName } = attachmentVideoUnitFormData?.fileProperties || {};
if (!name || (!(file && fileName) && !videoSource)) {
return;
}

@github-project-automation github-project-automation bot moved this from Work In Progress to Ready For Review in Artemis Development Apr 7, 2025
Copy link

github-actions bot commented Apr 7, 2025

End-to-End (E2E) Test Results Summary

TestsPassed ✅Skipped ⚠️FailedTime ⏱
End-to-End (E2E) Test Report201 ran198 passed3 skipped0 failed46m 43s 408ms
TestResultTime ⏱
No test annotations available

Copy link

There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions.

@github-actions github-actions bot added the stale label Apr 15, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🔭 Outside diff range comments (1)
src/main/java/de/tum/cit/aet/artemis/lecture/service/SlideSplitterService.java (1)

152-158: 🛠️ Refactor suggestion

Update method Javadoc comments to match the parameter name.

The Javadoc parameter name attachmentUnit doesn't match the actual parameter name attachmentVideoUnit in the method signature, which could confuse developers.

/**
 * Splits an Attachment Unit file into single slides and saves them as PNG files or updates existing slides.
 *
-* @param attachmentUnit The attachment unit to which the slides belong.
+* @param attachmentVideoUnit The attachment video unit to which the slides belong.
 * @param document       The PDF document that is already loaded.
 * @param pdfFilename    The name of the PDF file.
 * @param hiddenPages    The hidden pages information.
 * @param pageOrder      The order of pages in the PDF.
 */
♻️ Duplicate comments (1)
src/main/java/de/tum/cit/aet/artemis/lecture/service/AttachmentVideoUnitService.java (1)

191-198: 🛠️ Refactor suggestion

File type validation for security

Currently, only emptiness is checked (line 192). Consider validating the file type to mitigate potential security risks or malicious uploads.

private void handleFile(MultipartFile file, Attachment attachment, boolean keepFilename, Long attachmentVideoUnitId) {
    if (file != null && !file.isEmpty()) {
+        // Validate file type for security
+        String contentType = file.getContentType();
+        if (contentType == null || !contentType.matches("^(application/pdf|image/.*|video/.*|application/vnd.openxmlformats-officedocument.*)$")) {
+            throw new IllegalArgumentException("Unsupported file type. Only PDF, image, video, and Office documents are allowed.");
+        }
        Path basePath = FilePathService.getAttachmentVideoUnitFilePath().resolve(attachmentVideoUnitId.toString());
        Path savePath = fileService.saveFile(file, basePath, keepFilename);
        attachment.setLink(FilePathService.publicPathForActualPathOrThrow(savePath, attachmentVideoUnitId).toString());
        attachment.setUploadDate(ZonedDateTime.now());
    }
}
🧹 Nitpick comments (4)
src/main/java/de/tum/cit/aet/artemis/lecture/service/SlideSplitterService.java (4)

86-87: Update log messages for consistency.

Log messages still refer to "Attachment Unit" instead of "AttachmentVideoUnit", which could lead to confusion.

-            log.error("Error while splitting Attachment Unit {} into single slides", attachmentVideoUnit.getId(), e);
-            throw new InternalServerErrorException("Could not split Attachment Unit into single slides: " + e.getMessage());
+            log.error("Error while splitting AttachmentVideoUnit {} into single slides", attachmentVideoUnit.getId(), e);
+            throw new InternalServerErrorException("Could not split AttachmentVideoUnit into single slides: " + e.getMessage());

Also applies to: 107-108, 144-145, 183-184


121-121: Update log messages for consistency.

Log messages still refer to "Attachment Unit" instead of "AttachmentVideoUnit", which could lead to confusion.

-        log.debug("Splitting Attachment Unit file {} into single slides", attachmentVideoUnit.getAttachment().getName());
+        log.debug("Splitting AttachmentVideoUnit file {} into single slides", attachmentVideoUnit.getAttachment().getName());

-        log.debug("Processing slides for Attachment Unit with hidden pages {}", attachmentVideoUnit.getAttachment().getName());
+        log.debug("Processing slides for AttachmentVideoUnit with hidden pages {}", attachmentVideoUnit.getAttachment().getName());

Also applies to: 159-159


60-71: Consider cleaning up TODO comment or implementing the feature.

There's a commented-out service and a TODO comment indicating a misconfiguration. Consider either implementing the fix, creating a ticket to track this issue, or providing more context about the nature of the misconfiguration.


132-134: Simplify path construction using helper methods.

The code repeatedly constructs similar file paths with multiple chained resolve() calls. Consider extracting this pattern into a helper method to improve code readability and maintainability.

You could create a method like:

private Path getSlideFilePath(AttachmentVideoUnit unit, int slideNumber, String filename) {
    return FilePathService.getAttachmentVideoUnitFilePath()
            .resolve(unit.getId().toString())
            .resolve("slide")
            .resolve(String.valueOf(slideNumber))
            .resolve(filename);
}

Also applies to: 270-273, 286-296

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 60772f0 and afb64d5.

⛔ Files ignored due to path filters (1)
  • src/main/resources/config/liquibase/master.xml is excluded by !**/*.xml
📒 Files selected for processing (15)
  • src/main/java/de/tum/cit/aet/artemis/core/service/FilePathService.java (5 hunks)
  • src/main/java/de/tum/cit/aet/artemis/core/web/FileResource.java (9 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/domain/Attachment.java (2 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/domain/AttachmentVideoUnit.java (2 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/domain/Slide.java (2 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/repository/SlideRepository.java (2 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/AttachmentService.java (3 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/AttachmentVideoUnitService.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureService.java (5 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureUnitService.java (3 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/SlideSplitterService.java (12 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/SlideUnhideService.java (2 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/web/AttachmentResource.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/web/AttachmentVideoUnitResource.java (8 hunks)
  • src/main/java/de/tum/cit/aet/artemis/lecture/web/LectureResource.java (2 hunks)
✅ Files skipped from review due to trivial changes (2)
  • src/main/java/de/tum/cit/aet/artemis/core/service/FilePathService.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureUnitService.java
🚧 Files skipped from review as they are similar to previous changes (8)
  • src/main/java/de/tum/cit/aet/artemis/lecture/web/AttachmentResource.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/domain/Attachment.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/repository/SlideRepository.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/web/LectureResource.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/domain/Slide.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/LectureService.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/domain/AttachmentVideoUnit.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/web/AttachmentVideoUnitResource.java
🧰 Additional context used
📓 Path-based instructions (1)
`src/main/java/**/*.java`: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,de...

src/main/java/**/*.java: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports

  • src/main/java/de/tum/cit/aet/artemis/lecture/service/AttachmentService.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/SlideUnhideService.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/SlideSplitterService.java
  • src/main/java/de/tum/cit/aet/artemis/core/web/FileResource.java
  • src/main/java/de/tum/cit/aet/artemis/lecture/service/AttachmentVideoUnitService.java
🧬 Code Graph Analysis (2)
src/main/java/de/tum/cit/aet/artemis/lecture/service/AttachmentService.java (1)
src/main/webapp/app/lecture/manage/lecture-units/services/lecture-unit-management-resolve.service.ts (1)
  • resolve (14-24)
src/main/java/de/tum/cit/aet/artemis/core/web/FileResource.java (3)
src/main/webapp/app/lecture/shared/entities/lecture-unit/slide.model.ts (1)
  • Slide (4-10)
src/main/webapp/app/shared/service/file.service.ts (1)
  • getExtension (111-113)
src/main/webapp/app/lecture/manage/lecture-units/services/lecture-unit-management-resolve.service.ts (1)
  • resolve (14-24)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Build and Push Docker Image / Build Docker Image for ls1intum/artemis
  • GitHub Check: Build and Push Docker Image / Build Docker Image for ls1intum/artemis
  • GitHub Check: Build .war artifact
  • GitHub Check: server-tests
  • GitHub Check: server-style
  • GitHub Check: client-style
  • GitHub Check: Analyse
🔇 Additional comments (16)
src/main/java/de/tum/cit/aet/artemis/lecture/service/SlideUnhideService.java (2)

16-17: Import statement updated correctly for the new domain model.

The import has been properly updated to reflect the merged entity type following the repository-wide refactoring.


100-104: Slide unhide logic properly updated to use AttachmentVideoUnit entity.

The code correctly retrieves the attachment video unit from the slide and accesses its attachment property, maintaining the same functional behavior while using the new unified entity type.

src/main/java/de/tum/cit/aet/artemis/lecture/service/AttachmentService.java (3)

24-24: Import statement updated correctly for the new domain model.

The import has been properly updated to reflect the merged entity type.


57-57: Query method name updated correctly to match the repository refactoring.

The repository query method is correctly updated to find by attachment video unit ID instead of attachment unit ID.


135-136: File path service call updated appropriately.

The code correctly uses the new getAttachmentVideoUnitFilePath() method to align with the entity restructuring.

src/main/java/de/tum/cit/aet/artemis/lecture/service/AttachmentVideoUnitService.java (4)

30-59: Well-structured service with appropriate dependency injection.

The service follows the single responsibility principle and uses constructor injection appropriately to manage its dependencies. The service is correctly profiled for the core application context.


60-86: Comprehensive method to create attachment video units.

The method handles the creation process correctly, managing the parent-child relationship between lecture and lecture unit, dealing with file uploads if provided, and notifying external APIs as needed.


88-150: Well-implemented update functionality with proper competency tracking.

The update method preserves existing competency links for comparison, correctly applies updates to all fields including the new video source, and intelligently handles file updates and PDF splitting when needed.


231-235: Efficient cache management for updated files.

The method properly evicts the cache for updated files, which helps ensure that users always see the latest version of a file without having to rely on browser cache refresh.

src/main/java/de/tum/cit/aet/artemis/core/web/FileResource.java (7)

75-82: Imports and repository references updated correctly.

The imports and repository reference have been properly updated to reflect the merged entity type.


136-146: Constructor parameters and field assignments updated consistently.

The constructor parameters and field assignments properly initialize the repository for the new entity type.


484-486: Query and filtering logic updated for the new entity model.

The code correctly uses the new entity type and query methods while preserving the original filtering logic that checks authorization and file type.


513-526: Endpoint and method updated for the new entity type.

The endpoint, method name, and implementation have been consistently updated to use the new entity type while maintaining the same functionality.


536-546: Editor access endpoint properly updated.

The endpoint for editors to access attachment files has been correctly updated to use the new entity type, with proper authorization checks maintained.


574-603: Slide retrieval functionality updated correctly.

The method that retrieves a specific slide from an attachment has been properly updated to use the new entity type, with all authorization and validation logic preserved.


797-807: Helper method updated to check course membership.

The helper method that verifies an attachment video unit belongs to a course has been properly updated with the new entity type.

Comment on lines +52 to 55
AttachmentVideoUnit attachmentUnit = attachment.getAttachmentVideoUnit();
if (attachmentUnit == null) {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Variable name doesn't match its type.

The variable is named attachmentUnit but its type is AttachmentVideoUnit. This inconsistency could lead to confusion for developers maintaining the code in the future.

-    public void regenerateStudentVersion(Attachment attachment) {
-        AttachmentVideoUnit attachmentUnit = attachment.getAttachmentVideoUnit();
-        if (attachmentUnit == null) {
-            return;
-        }
+    public void regenerateStudentVersion(Attachment attachment) {
+        AttachmentVideoUnit attachmentVideoUnit = attachment.getAttachmentVideoUnit();
+        if (attachmentVideoUnit == null) {
+            return;
+        }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
AttachmentVideoUnit attachmentUnit = attachment.getAttachmentVideoUnit();
if (attachmentUnit == null) {
return;
}
public void regenerateStudentVersion(Attachment attachment) {
AttachmentVideoUnit attachmentVideoUnit = attachment.getAttachmentVideoUnit();
if (attachmentVideoUnit == null) {
return;
}
// ... rest of the method ...
}

File file = attachmentPath.toFile();
try (PDDocument document = Loader.loadPDF(file)) {
String pdfFilename = file.getName();
splitAttachmentUnitIntoSingleSlides(document, attachmentUnit, pdfFilename, hiddenPages, pageOrder);
splitAttachmentUnitIntoSingleSlides(document, attachmentVideoUnit, pdfFilename, hiddenPages, pageOrder);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Method name should be updated for consistency.

This method call uses the old naming convention splitAttachmentUnitIntoSingleSlides while the rest of the class has been updated to use splitAttachmentVideoUnitIntoSingleSlides.

-            splitAttachmentUnitIntoSingleSlides(document, attachmentVideoUnit, pdfFilename, hiddenPages, pageOrder);
+            splitAttachmentVideoUnitIntoSingleSlides(document, attachmentVideoUnit, pdfFilename, hiddenPages, pageOrder);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
splitAttachmentUnitIntoSingleSlides(document, attachmentVideoUnit, pdfFilename, hiddenPages, pageOrder);
splitAttachmentVideoUnitIntoSingleSlides(document, attachmentVideoUnit, pdfFilename, hiddenPages, pageOrder);

@@ -155,16 +155,16 @@
* @param hiddenPages The hidden pages information.
* @param pageOrder The order of pages in the PDF.
*/
public void splitAttachmentUnitIntoSingleSlides(PDDocument document, AttachmentUnit attachmentUnit, String pdfFilename, String hiddenPages, String pageOrder) {
log.debug("Processing slides for Attachment Unit with hidden pages {}", attachmentUnit.getAttachment().getName());
public void splitAttachmentUnitIntoSingleSlides(PDDocument document, AttachmentVideoUnit attachmentVideoUnit, String pdfFilename, String hiddenPages, String pageOrder) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Method name should be updated for consistency.

This method name still uses the old naming convention splitAttachmentUnitIntoSingleSlides while other similar methods have been updated to use splitAttachmentVideoUnitIntoSingleSlides.

-public void splitAttachmentUnitIntoSingleSlides(PDDocument document, AttachmentVideoUnit attachmentVideoUnit, String pdfFilename, String hiddenPages, String pageOrder) {
+public void splitAttachmentVideoUnitIntoSingleSlides(PDDocument document, AttachmentVideoUnit attachmentVideoUnit, String pdfFilename, String hiddenPages, String pageOrder) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public void splitAttachmentUnitIntoSingleSlides(PDDocument document, AttachmentVideoUnit attachmentVideoUnit, String pdfFilename, String hiddenPages, String pageOrder) {
public void splitAttachmentVideoUnitIntoSingleSlides(PDDocument document, AttachmentVideoUnit attachmentVideoUnit, String pdfFilename, String hiddenPages, String pageOrder) {

Copy link

End-to-End (E2E) Test Results Summary

TestsPassed ☑️Skipped ⚠️Failed ❌️Time ⏱
End-to-End (E2E) Test Report201 ran197 passed3 skipped1 failed48m 17s 941ms
TestResultTime ⏱
End-to-End (E2E) Test Report
e2e/exercise/programming/ProgrammingExerciseStaticCodeAnalysis.spec.ts
ts.Static code analysis tests › Configures SCA grading and makes a successful submission with SCA errors❌ failure1m 44s 55ms

@github-actions github-actions bot removed the stale label Apr 18, 2025
Copy link
Member

@alexjoham alexjoham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming and restructuring the code makes sense, Code all in all looks good! There a many empty files, please remove those and also take a look at the environment file that is overriding something, I think that is not correct. There are also many tests failing because the test can't compile. If everything is fixed I will leave another review and test the changes :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this file? This does not seem like it should be merged as it overrides something...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are several empty files, that need to be removed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is also empty

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is also empty

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is also empty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
atlas Pull requests that affect the corresponding module client Pull requests that update TypeScript code. (Added Automatically!) communication Pull requests that affect the corresponding module core Pull requests that affect the corresponding module database Pull requests that update the database. (Added Automatically!). Require a CRITICAL deployment. iris Pull requests that affect the corresponding module lecture Pull requests that affect the corresponding module server Pull requests that update Java code. (Added Automatically!) tests
Projects
Status: Ready For Review
Status: Todo
Development

Successfully merging this pull request may close these issues.

4 participants