userapi

package
v0.0.0-...-660482d Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Street  string `json:"street,omitempty" bson:"street,omitempty"`
	City    string `json:"city,omitempty" bson:"city,omitempty"`
	State   string `json:"state,omitempty" bson:"state,omitempty"`
	Country string `json:"country,omitempty" bson:"country,omitempty"`
	Zip     string `json:"zip,omitempty" bson:"zip,omitempty"`
}

Address represents a street address

type Controller

type Controller struct {
	api.BaseController
	Repo *UsersService
}

Controller handles user API endpoints

func (*Controller) AddRoutes

func (c *Controller) AddRoutes(router *mux.Router) *mux.Router

AddRoutes registers user endpoints and handlers

type Credentials

type Credentials struct {
	Password string `json:"password"`
	Username string `json:"username"`
}

Credentials is a struct to read the username and password from the request body

type User

type User struct {
	ID        primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
	Name      string             `json:"full_name,omitempty" bson:"full_name,omitempty"`
	Mobile    string             `json:"mobile,omitempty" bson:"mobile,omitempty"`
	Age       int                `json:"age,omitempty" bson:"age,omitempty"`
	WhatsApp  string             `json:"whatsapp,omitempty" bson:"whatsapp,omitempty"`
	Email     string             `json:"email,omitempty" bson:"email,omitempty"`
	Address   Address            `json:"address,omitempty" bson:"address,omitempty"`
	Role      string             `json:"role,omitempty" bson:"role,omitempty"`
	StartDate uint32             `json:"start_date,omitempty" bson:"start_date,omitempty"`
}

User represents an app user

type UsersService

type UsersService struct {
	DAL *service.DAL
	// contains filtered or unexported fields
}

UsersService is the repositorty for API access to DB users

func (*UsersService) Load

func (u *UsersService) Load()

Load retrieves all documents from the user collection

Jump to

Keyboard shortcuts

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