35 lines
742 B
Go
35 lines
742 B
Go
package handlers
|
|
|
|
import (
|
|
"sneak.berlin/go/webhooker/internal/database"
|
|
)
|
|
|
|
// EntrypointView is the display-safe projection of an entrypoint for
|
|
// the UI, in the same way delivery.TargetView is one for a target.
|
|
type EntrypointView struct {
|
|
ID string
|
|
Path string
|
|
Description string
|
|
Active bool
|
|
}
|
|
|
|
// NewEntrypointViews projects entrypoints for rendering.
|
|
func NewEntrypointViews(
|
|
entrypoints []database.Entrypoint,
|
|
) []EntrypointView {
|
|
views := make([]EntrypointView, 0, len(entrypoints))
|
|
|
|
for i := range entrypoints {
|
|
e := &entrypoints[i]
|
|
|
|
views = append(views, EntrypointView{
|
|
ID: e.ID,
|
|
Path: e.Path,
|
|
Description: e.Description,
|
|
Active: e.Active,
|
|
})
|
|
}
|
|
|
|
return views
|
|
}
|