entities

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTagNotFound = errors.New("tag not found")

Functions

This section is empty.

Types

type Asset

type Asset struct {
	ID   int64     `form:"-"`
	Type AssetType `form:"type"`

	ParentAssetID int64    `form:"parent_asset_id"`
	Parent        *Asset   `form:"-"`
	Children      []*Asset `form:"-"`

	Status Status `form:"status"`

	Tag           string       `form:"tag"`
	Name          string       `form:"name"`
	Category      string       `form:"category"`
	Model         string       `form:"model"`
	ModelNo       string       `form:"model_no"`
	SerialNo      string       `form:"serial_no"`
	Manufacturer  string       `form:"manufacturer"`
	Notes         string       `form:"notes"`
	ImageURL      string       `form:"-"`
	ThumbnailURL  string       `form:"-"`
	WarrantyUntil time.Time    `form:"warranty_until,omitempty"`
	Quantity      uint64       `form:"quantity"`
	QuantityUnit  string       `form:"quantity_unit"`
	CustomAttrs   []CustomAttr `form:"custom_attrs"`

	CheckedOutTo int64  `form:"checked_out_to"`
	Location     string `form:"location"`
	PositionCode string `form:"position_code"`

	Purchases []*Purchase `form:"purchases"`

	PartsTotalCounter int     `form:"parts_total_counter"`
	Parts             []*Part `form:"parts"`

	Files []*File `form:"-"`

	MetaInfo MetaInfo `form:"-"`
}

func (*Asset) Labels

func (a *Asset) Labels(baseURL *url.URL, barcodeSize int) ([]Label, error)

type AssetType

type AssetType string
const (
	AssetTypeAsset      AssetType = "ASSET"
	AssetTypeComponent  AssetType = "COMPONENT"
	AssetTypeConsumable AssetType = "CONSUMABLE"
)

type Barcode

type Barcode struct {
	Size  int
	Value string
	Image image.Image
}

type Category

type Category struct {
	Name string
}

type CustomAttr

type CustomAttr struct {
	Name  string `form:"name" json:"name,omitempty"`
	Value any    `form:"value" json:"value,omitempty"`
}

type File

type File struct {
	io.Reader

	ID      int64
	AssetID int64

	Name      string
	Filetype  string
	SizeBytes int64

	PublicPath string
	FullPath   string

	Sha256 []byte

	CreatedBy int64
	CreatedAt time.Time
	UpdatedAt time.Time
}

type Label

type Label struct {
	Tag          string
	Name         string
	LocationCode string
	URL          string
	Barcode      Barcode
}

func (*Label) Image

func (l *Label) Image() ([]byte, error)

type LabelSize

type LabelSize struct {
	FontSize float64

	// Height of a single label in mm including padding.
	Height float64
	// Width of a single label in mm including padding.
	Width float64

	// VerticalPadding applied to the inside of the label in mm.
	VerticalPadding float64
	// HorizontalPadding applied to the inside of the label in mm.
	HorizontalPadding float64

	// VerticalSpacing between each label in mm.
	VerticalSpacing float64
	// HorizontalSpacing between each label in mm.
	HorizontalSpacing float64
}

type ListAssetsQuery

type ListAssetsQuery struct {
	Search *ListAssetsQuerySearch

	IDs []int64

	Page     int
	PageSize int

	OrderBy  string
	OrderDir string

	AssetType AssetType
}

type ListAssetsQuerySearch

type ListAssetsQuerySearch struct {
	Raw string

	Fields map[string]string
}

type ListCategoriesQuery

type ListCategoriesQuery struct {
	Search   string
	Page     int
	PageSize int
}

type ListCustomAttrNamesQuery

type ListCustomAttrNamesQuery struct {
	Search   string
	Page     int
	PageSize int
}

type ListLocationsQuery

type ListLocationsQuery struct {
	Search   string
	Page     int
	PageSize int
}

type ListPage

type ListPage[Item any] struct {
	Items    []Item
	Total    int
	NumPages int
	Page     int
	PageSize int
}

type ListPositionCodesQuery

type ListPositionCodesQuery struct {
	Search   string
	Page     int
	PageSize int
}

type Location

type Location struct {
	Name string
}

type Manufacturer

type Manufacturer struct {
	Name string
}

type MetaInfo

type MetaInfo struct {
	CreatedBy int64
	CreatedAt time.Time
	UpdatedAt time.Time
}

type Model

type Model struct {
	Name    string
	ModelNo string
}

type MonetaryAmount

type MonetaryAmount int64

func (MonetaryAmount) Format

func (c MonetaryAmount) Format(decimalSeparator string) string

type PageLayout

type PageLayout struct {
	// Cols per page.
	Cols int
	// Rows per page.
	Rows int

	// MarginLeft of the page in mm.
	MarginLeft float64
	// MarginTop of the page in mm.
	MarginTop float64
	// MarginRight of the page in mm.
	MarginRight float64
	// MarginBottom of the page in mm.
	MarginBottom float64
}

type PageSize

type PageSize string
const (
	PageSizeA4 PageSize = "A4"
)

type Part

type Part struct {
	ID      int64 `from:"id"`
	AssetID int64 `form:"asset_id"`

	Tag          string `form:"tag"`
	Name         string `form:"name"`
	Location     string `form:"location"`
	PositionCode string `form:"position_code"`
	Notes        string `form:"notes"`

	CreatedBy int64     `form:"-"`
	CreatedAt time.Time `form:"-"`
	UpdatedAt time.Time `form:"-"`
}

type PositionCode

type PositionCode struct {
	Code string
}

type Purchase

type Purchase struct {
	Supplier string         `form:"supplier,omitempty"`
	OrderNo  string         `form:"order_no,omitempty"`
	Date     time.Time      `form:"order_date,omitempty"`
	Amount   MonetaryAmount `form:"amount,omitempty"`
	Currency string         `form:"currency,omitempty"`
}

type Sheet

type Sheet struct {
	PageSize      PageSize
	Labels        []Label
	LabelSize     LabelSize
	PageLayout    PageLayout
	SkipNumLabels int
	PrintBorders  bool
}

func (*Sheet) Generate

func (s *Sheet) Generate() ([]byte, error)

type Status

type Status string
const (
	StatusInStorage Status = "IN_STORAGE"
	StatusInUse     Status = "IN_USE"
	StatusArchived  Status = "ARCHIVED"
)

type Supplier

type Supplier struct {
	Name string
}

type Tag

type Tag struct {
	ID        int64
	Tag       string
	InUse     bool
	CreatedAt time.Time
	UpdatedAt time.Time
}

Jump to

Keyboard shortcuts

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