Repository navigation
feat: renomear pastas e arquivos (LUI-180) - #15
Merged
Merged
Conversation
Acceptance file docs/tickets/LUI-177/LUI-180/aceite.md (CA1-CA9). The OpenAPI snapshot gains PATCH /items/{id} (UpdateItemDto with only name, 200 ItemDto) and the UpdateItemDto schema; no table changes.
Decision: the route is the LLD's PATCH /items/{id}, with only name in this delivery. name is required now, and LUI-181 relaxes it to name and/or parentId, a change that breaks no client. A body with no field is therefore validation_error, as the ticket asks.
Decision: renaming the root folder answers validation_error, and not_found stays for what the User cannot see (missing, another User's, pending, not a UUID). The root's name is fixed, so the request is invalid input, and no new error code is needed. The root alias is accepted in the path, as in GET /items/{id}, and leads to the same refusal.
Decision: the rename takes no advisory lock, because it changes neither the depth nor the shape of the tree; only the move (LUI-181) needs it.
Decision: the name rules are shared with the folder creation (trimmed ends, 1 to 255 characters measured after the trim, no "/" or control characters), by extracting the name decorators the CreateFolderDto uses, so the two routes never drift apart.
Decision: the download needs no change, because downloadUrl reads the name from the item row at each call, so CA5 is proved by a test only.
Decision: the row menu moves to a client component that owns the rename dialog, because the Menu unmounts its items when it closes and would take the dialog with it. The folder row gains the "Mais ações" button, with "Renomear" only; "Mover para…" comes with LUI-181 and "Excluir" with the trash.
Files and interfaces the implementation will touch:
- apps/api/src/modules/items: ItemsController.update (PATCH :id), ItemsService.rename and ItemsRepository.rename (reads the active item of the owner, refuses the root, updates the name); dto/update-item.dto.ts; the name decorators extracted from dto/create-folder.dto.ts.
- apps/api/openapi.json: regenerated from the controller and the DTO; it must match the snapshot of this plan.
- apps/api/test: items-rename.e2e-spec.ts and the rename call in support/items.ts.
- apps/web: updateItem in lib/api/items.ts and its input type in lib/api/types.ts, renameItem in lib/dal/items.ts, the renameItem Server Action in app/(drive)/actions.ts, components/files/row-actions.tsx (menu and dialog) and rename-dialog.tsx, used by file-row.tsx.
- apps/web/e2e: rename.spec.ts.
- docs/lld.md: section 3.3 (the PATCH route with only the name for now) and the web section that says the folder row has no "Mais ações" button.
Existing tests whose behavior changes: none.
Data changes: none.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
PATCH /items/{id} changes the name of an active item of the User. The root
folder is refused with validation_error and anything the User cannot see is
not_found. The row menu gains "Renomear" on files and folders, with a dialog
that opens with the current name fully selected.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
Há problemas pendentes de atomicidade na persistência e de atualização/composição da interface.
2 open findings
What changed in this PR
Implementa a renomeação de arquivos e pastas via API e interface web.
Changes:
- Adiciona
PATCH /items/{id}, validações e testes E2E. - Adiciona menus, diálogo e Server Action de renomeação.
- Atualiza documentação e contrato OpenAPI.
| File | Description |
|---|---|
docs/tickets/LUI-177/LUI-180/aceite.md |
Critérios de aceite |
docs/lld.md |
Contrato funcional atualizado |
apps/web/lib/dal/items.ts |
DAL de renomeação |
apps/web/lib/api/types.ts |
Tipos da atualização |
apps/web/lib/api/items.ts |
Cliente da API |
apps/web/e2e/rename.spec.ts |
Testes Playwright |
apps/web/components/ui/menu.tsx |
Fechamento configurável do menu |
apps/web/components/files/row-actions.tsx |
Ações da linha |
apps/web/components/files/rename-dialog.tsx |
Diálogo de renomeação; requer atualização das páginas carregadas |
apps/web/components/files/openable-row.tsx |
Filtragem de duplo clique em controles |
apps/web/components/files/file-row.tsx |
Integração das ações; requer suporte à vitrine |
apps/web/app/(drive)/actions.ts |
Server Action e validações |
apps/api/test/support/items.ts |
Helper HTTP |
apps/api/test/items-rename.e2e-spec.ts |
Testes E2E da API |
apps/api/src/modules/items/items.service.ts |
Regras de negócio |
apps/api/src/modules/items/items.repository.ts |
Persistência; requer atualização atômica |
apps/api/src/modules/items/items.controller.ts |
Endpoint PATCH |
apps/api/src/modules/items/entities/item.entity.ts |
Resultado da renomeação |
apps/api/src/modules/items/dto/update-item.dto.ts |
DTO da requisição |
apps/api/openapi.json |
Contrato OpenAPI |
🧠 Review effort: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
…UI-180) O renomear lia e gravava em operações separadas, deixando uma janela em que o item podia mudar de estado. Agora é um UPDATE condicional, e só sem linha afetada a leitura distingue Pasta raiz de not_found. O router.refresh() só refaz a primeira página, então a linha vinda de "Carregar mais" ficava com o nome antigo. O LoadMoreProvider ganhou reset(), chamado pelo diálogo de renomear. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ear-pastas-e-arquivos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


O que muda
PATCH /items/{id}renomeia uma pasta ou um arquivo ativo do Usuário (só onamenesta entrega). A Pasta raiz é recusada comvalidation_error, e o que o Usuário não enxerga respondenot_found. Na web, a linha de pasta ganha o "Mais ações" e as duas linhas ganham "Renomear", com um diálogo que abre com o nome atual todo selecionado.Fora do plano:
MenuItemganhoucloseOnClick, eOpenableRowignora o duplo clique que vem de botão, menu ou diálogo.Aceite
docs/tickets/LUI-177/LUI-180/aceite.md
🤖 Generated with Claude Code