Skip to content

feat: implement Files SDK asset lifecycle with owner/uploader schema - #128

Merged
adelrodriguez merged 1 commit into
mainfrom
07-31-feat_implement_files_sdk_asset_lifecycle_with_owner_uploader_schema
Aug 1, 2026
Merged

feat: implement Files SDK asset lifecycle with owner/uploader schema#128
adelrodriguez merged 1 commit into
mainfrom
07-31-feat_implement_files_sdk_asset_lifecycle_with_owner_uploader_schema

Conversation

@adelrodriguez

Copy link
Copy Markdown
Collaborator

The Files SDK gateway has been moved from /v1/files to a versionless /files transport seam. Authorization now reads the session from Hono context storage via requireSession middleware rather than performing a second auth.api.getSession() call inside the router's authorize callback.

The storage.assets schema has been redesigned to mirror the Files SDK's own data shape. The asset_status enum, bucket, provider, organizationId, errorMessage, expiresAt, and status columns have been removed. In their place, etag, lastModified, type, and ownerId have been added. The unique constraint previously covering (bucket, key) is now a unique index on key alone, since the configured Files singleton owns exactly one bucket. uploaderId is now nullable with ON DELETE SET NULL, while ownerId is non-nullable with ON 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 deleted status. The handleUpload and handleDelete functions in apps/api/src/shared/files.ts execute Drizzle operations directly using operators re-exported from packages/db/src/helpers.ts, so the API does not declare a separate direct Drizzle dependency.

The files singleton is registered on the Hono context and the Files type is added to AppContext. The onAction hook handles upload, head, and delete events, with a default: break case to satisfy exhaustiveness. S3_BUCKET is now a required environment variable rather than optional.

The baseline migration has been regenerated to reflect the revised schema. The files-client generator has been updated to reference the new /files route location.

@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
init Ready Ready Preview Aug 1, 2026 2:15am

Request Review

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3fcd4f2e-e52a-43d0-9135-557a8dc818b9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@adelrodriguez
adelrodriguez marked this pull request as ready for review August 1, 2026 01:00

adelrodriguez commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator Author

@adelrodriguez

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread apps/api/src/shared/files.ts
Comment thread apps/api/src/routes/index.ts
Base automatically changed from 07-31-feat_add_files_gateway_asset_index_plan_fix_marquee_spacing_align_table_formatting to main August 1, 2026 01:56
@adelrodriguez
adelrodriguez force-pushed the 07-31-feat_implement_files_sdk_asset_lifecycle_with_owner_uploader_schema branch from d9edd58 to c1f2b0d Compare August 1, 2026 02:10
@adelrodriguez
adelrodriguez force-pushed the 07-31-feat_implement_files_sdk_asset_lifecycle_with_owner_uploader_schema branch from c1f2b0d to b5a54c6 Compare August 1, 2026 02:14
@adelrodriguez

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: b5a54c6160

ℹ️ 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".

@adelrodriguez
adelrodriguez merged commit f26ae90 into main Aug 1, 2026
9 checks passed
@adelrodriguez
adelrodriguez deleted the 07-31-feat_implement_files_sdk_asset_lifecycle_with_owner_uploader_schema branch August 1, 2026 02:27
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.

1 participant