feat: implement database and storage abstractions

- Added `internal/db/store.go` to define the Store interface for database operations, including user, organization, app, channel, release, patch, and artifact management.
- Introduced `internal/models/models.go` changes to reflect updated organization and artifact response structures.
- Created `internal/storage/factory.go`, `local.go`, and `s3.go` to implement storage backends for local filesystem and S3-compatible services.
- Removed deprecated `internal/storage/storage.go` and refactored storage interface into `internal/storage/store.go`.
- Updated frontend JavaScript in `web/js/app.js` to display server health information, including storage and database backend details.
This commit is contained in:
Tony
2026-06-12 08:45:01 +08:00
parent 246260a8f5
commit 3bb4ab494e
31 changed files with 1698 additions and 509 deletions
+24 -9
View File
@@ -174,9 +174,11 @@ const (
// Organization represents an organization.
type Organization struct {
ID int `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
ID int `json:"id"`
Name string `json:"name"`
OrganizationType string `json:"organization_type"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// OrganizationMembership represents a user's membership in an org.
@@ -233,10 +235,18 @@ type CreateReleaseArtifactRequest struct {
PodfileLockHash *string `json:"podfile_lock_hash"`
}
// CreateReleaseArtifactResponse returns the presigned upload URL.
// CreateReleaseArtifactResponse returns the artifact metadata.
type CreateReleaseArtifactResponse struct {
ID int `json:"id"`
URL string `json:"url"`
ID int `json:"id"`
ReleaseID int `json:"release_id"`
Arch string `json:"arch"`
Platform string `json:"platform"`
Hash string `json:"hash"`
Size int64 `json:"size"`
URL string `json:"url"`
CreatedAt time.Time `json:"created_at"`
CanSideload bool `json:"can_sideload"`
PodfileLockHash *string `json:"podfile_lock_hash"`
}
// CreatePatchRequest is the POST /patches request body.
@@ -260,10 +270,15 @@ type CreatePatchArtifactRequest struct {
PodfileLockHash *string `json:"podfile_lock_hash"`
}
// CreatePatchArtifactResponse returns the presigned upload URL.
// CreatePatchArtifactResponse returns the patch artifact metadata.
type CreatePatchArtifactResponse struct {
ID int `json:"id"`
URL string `json:"url"`
ID int `json:"id"`
PatchID int `json:"patch_id"`
Arch string `json:"arch"`
Platform string `json:"platform"`
Hash string `json:"hash"`
Size int64 `json:"size"`
URL string `json:"url"`
}
// UpdateReleaseRequest is the PATCH /releases/{id} request body.