types

package
v0.0.0-...-9d03f01 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateProductPayload

type CreateProductPayload struct {
	Name        string    `json:"name" validate:"required,max=200"`
	Description string    `json:"description" validate:"required"`
	Image       uuid.UUID `json:"image" validate:"uuid"`
	Price       int       `json:"price" validate:"required"`
	Permissions int       `json:"permission"`
}

type LoginPayload

type LoginPayload struct {
	Username string `json:"username" validate:"required,max=63"`
	Password string `json:"password" validate:"required,min=3,max=16"`
}

type Product

type Product struct {
	ID          int       `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	Image       uuid.UUID `json:"image"`
	Price       int       `json:"price"`
	Permissions int       `json:"permission"`
	CreatedAt   time.Time `json:"createdAt"`
	UpdatedAt   time.Time `json:"updatedAt"`
}

type ProductStore

type ProductStore interface {
	GetProducts() ([]Product, error)
	CreateProduct(CreateProductPayload) error
	GetProductByID(id int) (*Product, error)
	DeleteProductByID(id int) error
}

type RegisterUserPayload

type RegisterUserPayload struct {
	UUID     uuid.UUID `json:"uuid" validate:"required,uuid"`
	Username string    `json:"username" validate:"required,max=63"`
	Password string    `json:"password" validate:"required,min=3,max=16"`
}

type User

type User struct {
	ID        uuid.UUID `json:"id"`
	UUID      uuid.UUID `json:"uuid"`
	Username  string    `json:"username"`
	Password  string    `json:"-"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

type UserStore

type UserStore interface {
	GetUserByUsername(username string) (*User, error)
	GetUserByID(id uuid.UUID) (*User, error)
	GetUserByUUID(uuid uuid.UUID) (*User, error)
	CreateUser(User) error
}

Jump to

Keyboard shortcuts

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