accounts

package
v0.0.0-...-8a3df02 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadRoutes

func LoadRoutes(r chi.Router, config config.Config, store *store.PostgresStore)

Types

type Account

type Account struct {
	CreatedAt time.Time  `db:"created_at" json:"created_at"`
	ApiToken  *string    `db:"api_token" json:"api_token"`
	UpdatedAt *time.Time `db:"updated_at" json:"updated_at"`
	Id        string     `db:"id" json:"id"`
	Name      string     `db:"name" json:"name"`
	LastName  string     `db:"lastname" json:"lastname"`
	Email     string     `db:"email" json:"email"`
	Password  string     `db:"password" json:"password"`
	Role      int        `db:"role" json:"role"`
}

type AccountHandler

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

func (AccountHandler) CreateAccount

func (s AccountHandler) CreateAccount(w http.ResponseWriter, r *http.Request) error

func (AccountHandler) GetAccountByIdHandler

func (s AccountHandler) GetAccountByIdHandler(w http.ResponseWriter, r *http.Request) error

type AccountReq

type AccountReq struct {
	*Account
}

func (*AccountReq) Bind

func (req *AccountReq) Bind(r *http.Request) error

type AccountResp

type AccountResp struct {
	*Account
	Password types.Omit `json:"password,omitempty"`
	ApiToken types.Omit `json:"api_token,omitempty"`
}

func (*AccountResp) Render

func (res *AccountResp) Render(w http.ResponseWriter, r *http.Request) error

type AccountService

type AccountService struct {
	Repository accountsRepository
}

func (*AccountService) CreateAccount

func (s *AccountService) CreateAccount(ctx context.Context, account *Account) (*Account, error)

func (*AccountService) GetAccountById

func (s *AccountService) GetAccountById(ctx context.Context, id string) (*Account, error)

type CreateAccountReq

type CreateAccountReq struct {
	Name     string `db:"name" validate:"required,min=3,max=255" json:"name"`
	LastName string `db:"lastname" validate:"required,min=3,max=255" json:"lastname"`
	Email    string `db:"email" validate:"required,email" json:"email"`
	Password string `db:"password" validate:"required,min=6,max=30,password" json:"password"`
}

func (*CreateAccountReq) Bind

func (req *CreateAccountReq) Bind(r *http.Request) error

type GetAccountByIdHandlerReq

type GetAccountByIdHandlerReq struct {
	Id string `validate:"required,uuid"`
}

type PostgresRepository

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

func GetNewAccountRepository

func GetNewAccountRepository(store *store.PostgresStore) *PostgresRepository

func (*PostgresRepository) CreateAccount

func (repo *PostgresRepository) CreateAccount(ctx context.Context, account *Account) (*Account, error)

func (*PostgresRepository) GetByID

func (repo *PostgresRepository) GetByID(ctx context.Context, id string) (*Account, error)

Jump to

Keyboard shortcuts

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