Skip to content

Implemented delete file api route and model#76

Merged
aakashg00 merged 3 commits intomainfrom
akash/delete-files
Apr 12, 2026
Merged

Implemented delete file api route and model#76
aakashg00 merged 3 commits intomainfrom
akash/delete-files

Conversation

@KashGiannis34
Copy link
Copy Markdown
Contributor

Depends on GTBitsOfGood/juno#252 to be merged first. Adds api functionality to remove files from file service to use in dashboard.

@KashGiannis34 KashGiannis34 requested a review from llam36 April 7, 2026 12:52
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 7, 2026

Greptile Summary

This PR adds a deleteFiles SDK method backed by a new FileDeleteApi that calls DELETE /file/delete. The auto-generated internal API/model files follow the established OpenAPI code-generation pattern, and the hand-written src/lib/file.ts implementation correctly mirrors the credential forwarding, header injection, and validation approach used by every other method in FileAPI.

PR Checklist: 90/100 — The only area needing improvement is per-element validation on fileNames array entries (individual strings are not checked for emptiness/whitespace), which is a minor gap given that all other inputs are properly validated.

Confidence Score: 5/5

Safe to merge; only a P2 style/validation suggestion remains.

All findings are P2. The implementation correctly follows existing patterns for auto-generated API clients, models, credential forwarding, and input validation. No logic errors, security issues, or broken contracts were identified.

src/lib/file.ts — minor: consider adding per-element non-empty validation for fileNames array entries.

Important Files Changed

Filename Overview
src/internal/apis/FileDeleteApi.ts Auto-generated OpenAPI client for DELETE /file/delete; follows existing API class patterns exactly.
src/internal/models/DeleteFilesModel.ts Auto-generated request model with bucketName, configId, and fileNames; serialization helpers included.
src/internal/models/DeleteFilesResponse.ts Auto-generated response model returning bucketName and deleted fileNames.
src/internal/apis/index.ts Adds FileDeleteApi export in correct alphabetical order.
src/internal/models/index.ts Adds DeleteFilesModel and DeleteFilesResponse exports in alphabetical order.
src/lib/file.ts Implements deleteFiles() following existing patterns; missing per-element validation on fileNames array entries.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant FileAPI
    participant FileDeleteApi
    participant JunoBackend

    Caller->>FileAPI: deleteFiles({ bucketName, configId, fileNames })
    FileAPI->>FileAPI: validateString(bucketName)
    FileAPI->>FileAPI: validate configId is number
    FileAPI->>FileAPI: validate fileNames is non-empty array
    FileAPI->>FileDeleteApi: fileDeleteControllerDeleteFiles({ deleteFilesModel }, initOverrides)
    FileDeleteApi->>JunoBackend: DELETE /file/delete (body: DeleteFilesModel, Authorization: Bearer token)
    JunoBackend-->>FileDeleteApi: 200 OK { bucketName, fileNames }
    FileDeleteApi-->>FileAPI: DeleteFilesResponse
    FileAPI-->>Caller: DeleteFilesResponse
Loading

Reviews (1): Last reviewed commit: "Fixed prettier issues" | Re-trigger Greptile

Comment thread src/lib/file.ts
Copy link
Copy Markdown
Contributor

@aakashg00 aakashg00 left a comment

Choose a reason for hiding this comment

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

looks good!

@aakashg00 aakashg00 merged commit 531dcba into main Apr 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants