feat(site): define domain models #131

Merged
fuzzy merged 1 commit from feat/domain-models into main 2026-08-02 13:06:13 +00:00
Owner

What

Define the core domain models in internal/site:

  • Site (site.go) — Name, Owner, RepoURL, Visibility, CustomDomain, PreviewEnabled, CreatedAt
  • Deployment (deployment.go) — SiteName, Version, CommitSHA, Status, DeployedAt
  • Repository (repository.go) — SiteName, CloneURL, WebhookID, LastSync
  • Visibility enum — public, limited, private (own domain type, decoupled from the Forgejo SDK's VisibleType)
  • DeploymentStatus enum — pending, building, active, failed
  • JSON tags on all fields for Phase 5 API serialization; package comment moved to site.go
  • Unit tests covering enum constants and field assignments

Why

Phase 2 task #24 — the domain types that repository interfaces (#27) and services (#32) operate on.

Testing

  • go vet ./...
  • go test -race ./internal/site/ — 5 tests pass
  • gofmt -l ./cmd ./internal clean
  • golangci-lint run — 0 issues
  • pre-commit hooks all pass

Breaking Changes

None.

Notes

  • Status set is intentionally minimal; preview (preview) and rollback states will be added in Phases 6/7.
  • Issues #21–#24 were closed via the Forgejo API as part of this task per the workflow.

Closes #21
Closes #22
Closes #23
Closes #24

## What Define the core domain models in `internal/site`: - **`Site`** (site.go) — `Name`, `Owner`, `RepoURL`, `Visibility`, `CustomDomain`, `PreviewEnabled`, `CreatedAt` - **`Deployment`** (deployment.go) — `SiteName`, `Version`, `CommitSHA`, `Status`, `DeployedAt` - **`Repository`** (repository.go) — `SiteName`, `CloneURL`, `WebhookID`, `LastSync` - **`Visibility`** enum — `public`, `limited`, `private` (own domain type, decoupled from the Forgejo SDK's `VisibleType`) - **`DeploymentStatus`** enum — `pending`, `building`, `active`, `failed` - JSON tags on all fields for Phase 5 API serialization; package comment moved to `site.go` - Unit tests covering enum constants and field assignments ## Why Phase 2 task #24 — the domain types that repository interfaces (#27) and services (#32) operate on. ## Testing - [x] `go vet ./...` - [x] `go test -race ./internal/site/` — 5 tests pass - [x] `gofmt -l ./cmd ./internal` clean - [x] `golangci-lint run` — 0 issues - [x] pre-commit hooks all pass ## Breaking Changes None. ## Notes - Status set is intentionally minimal; preview (`preview`) and rollback states will be added in Phases 6/7. - Issues #21–#24 were closed via the Forgejo API as part of this task per the workflow. Closes #21 Closes #22 Closes #23 Closes #24
feat(site): define domain models
All checks were successful
Test and Release / lint (pull_request) Successful in 6m22s
Test and Release / test (pull_request) Successful in 6m27s
ac63480f49
Define the core domain models for thwap-pagesd in the internal/site
package: Site (name, owner, repo URL, visibility, custom domain,
preview enabled), Deployment (version tag, commit SHA, status,
timestamp), and Repository (clone URL, webhook ID, last sync).
Add Visibility and DeploymentStatus enumerations decoupled from the
Forgejo SDK, json tags for later API serialization, and unit tests.
Mark task done in ROADMAP.md.

closes #21
closes #22
closes #23
closes #24
fuzzy scheduled this pull request to auto merge when all checks succeed 2026-08-02 13:01:22 +00:00
the.auditor left a comment

Review Summary

Verified locally on the PR head (ac63480): go build, go vet, gofmt, golangci-lint run all clean; all 5 site tests pass with -race.

The domain models are clean and well-documented. The Visibility and DeploymentStatus enums are properly decoupled from the Forgejo SDK as their own string types, with JSON tags ready for the Phase 5 API. Package comment correctly relocated to site.go. Table-driven enum tests plus field-assignment coverage are appropriate for pure data models.

No blocking issues.

Non-blocking observations:

  1. Deployment has no identifier field — Site keys off Name, but the upcoming DeploymentRepository (task #26) will likely need one. Worth considering an explicit ID when that lands.
  2. Deployment.Version is a raw string; pkg/version semver parsing (Phase 3) will normalize it. Fine for now.

Approving.

## Review Summary Verified locally on the PR head (`ac63480`): `go build`, `go vet`, `gofmt`, `golangci-lint run` all clean; all 5 site tests pass with `-race`. The domain models are clean and well-documented. The `Visibility` and `DeploymentStatus` enums are properly decoupled from the Forgejo SDK as their own string types, with JSON tags ready for the Phase 5 API. Package comment correctly relocated to `site.go`. Table-driven enum tests plus field-assignment coverage are appropriate for pure data models. **No blocking issues.** Non-blocking observations: 1. `Deployment` has no identifier field — `Site` keys off `Name`, but the upcoming `DeploymentRepository` (task #26) will likely need one. Worth considering an explicit `ID` when that lands. 2. `Deployment.Version` is a raw string; `pkg/version` semver parsing (Phase 3) will normalize it. Fine for now. Approving.
fuzzy merged commit ac63480f49 into main 2026-08-02 13:06:13 +00:00
fuzzy deleted branch feat/domain-models 2026-08-02 13:06:13 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/thwap-pagesd!131
No description provided.