bundleapp

package
v0.0.0-...-f69d383 Latest Latest
Warning

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

Go to latest
Published: May 31, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package bundleapp maintains the app layer api for the bundle domain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Routes

func Routes(app *web.App, cfg Config)

Routes adds specific routes for this group.

Types

type Bundle

type Bundle struct {
	ID          string `json:"id"`
	UserID      string `json:"userID"`
	Type        string `json:"type"`
	Metadata    string `json:"metadata"`
	DateCreated string `json:"dateCreated"`
	DateUpdated string `json:"dateUpdated"`
}

============================================================================= Bundle defines the data needed to add a new bundle.

func (Bundle) Encode

func (app Bundle) Encode() ([]byte, string, error)

Encode implements the encoder interface.

type BundleTx

type BundleTx struct {
	Bundle Bundle
	Key    Key
}

BundleTx defines the data needed associated with a bundle transaction.

func (BundleTx) Encode

func (app BundleTx) Encode() ([]byte, string, error)

Encode implements the encoder interface.

type Config

type Config struct {
	Log        *logger.Logger
	DB         *sqlx.DB
	UserBus    *userbus.Business
	KeyBus     *keybus.Business
	BundleBus  *bundlebus.Business
	AuthClient *authclient.Client
}

Config contains all the mandatory systems required by handlers.

type Key

type Key struct {
	ID          string `json:"id"`
	UserID      string `json:"userID"`
	Data        string `json:"data"`
	DateCreated string `json:"dateCreated"`
	DateUpdated string `json:"dateUpdated"`
}

Key represents an individual key.

func (Key) Encode

func (app Key) Encode() ([]byte, string, error)

Encode implements the encoder interface.

type NewBundle

type NewBundle struct {
	Type     string `json:"type" validate:"required"`
	Metadata string `json:"metadata" validate:"required"`
}

NewBundle defines the data needed to add a new bundle.

func (*NewBundle) Decode

func (app *NewBundle) Decode(data []byte) error

Decode implements the decoder interface.

func (NewBundle) Validate

func (app NewBundle) Validate() error

Validate checks if the data in the model is considered clean.

type NewBundleTx

type NewBundleTx struct {
	Bundle NewBundle `json:"bundle" validate:"required"`
	Key    NewKey    `json:"key" validate:"required"`
}

NewBundleTx represents an example of cross domain transaction at the application layer.

func (*NewBundleTx) Decode

func (app *NewBundleTx) Decode(data []byte) error

Decode implements the decoder interface.

func (NewBundleTx) Validate

func (app NewBundleTx) Validate() error

Validate checks the data in the model is considered clean.

type NewKey

type NewKey struct {
	Data string `json:"data" validate:"required"`
}

NewKey is what we require from clients when adding a Key.

func (NewKey) Validate

func (app NewKey) Validate() error

Validate checks the data in the model is considered clean.

type NewUser

type NewUser struct {
	Name            string   `json:"name" validate:"required"`
	Email           string   `json:"email" validate:"required,email"`
	Roles           []string `json:"roles" validate:"required"`
	Department      string   `json:"department"`
	Password        string   `json:"password" validate:"required"`
	PasswordConfirm string   `json:"passwordConfirm" validate:"eqfield=Password"`
}

============================================================================= NewUser contains information needed to create a new user.

func (NewUser) Validate

func (app NewUser) Validate() error

Validate checks the data in the model is considered clean.

type UpdateBundle

type UpdateBundle struct {
	Type     *string `json:"type"` // TODO may not want to allow updating bundle type 🤔
	Metadata *string `json:"metadata"`
}

UpdateBundle defines the data needed to update a bundle.

func (*UpdateBundle) Decode

func (app *UpdateBundle) Decode(data []byte) error

Decode implements the decoder interface.

func (UpdateBundle) Validate

func (app UpdateBundle) Validate() error

Validate checks the data in the model is considered clean.

Jump to

Keyboard shortcuts

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