[PB-6608] feat/add favorites support for files and folders - #418
Conversation
| export type FetchPaginatedFile = | ||
| paths['/folders/content/{uuid}/files']['get']['responses']['200']['content']['application/json']['files'][0]; | ||
| paths['/folders/content/{uuid}/files']['get']['responses']['200']['content']['application/json']['files'][0] & { | ||
| isFavorite?: boolean; |
There was a problem hiding this comment.
for me its better to wait the backend to return this params instead of overwriting it here
There was a problem hiding this comment.
Done — regenerated the schema against master (favorites is merged but not deployed; the production spec URL 404s, so I ran the backend locally) and removed all the manual intersections
| paths['/folders/content/{uuid}/folders']['get']['responses']['200']['content']['application/json'], | ||
| 'folders' | ||
| > & { | ||
| folders: FetchPaginatedFolder[]; |
There was a problem hiding this comment.
for example this omit 'folders' and adding folders again seems a bit tricky 🤔
There was a problem hiding this comment.
Done — regenerated the schema against master (favorites is merged but not deployed; the production spec URL 404s, so I ran the backend locally) and removed all the manual intersections
|
|
||
| export type FavoriteItemType = 'file' | 'folder'; | ||
|
|
||
| export type FavoriteFileDto = components['schemas']['FileDto'] & { isFavorite?: boolean }; |
There was a problem hiding this comment.
same here, maybe its better to wait the backend to return this params instead of creating a new dto. As this types could be removed once it is merged right? 🤔
There was a problem hiding this comment.
Done — regenerated the schema against master (favorites is merged but not deployed; the production spec URL 404s, so I ran the backend locally) and removed all the manual intersections
|
if you are going to publish a new sdk release, remember to bump the package.json version |
Description
Adds SDK support for the new Favorites feature in the Drive API (
drive-server-wip).New methods in the
Storageclass:PUT /files/{uuid}/favoritemarkFileAsFavorite(uuid)DELETE /files/{uuid}/favoriteunmarkFileAsFavorite(uuid)GET /files/favoritesgetFavoriteFiles(payload)(cancellable)PUT /folders/{uuid}/favoritemarkFolderAsFavorite(uuid)DELETE /folders/{uuid}/favoriteunmarkFolderAsFavorite(uuid)GET /folders/favoritesgetFavoriteFolders(payload)(cancellable)New types in
drive/storage/types.ts:FavoriteStatusResponse,FavoriteFileDto,FavoriteFolderDto,GetFavoriteFilesPayload,GetFavoriteFoldersPayload. Thepaginated folder-content types and the hand-written item interfaces now expose an
optional
isFavorite?: booleanreturned by the backend.Includes unit tests for all six methods following the existing request-shape pattern.
Notes
The backend PR adding
isFavoriteto the API is not deployed to production yet, so thegenerated
src/schema.tsdoes not include the field. This PR bridges that gap withmanual
& { isFavorite?: boolean }intersections on the schema-derived types — safe toship before and after the backend deploy.
Once the backend is live in production, I have a follow-up PR already prepared that runs
yarn swagger(the production spec will then documentisFavoriteand the favoritesendpoints) and reverts those intersections to plain schema-derived aliases. Already
verified locally against the updated backend: types compile and tests pass without the
intersections.