Documentation
¶
Index ¶
- type FormData
- type FormOperations
- func (o *FormOperations) CreateDefaultSchema() form.JSON
- func (o *FormOperations) EnsureFormOwnership(c echo.Context, currentUser *user.User, formID string) (*form.Form, error)
- func (o *FormOperations) UpdateFormDetails(formObj *form.Form, formData *FormData)
- func (o *FormOperations) ValidateAndBindFormData(c echo.Context) (*FormData, error)
- type PageDataService
- func (s *PageDataService) PrepareDashboardData(c echo.Context, currentUser *user.User, forms []*form.Form) shared.PageData
- func (s *PageDataService) PrepareFormData(c echo.Context, currentUser *user.User, formObj *form.Form, ...) shared.PageData
- func (s *PageDataService) PrepareNewFormData(c echo.Context, currentUser *user.User) shared.PageData
- type ResponseBuilder
- func (b *ResponseBuilder) BuildErrorResponse(c echo.Context, err error, status int, message string) error
- func (b *ResponseBuilder) BuildForbiddenResponse(c echo.Context, message string) error
- func (b *ResponseBuilder) BuildHTMLResponse(c echo.Context, template string, data any, status int) error
- func (b *ResponseBuilder) BuildJSONResponse(c echo.Context, data any, status int) error
- func (b *ResponseBuilder) BuildNoContentResponse(c echo.Context, status int) error
- func (b *ResponseBuilder) BuildNotFoundResponse(c echo.Context, message string) error
- func (b *ResponseBuilder) BuildRedirectResponse(c echo.Context, path string, status int) error
- func (b *ResponseBuilder) BuildValidationErrorResponse(c echo.Context, err error) error
- type TemplateService
- func (s *TemplateService) RenderDashboard(c echo.Context, data shared.PageData) error
- func (s *TemplateService) RenderEditForm(c echo.Context, data shared.PageData) error
- func (s *TemplateService) RenderFormSubmissions(c echo.Context, formObj *form.Form, submissions []*model.FormSubmission) error
- func (s *TemplateService) RenderNewForm(c echo.Context, data shared.PageData) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FormData ¶
type FormData struct {
Title string `json:"title" form:"title" validate:"required"`
Description string `json:"description" form:"description" validate:"required"`
}
FormData represents the structure for form creation and updates
type FormOperations ¶
type FormOperations struct {
// contains filtered or unexported fields
}
FormOperations handles common form operations
func NewFormOperations ¶
func NewFormOperations(formService form.Service, logger logging.Logger) *FormOperations
NewFormOperations creates a new form operations service
func (*FormOperations) CreateDefaultSchema ¶
func (o *FormOperations) CreateDefaultSchema() form.JSON
CreateDefaultSchema creates a default form schema
func (*FormOperations) EnsureFormOwnership ¶
func (o *FormOperations) EnsureFormOwnership( c echo.Context, currentUser *user.User, formID string, ) (*form.Form, error)
EnsureFormOwnership checks if the user owns the form
func (*FormOperations) UpdateFormDetails ¶
func (o *FormOperations) UpdateFormDetails(formObj *form.Form, formData *FormData)
UpdateFormDetails updates a form's basic details
func (*FormOperations) ValidateAndBindFormData ¶
func (o *FormOperations) ValidateAndBindFormData(c echo.Context) (*FormData, error)
ValidateAndBindFormData validates and binds form data from the request
type PageDataService ¶
type PageDataService struct {
// contains filtered or unexported fields
}
PageDataService handles template data preparation
func NewPageDataService ¶
func NewPageDataService(logger logging.Logger) *PageDataService
NewPageDataService creates a new page data service
func (*PageDataService) PrepareDashboardData ¶
func (s *PageDataService) PrepareDashboardData( c echo.Context, currentUser *user.User, forms []*form.Form, ) shared.PageData
PrepareDashboardData prepares data for the dashboard page
func (*PageDataService) PrepareFormData ¶
func (s *PageDataService) PrepareFormData( c echo.Context, currentUser *user.User, formObj *form.Form, submissions []*model.FormSubmission, ) shared.PageData
PrepareFormData prepares data for form-related pages
func (*PageDataService) PrepareNewFormData ¶
func (s *PageDataService) PrepareNewFormData(c echo.Context, currentUser *user.User) shared.PageData
PrepareNewFormData prepares data for the new form page
type ResponseBuilder ¶
type ResponseBuilder struct {
// contains filtered or unexported fields
}
ResponseBuilder handles consistent response building
func NewResponseBuilder ¶
func NewResponseBuilder(logger logging.Logger) *ResponseBuilder
NewResponseBuilder creates a new response builder
func (*ResponseBuilder) BuildErrorResponse ¶
func (b *ResponseBuilder) BuildErrorResponse(c echo.Context, err error, status int, message string) error
BuildErrorResponse builds an error response with the given error, status code, and message
func (*ResponseBuilder) BuildForbiddenResponse ¶
func (b *ResponseBuilder) BuildForbiddenResponse(c echo.Context, message string) error
BuildForbiddenResponse builds a forbidden error response
func (*ResponseBuilder) BuildHTMLResponse ¶
func (b *ResponseBuilder) BuildHTMLResponse(c echo.Context, template string, data any, status int) error
BuildHTMLResponse builds an HTML response with the given template and data
func (*ResponseBuilder) BuildJSONResponse ¶
BuildJSONResponse builds a JSON response with the given data and status code
func (*ResponseBuilder) BuildNoContentResponse ¶
func (b *ResponseBuilder) BuildNoContentResponse(c echo.Context, status int) error
BuildNoContentResponse builds a response with no content and the specified status code
func (*ResponseBuilder) BuildNotFoundResponse ¶
func (b *ResponseBuilder) BuildNotFoundResponse(c echo.Context, message string) error
BuildNotFoundResponse builds a not found error response
func (*ResponseBuilder) BuildRedirectResponse ¶
BuildRedirectResponse builds a redirect response to the given path with the specified status code
func (*ResponseBuilder) BuildValidationErrorResponse ¶
func (b *ResponseBuilder) BuildValidationErrorResponse(c echo.Context, err error) error
BuildValidationErrorResponse builds a validation error response
type TemplateService ¶
type TemplateService struct {
// contains filtered or unexported fields
}
TemplateService handles template rendering
func NewTemplateService ¶
func NewTemplateService(logger logging.Logger) *TemplateService
NewTemplateService creates a new template service
func (*TemplateService) RenderDashboard ¶
RenderDashboard renders the dashboard page
func (*TemplateService) RenderEditForm ¶
RenderEditForm renders the edit form page
func (*TemplateService) RenderFormSubmissions ¶
func (s *TemplateService) RenderFormSubmissions( c echo.Context, formObj *form.Form, submissions []*model.FormSubmission, ) error
RenderFormSubmissions renders the form submissions page
func (*TemplateService) RenderNewForm ¶
RenderNewForm renders the new form page