func (h *Handler) GetTemplates(tkn, tplType string) ([]data.Template, error) {
	logger := h.logger.Add(
		"method", "GetTemplates", "type", tplType)

	if !h.token.Check(tkn) {
		logger.Warn("access denied")
		return nil, ErrAccessDenied
	}

	var templates []reform.Struct

	var err error
	if tplType != "" {
		templates, err = h.selectAllFrom(
			logger, data.TemplateTable,
			"WHERE kind = $1", tplType)
	} else {
		templates, err = h.selectAllFrom(
			logger, data.TemplateTable, "")
	}

	if err != nil {
		return nil, err
	}

	result := make([]data.Template, 0)

	for _, v := range templates {
		result = append(result, *v.(*data.Template))
	}

	return result, nil
}
func (h *Handler) GetTemplates(tkn, tplType string) ([]data.Template, error) {
	logger := h.logger.Add(
		"method", "GetTemplates", "type", tplType)

	if !h.token.Check(tkn) {
		logger.Warn("access denied")
		return nil, ErrAccessDenied
	}

	var templates []reform.Struct

	var err error
	if tplType != "" {
		templates, err = h.selectAllFrom(
			logger, data.TemplateTable,
			"WHERE kind = $1", tplType)
	} else {
		templates, err = h.selectAllFrom(
			logger, data.TemplateTable, "")
	}

	if err != nil {
		return nil, err
	}

	result := make([]data.Template, 0)

	for _, v := range templates {
		result = append(result, *v.(*data.Template))
	}

	return result, nil
}
// GetTemplates returns templates.