26 lines
443 B
Go
Raw Normal View History

2019-08-27 09:51:58 +00:00
package database
import (
"sort"
"github.com/aerogo/aero"
"github.com/animenotifier/notify.moe/arn"
)
// Types shows which types are available in the database.
func Types(ctx aero.Context) error {
typeMap := arn.DB.Types()
types := make([]string, 0, len(typeMap))
for typeName := range typeMap {
2019-11-18 05:26:53 +00:00
if arn.IsPrivateType(typeName) {
continue
}
2019-08-27 09:51:58 +00:00
types = append(types, typeName)
}
sort.Strings(types)
return ctx.JSON(types)
}