You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sonic/handler/content/api/options.go

30 lines
848 B
Go

package api
import (
"github.com/gin-gonic/gin"
"github.com/go-sonic/sonic/model/property"
"github.com/go-sonic/sonic/service"
)
type OptionHandler struct {
OptionService service.OptionService
}
func NewOptionHandler(
optionService service.OptionService,
) *OptionHandler {
return &OptionHandler{
OptionService: optionService,
}
}
func (o *OptionHandler) Comment(ctx *gin.Context) (interface{}, error) {
result := make(map[string]interface{})
result[property.CommentGravatarSource.KeyValue] = o.OptionService.GetOrByDefault(ctx, property.CommentGravatarSource)
result[property.CommentGravatarDefault.KeyValue] = o.OptionService.GetOrByDefault(ctx, property.CommentGravatarDefault)
result[property.CommentContentPlaceholder.KeyValue] = o.OptionService.GetOrByDefault(ctx, property.CommentContentPlaceholder)
return result, nil
}