history

package
v0.0.0-...-2d74652 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRepository

func NewRepository(db *sqlx.DB) *repository

Types

type GetPaginatedRequest

type GetPaginatedRequest struct {
	UserID string
	Offset uint64
	Limit  uint64
}

type Handler

type Handler interface {
	SaveVisit(c *fiber.Ctx) error
	UpdateVisit(ctx *fiber.Ctx) error
	ListHistory(ctx *fiber.Ctx) error
}

func NewHandler

func NewHandler(service Service, userSvc user.Service) Handler

type History

type History struct {
	ID           string    `db:"id"`
	Title        string    `db:"title"`
	URL          string    `db:"url"`
	UserID       string    `db:"user_id"`
	DeviceName   string    `db:"device_name"`
	LastActiveAt time.Time `db:"last_active_at"`
	CreatedAt    time.Time `db:"created_at"`
	UpdatedAt    time.Time `db:"updated_at"`
}

func (History) Columns

func (History) Columns() []string

func (History) TableName

func (History) TableName() string

type Service

type Service interface {
	SaveVisit(c *fiber.Ctx, req VisitRequest, userID string) (string, error)
	UpdateVisit(ctx *fiber.Ctx, id string) error
	ListHistory(ctx *fiber.Ctx, userID string, pageSize, pageIndex int) ([]History, error)
}

func NewService

func NewService(repo *repository) Service

type VisitRequest

type VisitRequest struct {
	UserID     string
	Title      string `json:"title" validate:"required"`
	URL        string `json:"url" validate:"required"`
	DeviceName string `json:"device_name" validate:"required"`
}

Jump to

Keyboard shortcuts

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