package cabana import ( "time" "git.golem15.com/golem15/summercms/modules/pact" "gorm.io/gorm" ) // AdminAPIRoutes exposes the admin API route inventory (method plus // prefix-relative path) to the external conformance test. func AdminAPIRoutes() []string { out := make([]string, 0, len(phase09Routes)) for _, route := range phase09Routes { if !route.spa { out = append(out, route.key) } } return out } // IssueTestAPIToken mints a personal API token for ownerID with the given // scopes and optional expiry. Used by external Postgres smoke tests before // the HTTP create route exists. func IssueTestAPIToken(db *gorm.DB, ownerID uint, scopes []string, expiresAt *time.Time) (plain string, err error) { plain, _, err = insertAPIToken(db, ownerID, "test", scopes, expiresAt) return plain, err } // ValidateMoneyValue exposes the money field's save check (phrase key and // placeholders of the first failure, "" when accepted) to the external // money field tests. func ValidateMoneyValue(value any, scale int, max string) (string, map[string]string) { return validateMoneyValue(value, scale, max) } // CheckMoneyType exposes the money field's model column gate to the // external money field tests. func CheckMoneyType(model any, field FormField) error { return checkMoneyType(model, field) } // ProjectRow exposes one list row's projection to the external money // column tests. func ProjectRow(row any, controller pact.AdminController, cols []ListColumn) map[string]any { return projectRow(row, controller, cols) }