handlers

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2025 License: BSD-3-Clause Imports: 46 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminRequired

func AdminRequired(c *fiber.Ctx) error

AdminRequired is a middleware that requires a user to be an admin.

func AuthRequired

func AuthRequired(c *fiber.Ctx) error

AuthRequired is a middleware that requires a user to be logged in.

func BuildAdFromForm

func BuildAdFromForm(c *fiber.Ctx, userID int, locationID int, adID ...int) (ad.Ad, []*multipart.FileHeader, []int, error)

BuildAdFromForm builds an Ad struct from form data

func CurrentUser

func CurrentUser(c *fiber.Ctx) (*user.User, error)

CurrentUser extracts the user from context, or falls back to session if not present.

func GetCurrentUser

func GetCurrentUser(c *fiber.Ctx) (*user.User, error)

func HandleAdCard added in v0.0.4

func HandleAdCard(c *fiber.Ctx) error

Handler for ad card (collapse)

func HandleAdDetail added in v0.0.4

func HandleAdDetail(c *fiber.Ctx) error

Handler for ad detail (expanded view)

func HandleAdImage added in v0.0.4

func HandleAdImage(c *fiber.Ctx) error

Handler for HTMX image carousel

func HandleAdImageSignedURL

func HandleAdImageSignedURL(c *fiber.Ctx) error

Handler to get a signed B2 download URL for all images under an ad (prefix)

func HandleAdPage added in v0.0.4

func HandleAdPage(c *fiber.Ctx) error

func HandleAdRocks added in v0.0.4

func HandleAdRocks(c *fiber.Ctx) error

HandleAdRocks displays the rock section for an ad

func HandleAdminB2Cache added in v0.0.3

func HandleAdminB2Cache(c *fiber.Ctx) error

func HandleAdminDashboard

func HandleAdminDashboard(c *fiber.Ctx) error

func HandleAdminEmbeddingCache added in v0.0.3

func HandleAdminEmbeddingCache(c *fiber.Ctx) error

func HandleAdminVehicleCache added in v0.0.5

func HandleAdminVehicleCache(c *fiber.Ctx) error

func HandleArchiveAd

func HandleArchiveAd(c *fiber.Ctx) error

func HandleBookmarkAd

func HandleBookmarkAd(c *fiber.Ctx) error

Handler to bookmark an ad

func HandleBookmarksPage added in v0.0.4

func HandleBookmarksPage(c *fiber.Ctx) error

func HandleCategories added in v0.0.3

func HandleCategories(c *fiber.Ctx) error

func HandleChangePassword

func HandleChangePassword(c *fiber.Ctx) error

func HandleClearB2Cache added in v0.0.3

func HandleClearB2Cache(c *fiber.Ctx) error

func HandleClearQueryEmbeddingCache added in v0.0.5

func HandleClearQueryEmbeddingCache(c *fiber.Ctx) error

func HandleClearSiteEmbeddingCache added in v0.0.5

func HandleClearSiteEmbeddingCache(c *fiber.Ctx) error

func HandleClearUserEmbeddingCache added in v0.0.5

func HandleClearUserEmbeddingCache(c *fiber.Ctx) error

func HandleClearVehicleCache added in v0.0.5

func HandleClearVehicleCache(c *fiber.Ctx) error

func HandleCollapseConversation added in v0.0.4

func HandleCollapseConversation(c *fiber.Ctx) error

HandleCollapseConversation handles collapsing a conversation back to the list view

func HandleDeleteAccount

func HandleDeleteAccount(c *fiber.Ctx) error

func HandleDeleteAd

func HandleDeleteAd(c *fiber.Ctx) error

Add this handler for deleting an ad

func HandleEditAd

func HandleEditAd(c *fiber.Ctx) error

func HandleEditAdPartial

func HandleEditAdPartial(c *fiber.Ctx) error

Handler for ad edit partial (inline edit)

func HandleEngines

func HandleEngines(c *fiber.Ctx) error

func HandleExpandConversation added in v0.0.4

func HandleExpandConversation(c *fiber.Ctx) error

HandleExpandConversation handles expanding a conversation in-place

func HandleGridView

func HandleGridView(c *fiber.Ctx) error

func HandleHome

func HandleHome(c *fiber.Ctx) error

func HandleListView

func HandleListView(c *fiber.Ctx) error

func HandleLogin

func HandleLogin(c *fiber.Ctx) error

func HandleLoginSubmission

func HandleLoginSubmission(c *fiber.Ctx) error

func HandleLogout

func HandleLogout(c *fiber.Ctx) error

func HandleMakes

func HandleMakes(c *fiber.Ctx) error

func HandleMapView

func HandleMapView(c *fiber.Ctx) error

func HandleMessagesAPI added in v0.0.4

func HandleMessagesAPI(c *fiber.Ctx) error

HandleMessagesAPI handles AJAX requests for messages

func HandleMessagesPage added in v0.0.4

func HandleMessagesPage(c *fiber.Ctx) error

HandleMessagesPage handles the main messages page

func HandleModels

func HandleModels(c *fiber.Ctx) error

func HandleNewAd

func HandleNewAd(c *fiber.Ctx) error

func HandleNewAdSubmission

func HandleNewAdSubmission(c *fiber.Ctx) error

func HandleNotificationMethodChanged added in v0.0.4

func HandleNotificationMethodChanged(c *fiber.Ctx) error

HandleNotificationMethodChanged handles HTMX requests when notification method changes

func HandlePrivacyPolicy added in v0.0.3

func HandlePrivacyPolicy(c *fiber.Ctx) error

HandlePrivacyPolicy displays the Privacy Policy page

func HandleRefreshB2Cache added in v0.0.5

func HandleRefreshB2Cache(c *fiber.Ctx) error

func HandleRefreshB2Token added in v0.0.4

func HandleRefreshB2Token(c *fiber.Ctx) error

func HandleRefreshEmbeddingCache added in v0.0.5

func HandleRefreshEmbeddingCache(c *fiber.Ctx) error

func HandleRefreshVehicleCache added in v0.0.5

func HandleRefreshVehicleCache(c *fiber.Ctx) error

func HandleRegister

func HandleRegister(c *fiber.Ctx) error

func HandleRegisterSubmission

func HandleRegisterSubmission(c *fiber.Ctx) error

func HandleRegistrationStep1 added in v0.0.3

func HandleRegistrationStep1(c *fiber.Ctx) error

HandleRegistrationStep1 handles the first step of registration (collecting user info)

func HandleRegistrationStep1Submission added in v0.0.3

func HandleRegistrationStep1Submission(c *fiber.Ctx) error

HandleRegistrationStep1Submission handles the first step submission and sends SMS

func HandleRegistrationStep2Submission added in v0.0.3

func HandleRegistrationStep2Submission(c *fiber.Ctx) error

HandleRegistrationStep2Submission handles verification code submission and completes registration

func HandleRegistrationVerification added in v0.0.3

func HandleRegistrationVerification(c *fiber.Ctx) error

HandleRegistrationVerification shows the verification code input page

func HandleResolveRock added in v0.0.4

func HandleResolveRock(c *fiber.Ctx) error

HandleResolveRock resolves a rock dispute

func HandleRocksPage added in v0.0.4

func HandleRocksPage(c *fiber.Ctx) error

HandleRocksPage displays the rocks page for newly verified users

func HandleSMSWebhook added in v0.0.4

func HandleSMSWebhook(c *fiber.Ctx) error

HandleSMSWebhook processes Twilio webhook callbacks for SMS status updates

func HandleSSE added in v0.0.4

func HandleSSE(c *fiber.Ctx) error

HandleSSE handles Server-Sent Events for real-time messaging updates

func HandleSSEConversationUpdate added in v0.0.4

func HandleSSEConversationUpdate(c *fiber.Ctx) error

HandleSSEConversationUpdate handles SSE requests for updated conversation items

func HandleSearch

func HandleSearch(c *fiber.Ctx) error

func HandleSearchAPI added in v0.0.3

func HandleSearchAPI(c *fiber.Ctx) error

HandleSearchAPI returns search results as JSON for JavaScript consumption

func HandleSearchPage

func HandleSearchPage(c *fiber.Ctx) error

func HandleSendMessage added in v0.0.4

func HandleSendMessage(c *fiber.Ctx) error

HandleSendMessage handles sending a new message

func HandleSettings

func HandleSettings(c *fiber.Ctx) error

func HandleSitemap added in v0.0.5

func HandleSitemap(c *fiber.Ctx) error

func HandleStartConversation added in v0.0.4

func HandleStartConversation(c *fiber.Ctx) error

HandleStartConversation handles starting a new conversation about an ad

func HandleSubCategories added in v0.0.3

func HandleSubCategories(c *fiber.Ctx) error

func HandleTermsOfService added in v0.0.3

func HandleTermsOfService(c *fiber.Ctx) error

HandleTermsOfService displays the Terms of Service page

func HandleThrowRock added in v0.0.4

func HandleThrowRock(c *fiber.Ctx) error

HandleThrowRock handles throwing a rock at an ad

func HandleTreeCollapseBrowse added in v0.0.4

func HandleTreeCollapseBrowse(c *fiber.Ctx) error

func HandleTreeCollapseSearch added in v0.0.4

func HandleTreeCollapseSearch(c *fiber.Ctx) error

func HandleTreeExpandBrowse added in v0.0.4

func HandleTreeExpandBrowse(c *fiber.Ctx) error

func HandleTreeExpandSearch added in v0.0.4

func HandleTreeExpandSearch(c *fiber.Ctx) error

func HandleTreeView added in v0.0.4

func HandleTreeView(c *fiber.Ctx) error

func HandleUnbookmarkAd

func HandleUnbookmarkAd(c *fiber.Ctx) error

Handler to unbookmark an ad

func HandleUpdateAdSubmission

func HandleUpdateAdSubmission(c *fiber.Ctx) error

func HandleUpdateNotificationMethod added in v0.0.4

func HandleUpdateNotificationMethod(c *fiber.Ctx) error

HandleUpdateNotificationMethod updates the user's notification method preference

func HandleUserMenu added in v0.0.4

func HandleUserMenu(c *fiber.Ctx) error

func HandleViewRockConversations added in v0.0.4

func HandleViewRockConversations(c *fiber.Ctx) error

HandleViewRockConversations displays the rock conversations for an ad

func HandleYears

func HandleYears(c *fiber.Ctx) error

func OptionalAuth

func OptionalAuth(c *fiber.Ctx) error

OptionalAuth is a middleware that checks for a user but does not require one.

func ParseFormInt

func ParseFormInt(c *fiber.Ctx, fieldName string) (int, error)

ParseFormInt parses a form value as an integer with consistent error handling

func ParseIntParam

func ParseIntParam(c *fiber.Ctx, paramName string) (int, error)

ParseIntParam parses an integer parameter from the URL with consistent error handling

func RequireAdmin

func RequireAdmin(c *fiber.Ctx) (*user.User, error)

RequireAdmin extracts the user from context and checks admin status.

func RequireOwnership

func RequireOwnership(c *fiber.Ctx, resourceUserID int) (*user.User, error)

RequireOwnership checks if the current user owns the resource.

func ValidateAdForm

func ValidateAdForm(form *multipart.Form) error

ValidateAdForm validates the common ad form fields (years, models, engines, category, subcategory)

func ValidateAdFormAndReturn

func ValidateAdFormAndReturn(form *multipart.Form) (years, models, engines, categories, subcategories []string, err error)

ValidateAdFormAndReturn validates ad form and returns the values

func ValidateAndParsePrice

func ValidateAndParsePrice(c *fiber.Ctx) (float64, error)

ValidateAndParsePrice validates and parses a price field

func ValidateEmail added in v0.0.4

func ValidateEmail(email string) error

ValidateEmail validates that a string is a valid email address

func ValidateRequired

func ValidateRequired(c *fiber.Ctx, fieldName, displayName string) (string, error)

ValidateRequired validates that a required form field is not empty

func ValidateRequiredMultipart

func ValidateRequiredMultipart(form *multipart.Form, fieldName, displayName string) ([]string, error)

ValidateRequiredMultipart validates that a required multipart form field has at least one value

func ValidationErrorResponse

func ValidationErrorResponse(c *fiber.Ctx, message string) error

ValidationErrorResponse returns a validation error response

func ValidationErrorResponseWithStatus

func ValidationErrorResponseWithStatus(c *fiber.Ctx, message string, statusCode int) error

ValidationErrorResponseWithStatus returns a validation error response with custom status code

Types

type GridView added in v0.0.4

type GridView struct {
	// contains filtered or unexported fields
}

GridView implements the View interface for grid view

func NewGridView added in v0.0.4

func NewGridView(ctx *fiber.Ctx) *GridView

NewGridView creates a new grid view

func (*GridView) GetAdIDs added in v0.0.4

func (v *GridView) GetAdIDs() ([]int, string, error)

func (*GridView) RenderSearchPage added in v0.0.4

func (v *GridView) RenderSearchPage(adIDs []int, nextCursor string) error

func (*GridView) RenderSearchResults added in v0.0.4

func (v *GridView) RenderSearchResults(adIDs []int, nextCursor string) error

type ListView added in v0.0.4

type ListView struct {
	// contains filtered or unexported fields
}

ListView implements the View interface for list view

func NewListView added in v0.0.4

func NewListView(ctx *fiber.Ctx) *ListView

NewListView creates a new list view

func (*ListView) GetAdIDs added in v0.0.4

func (v *ListView) GetAdIDs() ([]int, string, error)

func (*ListView) RenderSearchPage added in v0.0.4

func (v *ListView) RenderSearchPage(adIDs []int, nextCursor string) error

func (*ListView) RenderSearchResults added in v0.0.4

func (v *ListView) RenderSearchResults(adIDs []int, nextCursor string) error

type MapView added in v0.0.4

type MapView struct {
	// contains filtered or unexported fields
}

MapView implements the View interface for map view

func NewMapView added in v0.0.4

func NewMapView(ctx *fiber.Ctx) *MapView

NewMapView creates a new map view

func (*MapView) GetAdIDs added in v0.0.4

func (v *MapView) GetAdIDs() ([]int, string, error)

func (*MapView) RenderSearchPage added in v0.0.4

func (v *MapView) RenderSearchPage(adIDs []int, nextCursor string) error

func (*MapView) RenderSearchResults added in v0.0.4

func (v *MapView) RenderSearchResults(adIDs []int, nextCursor string) error

type Sitemap added in v0.0.5

type Sitemap struct {
	XMLName xml.Name     `xml:"urlset"`
	Xmlns   string       `xml:"xmlns,attr"`
	URLs    []SitemapURL `xml:"url"`
}

type SitemapURL added in v0.0.5

type SitemapURL struct {
	Loc        string    `xml:"loc"`
	LastMod    time.Time `xml:"lastmod"`
	ChangeFreq string    `xml:"changefreq"`
	Priority   string    `xml:"priority"`
}

type TreeView

type TreeView struct {
	// contains filtered or unexported fields
}

TreeView implements the View interface for tree view

func NewTreeView added in v0.0.4

func NewTreeView(ctx *fiber.Ctx) *TreeView

NewTreeView creates a new tree view

func (*TreeView) GetAdIDs added in v0.0.4

func (v *TreeView) GetAdIDs() ([]int, string, error)

func (*TreeView) RenderSearchPage added in v0.0.4

func (v *TreeView) RenderSearchPage(adIDs []int, nextCursor string) error

func (*TreeView) RenderSearchResults added in v0.0.4

func (v *TreeView) RenderSearchResults(adIDs []int, nextCursor string) error

type View added in v0.0.4

type View interface {
	// GetAdIDs retrieves ad IDs for this view with appropriate search strategy
	GetAdIDs() ([]int, string, error)

	// RenderSearchResults renders the complete search results including container, ads, and pagination
	RenderSearchResults(adIDs []int, nextCursor string) error

	// RenderSearchPage renders just the ads and infinite scroll for pagination
	RenderSearchPage(adIDs []int, nextCursor string) error
}

View interface defines the contract for different view implementations

func NewView added in v0.0.4

func NewView(ctx *fiber.Ctx, viewType string) (View, error)

NewView creates the appropriate view implementation based on view type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL