Use a central list of private types

This commit is contained in:
2019-11-18 14:26:53 +09:00
parent 597f46f372
commit 12c752a272
4 changed files with 26 additions and 26 deletions

View File

@ -10,14 +10,7 @@ import (
)
var (
empty = struct{}{}
privateCollections = map[string]struct{}{
"PayPalPayment": empty,
"Purchase": empty,
"EmailToUser": empty,
"Session": empty,
"EditLogEntry": empty,
}
empty = struct{}{}
)
func Install(app *aero.Application) {
@ -27,9 +20,8 @@ func Install(app *aero.Application) {
api.AddRootResolver(func(name string, arguments graphql.Map) (interface{}, error, bool) {
typeName := strings.TrimPrefix(name, "all")
typeName = strings.TrimPrefix(typeName, "like")
_, private := privateCollections[typeName]
if private {
if arn.IsPrivateType(typeName) {
return nil, fmt.Errorf("Type '%s' is private", typeName), true
}