Skip to content

feat(sep12): implement StorageProvider interface, S3 implementation, …#673

Open
teslims2 wants to merge 2 commits into
ceejaylaboratory:mainfrom
teslims2:feat/sep12-storage-provider-upload-url
Open

feat(sep12): implement StorageProvider interface, S3 implementation, …#673
teslims2 wants to merge 2 commits into
ceejaylaboratory:mainfrom
teslims2:feat/sep12-storage-provider-upload-url

Conversation

@teslims2

Copy link
Copy Markdown
Contributor

Certainly! Here's the updated PR with the #544 implementation details included.

Implement SEP-12 Storage Abstraction, AWS S3 Upload Support, Upload URL Endpoint, and CI Migration Validation

Description

This PR introduces the storage infrastructure required for SEP-12 customer document uploads. It adds a storage abstraction layer, implements an AWS S3-backed storage provider with presigned upload URLs, creates the upload URL endpoint and persistence model, and strengthens CI by validating Prisma migrations before deployment.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Dependency update
  • CI/CD improvement

Related Issues

Closes #540
Closes #543
Closes #544
Closes #548

Changes Made

#543 — Create StorageProvider Interface

  • Created backend/src/services/storage/storage-provider.interface.ts.

  • Added the StorageProvider interface defining:

    • generatePresignedPutUrl(key, contentType, expires)
    • objectExists(key)
  • Exported the interface for dependency injection and future storage implementations.

#544 — Implement AWS S3 StorageProvider

  • Installed:

    • @aws-sdk/client-s3
    • @aws-sdk/s3-request-presigner
  • Created S3StorageProvider implementing the StorageProvider interface.

  • Integrated the AWS S3 client to generate secure presigned PUT URLs for direct client uploads.

  • Implemented objectExists() to verify uploaded objects within the configured S3 bucket.

  • Designed the implementation to allow future storage providers (e.g., MinIO or Google Cloud Storage) to be swapped in without changing controller logic.

#548 — Implement POST /sep12/customer/upload-url

  • Added a new controller and route for POST /sep12/customer/upload-url.

  • Uses the configured StorageProvider to generate a presigned upload URL.

  • Creates an UploadRecord database entry with PENDING status before upload.

  • Returns HTTP 200 with:

    • Generated presigned upload URL
    • Upload record ID
  • Added the UploadRecord Prisma model and corresponding database migration.

#540 — Prisma Migration Validation in CI

  • Added a Prisma migration status dry-run check to the CI workflow.
  • Ensures pending or invalid migrations are detected before merge.
  • Improves deployment safety by preventing schema drift.

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • CI workflow validated successfully

Documentation

  • README updated (not required)
  • Code comments added where appropriate
  • API documentation updated

Breaking Changes

  • No breaking changes

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code where necessary
  • My changes generate no new warnings
  • I have added tests that prove the new functionality works
  • New and existing tests pass locally
  • CI validates Prisma migration status before merge
  • No secrets or sensitive credentials were committed

Additional Context

This PR establishes the storage foundation for SEP-12 customer document uploads by introducing a provider abstraction, a production-ready AWS S3 implementation, upload tracking through the database, and automated migration validation in CI. The storage interface also enables future support for alternative object storage providers with minimal application changes.

…upload-url endpoint, and CI migration check

- Add StorageProvider interface (closes ceejaylaboratory#543)
- Install @aws-sdk/client-s3 and @aws-sdk/s3-request-presigner; implement S3StorageProvider (closes ceejaylaboratory#544)
- Add POST /sep12/customer/upload-url route and controller; add UploadRecord Prisma model with migration (closes ceejaylaboratory#548)
- Add Prisma migrate status dry-run check step in CI workflow (closes ceejaylaboratory#540)
@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@teslims2 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant