Skip to content

Conversation

@wen-templari
Copy link
Member

This commit implements comprehensive image upload functionality that allows:

  • Clients to upload images when creating or updating events (problem description)
  • Members to upload images when committing or altering repairs (repair documentation)

Key changes:

  • Database: Add images TEXT field to event and event_log tables (migration 000008)
  • Models: Add StringSlice type with SQL Scanner/Valuer for JSON serialization
  • API: Implement /upload endpoint with multipart file handling and validation
    • Supports JPEG, PNG, WebP formats
    • Max file size: 10MB
    • Content-type and magic byte validation
    • Uses existing Aliyun OSS storage
  • DTOs: Add Images []string field to CreateEventRequest, UpdateRequest, CommitRequest, AlterCommitRequest
  • Service: Add ActOptions struct and ActWithOptions method for passing images with event actions
  • Repository: Update CRUD operations to handle images JSON serialization
  • Router: Update Create, Update, Commit, AlterCommit handlers to accept and process images

Images are stored separately:

  • Client images → event.images (problem documentation)
  • Member images → event_log.images (repair documentation per action)

This separation maintains clear ownership and timeline tracking.

This commit implements comprehensive image upload functionality that allows:
- Clients to upload images when creating or updating events (problem description)
- Members to upload images when committing or altering repairs (repair documentation)

Key changes:
- Database: Add images TEXT field to event and event_log tables (migration 000008)
- Models: Add StringSlice type with SQL Scanner/Valuer for JSON serialization
- API: Implement /upload endpoint with multipart file handling and validation
  - Supports JPEG, PNG, WebP formats
  - Max file size: 10MB
  - Content-type and magic byte validation
  - Uses existing Aliyun OSS storage
- DTOs: Add Images []string field to CreateEventRequest, UpdateRequest, CommitRequest, AlterCommitRequest
- Service: Add ActOptions struct and ActWithOptions method for passing images with event actions
- Repository: Update CRUD operations to handle images JSON serialization
- Router: Update Create, Update, Commit, AlterCommit handlers to accept and process images

Images are stored separately:
- Client images → event.images (problem documentation)
- Member images → event_log.images (repair documentation per action)

This separation maintains clear ownership and timeline tracking.
- Improve Dockerfile with better layer caching and explicit GOPROXY
- Separate dependency download from source build for faster rebuilds
- Add .dockerignore to exclude unnecessary files from build context
- Add Dockerfile.vendor as fallback for network-restricted environments

Changes to Dockerfile:
- Copy go.mod and go.sum first for better dependency caching
- Set GOPROXY to proxy.golang.org explicitly
- Run go mod download before copying source code
- This allows Docker to cache dependencies layer separately

Alternative Dockerfile.vendor can be used if network issues persist:
  go mod vendor
  docker build -f Dockerfile.vendor -t saturday .
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.

3 participants