userapp

package
v0.0.0-...-78d125d Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package userapp maintains the app layer api for the user 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 Config

type Config struct {
	Log        *logger.Logger
	UserBus    *userbus.Business
	AuthClient *authclient.Client
}

Config contains all the mandatory systems required by handlers.

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 defines the data needed to add a new user.

func (*NewUser) Decode

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

Decode implements the decoder interface.

func (NewUser) Validate

func (app NewUser) Validate() error

Validate checks the data in the model is considered clean.

type UpdateUser

type UpdateUser struct {
	Name            *string `json:"name"`
	Email           *string `json:"email" validate:"omitempty,email"`
	Department      *string `json:"department"`
	Password        *string `json:"password"`
	PasswordConfirm *string `json:"passwordConfirm" validate:"omitempty,eqfield=Password"`
	Enabled         *bool   `json:"enabled"`
}

UpdateUser defines the data needed to update a user.

func (*UpdateUser) Decode

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

Decode implements the decoder interface.

func (UpdateUser) Validate

func (app UpdateUser) Validate() error

Validate checks the data in the model is considered clean.

type UpdateUserRole

type UpdateUserRole struct {
	Roles []string `json:"roles" validate:"required"`
}

UpdateUserRole defines the data needed to update a user role.

func (*UpdateUserRole) Decode

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

Decode implements the decoder interface.

func (UpdateUserRole) Validate

func (app UpdateUserRole) Validate() error

Validate checks the data in the model is considered clean.

type User

type User struct {
	ID           string   `json:"id"`
	Name         string   `json:"name"`
	Email        string   `json:"email"`
	Roles        []string `json:"roles"`
	PasswordHash []byte   `json:"-"`
	Department   string   `json:"department"`
	Enabled      bool     `json:"enabled"`
	DateCreated  string   `json:"dateCreated"`
	DateUpdated  string   `json:"dateUpdated"`
}

User represents information about an individual user.

func (User) Encode

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

Encode implements the encoder interface.

Jump to

Keyboard shortcuts

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