Conversation
…into feat/155-change-of-folder-architecture
|
awaiting architecture discussion |
MoonPrincess06
left a comment
There was a problem hiding this comment.
Poza tym jednym komentarzu, co zostawiłam, nie rzuca mi się nic takiego w oczy
There was a problem hiding this comment.
Pull request overview
Refactors the quizzes “folder” domain by introducing per-user root folders, adding folder sharing, and updating quiz ownership semantics from maintainer to creator, with corresponding API + test updates.
Changes:
- Added
User.root_folderand mechanisms to create root folders (signal + data migration). - Introduced/expanded folder & sharing support (
Folder,SharedFolder) and added a/library/browsing endpoint. - Renamed
Quiz.maintainer→Quiz.creatorand updated views/serializers/admin/tests accordingly.
Reviewed changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
users/models.py |
Adds root_folder OneToOne relation to quizzes.Folder. |
users/migrations/0006_user_root_folder.py |
Migration adding root_folder to User. |
quizzes/apps.py |
Registers quizzes app signals on startup. |
quizzes/signals.py |
Adds post-save hook to auto-create a root folder for new users. |
quizzes/models.py |
Adds folder root detection/protection, SharedFolder, and updates Quiz to use creator + non-null folder. |
quizzes/permissions.py |
Updates permission classes to reflect creator/folder ownership model. |
quizzes/serializers.py |
Renames maintainer fields to creator; adds LibraryItemSerializer; adds root-folder move validation. |
quizzes/views.py |
Updates queries to use creator; enforces folder-owner delete; adds LibraryView. |
quizzes/urls.py |
Adds /library/ routes. |
quizzes/admin.py |
Renames admin fields/search/autocomplete from maintainer to creator. |
quizzes/migrations/0004_folder_quiz_folder.py |
Adjusts initial folder migration definition (incl. timestamps/parent/owner). |
quizzes/migrations/0005_rename_user_folder_owner_folder_created_at_and_more.py |
Deleted migration as part of migration history rewrite. |
quizzes/migrations/0006_folder_parent.py |
Deleted migration as part of migration history rewrite. |
quizzes/migrations/0007_question_answer.py |
Repoints dependency to 0004_* after removing 0005/0006. |
quizzes/migrations/0017_sharedfolder.py |
Adds SharedFolder table. |
quizzes/migrations/0019_merge_0017_sharedfolder_0018_delete_quizprogress.py |
Merge migration for branching migration history. |
quizzes/migrations/0020_rename_maintainer_to_creator.py |
Schema rename of Quiz.maintainer → Quiz.creator. |
quizzes/migrations/0021_create_root_folders.py |
Data migration to create root folders and attach orphan quizzes; makes Quiz.folder required. |
quizzes/migrations/0022_merge_0019_questionissue_0021_create_root_folders.py |
Merge migration. |
uploads/tests.py |
Updates quiz creation in upload tests to use creator + folder. |
quizzes/tests/test_library_endpoint.py |
Adds test coverage for /library/ root/folder browsing and sharing. |
quizzes/tests/test_folder_root.py |
Adds tests for root folder creation, move/delete protection, and cascade behavior. |
quizzes/tests/test_folder_crud.py |
Adds CRUD + permission tests for folders/quizzes under the new model. |
quizzes/tests/test_copy_quiz.py |
Updates copy tests to use creator + folder, and asserts copied quiz lands in copier’s root folder. |
quizzes/tests/test_quiz_crud.py |
Updates CRUD tests for creator and adds root-folder assignment assertions. |
quizzes/tests/test_question_crud.py |
Updates question CRUD tests for creator + folder. |
quizzes/tests/test_metadata_action.py |
Updates metadata tests for creator + folder. |
quizzes/tests/test_quiz_progress.py |
Updates progress tests for creator + folder. |
quizzes/tests/test_quiz_serializer_extras.py |
Updates serializer tests for creator + folder. |
quizzes/tests/test_record_answer_updates_session.py |
Updates session tests for creator + folder. |
quizzes/tests/test_has_external_images.py |
Updates external-images test for creator + folder. |
quizzes/tests/last_used_quizzes_test.py |
Updates last-used tests for creator + folder and response field rename. |
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
|
hej, pamiętaj że by oznaczać komentarze jako rozwiązane |
MoonPrincess06
left a comment
There was a problem hiding this comment.
Znalazłam kilka rzeczy jeszcze, ale poza tym jest git:)
…ub.com/Solvro/backend-testownik into feat/155-change-of-folder-architecture
MoonPrincess06
left a comment
There was a problem hiding this comment.
Przejrzyj proszę całą bazę i pozmieniaj to maintainer na creator pls. W IDE możesz po prostu wyszukać słowo maintainer w repo i przeklikać każde wystąpienie nazwy i usalić, czy chcesz to zmienić czy nie. Fajny też byłby refactor nazw klas i funkcji, bo nowa osoba może nie wiedzieć kim jest maintainer w nazwie funkcji
Antoni-Czaplicki
left a comment
There was a problem hiding this comment.
kilka uwag plus jakbyś miał chwile ogarnać konflikty to by było super
users/migrations/0008_merge_0006_user_root_folder_0007_auto_20260308_1619.py
Outdated
Show resolved
Hide resolved
| owner = models.ForeignKey(User, on_delete=models.CASCADE, related_name="folders") | ||
| created_at = models.DateTimeField(auto_now_add=True) | ||
| updated_at = models.DateTimeField(auto_now=True) | ||
|
|
There was a problem hiding this comment.
lets also add field for when associated root folder user has been deleted
There was a problem hiding this comment.
I dont get the idea of this change. Whe we are deleting user (owner of specify root_folder) we are deleting this folder also.
…mplicit (fall through) returns' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Zmieniłem architekturę folderów, dodałem parę testów i migrację, która powinna stworzyć root foldery dla istniejących już użytkowników. Zmergowałem również kod Wiktora, który implementuje endpointy library i model SharedFolder. Zrefactorowałem go tak, żeby była jedna klasa APIView zajmująca się tą logiką (dopiero po fakcie zobaczyłem, że sposób, którym zrobił był opisany przez Sarę więc jeżeli należy to zmienić to zmienię ).
Important
Refactor folder architecture by introducing
FolderandSharedFoldermodels, renamingmaintainertocreator, and updating views, serializers, and tests accordingly.Foldermodel inmodels.pywith fields forname,owner,parent,created_at, andupdated_at.SharedFoldermodel for sharing folders with users or study groups.0004_folder_quiz_folder.py,0017_sharedfolder.py, and0021_create_root_folders.pyto set up folder structure and root folders for users.maintainertocreatorinQuizmodel and updated related fields and permissions.Quizmodel to include afolderfield, linking quizzes to folders.QuizViewSetandFolderViewSetto handle folder-related operations and permissions.LibraryViewto handle library endpoints for accessing folders and quizzes.tests/to cover new folder architecture, permissions, and library endpoints.This description was created by
for ac52c07. You can customize this summary. It will automatically update as commits are pushed.