homeapp

package
v0.0.0-...-c4114b5 Latest Latest
Warning

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

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

Documentation

Overview

Package homeapp maintains the app layer api for the home domain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Address1 string `json:"address1"`
	Address2 string `json:"address2"`
	ZipCode  string `json:"zipCode"`
	City     string `json:"city"`
	State    string `json:"state"`
	Country  string `json:"country"`
}

Address represents information about an individual address.

type App

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

App manages the set of app layer api functions for the home domain.

func NewApp

func NewApp(homeBus *homebus.Business) *App

NewApp constructs a home domain API for use.

func (*App) Create

func (a *App) Create(ctx context.Context, app NewHome) (Home, error)

Create adds a new home to the system.

func (*App) Delete

func (a *App) Delete(ctx context.Context) error

Delete removes a home from the system.

func (*App) Query

func (a *App) Query(ctx context.Context, qp QueryParams) (query.Result[Home], error)

Query returns a list of homes with paging.

func (*App) QueryByID

func (a *App) QueryByID(ctx context.Context) (Home, error)

QueryByID returns a home by its Ia.

func (*App) Update

func (a *App) Update(ctx context.Context, app UpdateHome) (Home, error)

Update updates an existing home.

type Home

type Home struct {
	ID          string  `json:"id"`
	UserID      string  `json:"userID"`
	Type        string  `json:"type"`
	Address     Address `json:"address"`
	DateCreated string  `json:"dateCreated"`
	DateUpdated string  `json:"dateUpdated"`
}

Home represents information about an individual home.

func (Home) Encode

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

Encode implments the encoder interface.

type NewAddress

type NewAddress struct {
	Address1 string `json:"address1" validate:"required,min=1,max=70"`
	Address2 string `json:"address2" validate:"omitempty,max=70"`
	ZipCode  string `json:"zipCode" validate:"required,numeric"`
	City     string `json:"city" validate:"required"`
	State    string `json:"state" validate:"required,min=1,max=48"`
	Country  string `json:"country" validate:"required,iso3166_1_alpha2"`
}

NewAddress defines the data needed to add a new address.

type NewHome

type NewHome struct {
	Type    string     `json:"type" validate:"required"`
	Address NewAddress `json:"address"`
}

NewHome defines the data needed to add a new home.

func (*NewHome) Decode

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

Decode implments the decoder interface.

func (NewHome) Validate

func (app NewHome) Validate() error

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

type QueryParams

type QueryParams struct {
	Page             string
	Rows             string
	OrderBy          string
	ID               string
	UserID           string
	Type             string
	StartCreatedDate string
	EndCreatedDate   string
}

QueryParams represents the set of possible query strings.

type UpdateAddress

type UpdateAddress struct {
	Address1 *string `json:"address1" validate:"omitempty,min=1,max=70"`
	Address2 *string `json:"address2" validate:"omitempty,max=70"`
	ZipCode  *string `json:"zipCode" validate:"omitempty,numeric"`
	City     *string `json:"city"`
	State    *string `json:"state" validate:"omitempty,min=1,max=48"`
	Country  *string `json:"country" validate:"omitempty,iso3166_1_alpha2"`
}

UpdateAddress defines the data needed to update an address.

type UpdateHome

type UpdateHome struct {
	Type    *string        `json:"type"`
	Address *UpdateAddress `json:"address"`
}

UpdateHome defines the data needed to update a home.

func (*UpdateHome) Decode

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

Decode implments the decoder interface.

func (UpdateHome) Validate

func (app UpdateHome) 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