user

package
v0.0.0-...-de86307 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// InsertRequest validates Post requests for users
	InsertRequest validation.RuleSet = validation.RuleSet{
		"email":    {"required", "string", "email", "between:3,100", "unique:users"},
		"username": {"required", "string", "between:3,100", "unique:users"},
		"image":    {"nullable", "file", "image", "max:2048", "count:1"},
		"password": {"required", "string", "between:6,100", "password"},
	}

	// UpdateRequest validates Patch requests for users
	UpdateRequest validation.RuleSet = validation.RuleSet{
		"email":    {"string", "email", "between:3,100", "unique:users"},
		"username": {"string", "between:3,100", "unique:users"},
		"image":    {"nullable", "file", "image", "max:2048", "count:1"},
		"password": {"string", "between:6,100", "password"},
	}

	// LoginRequest validates user login requests
	LoginRequest validation.RuleSet = validation.RuleSet{
		"email":    {"required", "string", "email"},
		"password": {"required", "string"},
	}
)
View Source
var (
	// StoragePath the path used to store user profile pictures
	StoragePath string = ""
)

Functions

func Image

func Image(response *goyave.Response, request *goyave.Request)

Image returns the profile picture of the authenticated user. A default profile picture is sent if the user doesn't have a profile picture.

func Register

func Register(response *goyave.Response, request *goyave.Request)

Register insert a new user in the database

func Show

func Show(response *goyave.Response, request *goyave.Request)

Show returns the authenticated user

func Update

func Update(response *goyave.Response, request *goyave.Request)

Update replaces the record of the authenticated user If the profile picture is modified, the previous one is deleted.

Types

This section is empty.

Jump to

Keyboard shortcuts

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