feat: implement Files SDK asset lifecycle with owner/uploader schema - #128
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d9edd583c4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
d9edd58 to
c1f2b0d
Compare
c1f2b0d to
b5a54c6
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |

The Files SDK gateway has been moved from
/v1/filesto a versionless/filestransport seam. Authorization now reads the session from Hono context storage viarequireSessionmiddleware rather than performing a secondauth.api.getSession()call inside the router'sauthorizecallback.The
storage.assetsschema has been redesigned to mirror the Files SDK's own data shape. Theasset_statusenum,bucket,provider,organizationId,errorMessage,expiresAt, andstatuscolumns have been removed. In their place,etag,lastModified,type, andownerIdhave been added. The unique constraint previously covering(bucket, key)is now a unique index onkeyalone, since the configured Files singleton owns exactly one bucket.uploaderIdis now nullable withON DELETE SET NULL, whileownerIdis non-nullable withON DELETE CASCADE, reflecting that the two roles are distinct: the uploader records creation provenance and the owner records current belonging.Deletion now removes asset rows rather than marking them with a
deletedstatus. ThehandleUploadandhandleDeletefunctions inapps/api/src/shared/files.tsexecute Drizzle operations directly usingoperatorsre-exported frompackages/db/src/helpers.ts, so the API does not declare a separate direct Drizzle dependency.The
filessingleton is registered on the Hono context and theFilestype is added toAppContext. TheonActionhook handlesupload,head, anddeleteevents, with adefault: breakcase to satisfy exhaustiveness.S3_BUCKETis now a required environment variable rather than optional.The baseline migration has been regenerated to reflect the revised schema. The
files-clientgenerator has been updated to reference the new/filesroute location.