mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-10-11 00:04:37 +00:00
The five /sysjob routes use the generic actions. The detail route uses ViewAs to keep answering SysJobItem, whose entryId the edit form reads where the model marshals entry_id. GenerateM becomes ToModel, and the Generate methods go. Recorded before the change and replayed after it, the same 14 requests get byte-identical responses; answering the detail with the model instead of SysJobItem makes exactly the two detail requests differ. With a real ToModel on both modules, a test now builds a package that pairs the demo model with the jobs request and requires the build to fail on that pairing, next to the same package with the pair corrected.
13 lines
398 B
Go
13 lines
398 B
Go
// Package mismatch pairs a model with another model's request, which must
|
|
// not compile. TestGenericActionsRefuseAMismatchedPair builds it and expects
|
|
// the build to fail; testdata keeps it out of ./... .
|
|
package mismatch
|
|
|
|
import (
|
|
"go-admin/app/demo/models"
|
|
jobdto "go-admin/app/jobs/service/dto"
|
|
"go-admin/common/actions"
|
|
)
|
|
|
|
var _ = actions.Create[models.DemoProduct, jobdto.SysJobControl]
|