categories

package
v0.0.1-0...-104a2d1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHTTPHandlers

func RegisterHTTPHandlers(db *pgxpool.Pool, validate *validation.Validator, tkn *jwt.Service, logger *zerolog.Logger) http.Handler

Types

type CreateCategoryRequest

type CreateCategoryRequest struct {
	Name     string     `json:"name"`
	Type     string     `json:"type"`
	ParentID *uuid.UUID `json:"parent_id,omitempty"`
	Color    string     `json:"color"`
	Icon     string     `json:"icon"`
}

Request/response structures

type Handler

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

func NewHandler

func NewHandler(validator *validation.Validator, repo Repository, logger *zerolog.Logger) *Handler

func (*Handler) CreateCategories

func (h *Handler) CreateCategories(w http.ResponseWriter, r *http.Request)

func (*Handler) DeleteCategory

func (h *Handler) DeleteCategory(w http.ResponseWriter, r *http.Request)

func (*Handler) GetCategories

func (h *Handler) GetCategories(w http.ResponseWriter, r *http.Request)

func (*Handler) UpdateCategory

func (h *Handler) UpdateCategory(w http.ResponseWriter, r *http.Request)

type Repository

type Repository interface {
	// ListCategories retrieves all categories for a specific user
	ListCategories(ctx context.Context, userID uuid.UUID) ([]repository.Category, error)
	// CreateCategory creates a new category
	CreateCategory(ctx context.Context, params repository.CreateCategoryParams) (repository.Category, error)
	// UpdateCategory updates an existing category
	UpdateCategory(ctx context.Context, params repository.UpdateCategoryParams) (repository.Category, error)
	// DeleteCategory deletes a category
	DeleteCategory(ctx context.Context, id uuid.UUID) error
}

Repository defines the interface for category data operations

func NewRepository

func NewRepository(queries *repository.Queries) Repository

NewRepository creates a new categories repository

type UpdateCategoryRequest

type UpdateCategoryRequest struct {
	Name     *string    `json:"name,omitempty"`
	ParentID *uuid.UUID `json:"parent_id,omitempty"`
	Color    *string    `json:"color,omitempty"`
	Icon     *string    `json:"icon,omitempty"`
}

Jump to

Keyboard shortcuts

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