refactor product domain models

This commit is contained in:
david
2026-07-28 08:44:54 +08:00
parent 7000e90d88
commit 8d71a1fc08
15 changed files with 634 additions and 85 deletions

View File

@@ -28,6 +28,8 @@ func TestExpectedResources(t *testing.T) {
assertContract(t, ExpectedResources(), "ec", "ec_order_item", Writable, "list")
assertContract(t, ExpectedResources(), "wallet", "wallet_ledger", ReadOnly, "list")
assertContract(t, ExpectedResources(), "delivery", "delivery_track_point", ReadOnly, "list")
assertContract(t, ExpectedResources(), "product", "product_info", Editable, "list")
assertContract(t, ExpectedResources(), "product", "product_owner", AppendOnly, "list")
}
func TestContentUsesCMSResourceAndRemovedDomainsAreAbsent(t *testing.T) {
@@ -91,6 +93,11 @@ func TestResourceDefinitionAllowsOnlyMethodsForEachMode(t *testing.T) {
{"append-only GET", AppendOnly, http.MethodGet, true},
{"append-only POST", AppendOnly, http.MethodPost, true},
{"append-only PUT", AppendOnly, http.MethodPut, false},
{"editable GET", Editable, http.MethodGet, true},
{"editable POST", Editable, http.MethodPost, true},
{"editable PUT", Editable, http.MethodPut, true},
{"editable PATCH", Editable, http.MethodPatch, true},
{"editable DELETE", Editable, http.MethodDelete, false},
{"writable GET", Writable, http.MethodGet, true},
{"writable POST", Writable, http.MethodPost, true},
{"writable PUT", Writable, http.MethodPut, true},