users

package
v1.31.5-0...-ff97089 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(e *echo.Echo, cfg *config.Config, db *pg.DB, enforceAuth echo.MiddlewareFunc, nonEnforceAuth echo.MiddlewareFunc)

RegisterRoutes takes in an Echo router and registers routes onto it.

Types

type ListUsersOptions

type ListUsersOptions struct {
	Limit  *int
	Offset *int
}

type RetrieveUserOptions

type RetrieveUserOptions struct {
	Username *string
}

type Service

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

func NewService

func NewService(db *pg.DB) *Service

func (*Service) CreateUserAndDex

func (svc *Service) CreateUserAndDex(ctx context.Context, user *User, dex *dexes.Dex) error

func (*Service) ListUsers

func (svc *Service) ListUsers(ctx context.Context, opts ListUsersOptions) ([]*User, error)

func (*Service) RetrieveUser

func (svc *Service) RetrieveUser(ctx context.Context, opts RetrieveUserOptions) (*User, error)

func (*Service) UpdateUser

func (svc *Service) UpdateUser(ctx context.Context, user *User, opts UpdateUserOptions) error

type UpdateUserOptions

type UpdateUserOptions struct {
	Columns []string
}

type User

type User struct {
	ID               int          `json:"id"`
	Username         string       `json:"username"`
	FriendCode3DS    *string      `pg:"friend_code_3ds" json:"friend_code_3ds"`
	FriendCodeSwitch *string      `json:"friend_code_switch"`
	Dexes            []*dexes.Dex `pg:"rel:has-many" json:"dexes"`
	Password         string       `json:"-"`
	LastIP           *string      `json:"-"`
	LastLogin        *time.Time   `json:"-"`
	Referrer         *string      `json:"-"`
	StripeID         *string      `json:"-"`
	Donated          bool         `pg:"-" json:"donated"`
	DateCreated      time.Time    `json:"date_created"`
	DateModified     time.Time    `json:"date_modified"`
	// contains filtered or unexported fields
}

func (*User) MarshalJSON

func (u *User) MarshalJSON() ([]byte, error)

MarshalJSON is just needed for parity testing. Once we're actually using this in production, we can remove it.

Jump to

Keyboard shortcuts

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