models

package
v0.0.0-...-43985c0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COST = 14
)

Variables

This section is empty.

Functions

func HashPassword

func HashPassword(password string) (string, error)

Types

type Admin

type Admin struct {
	ID           primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	Email        string             `json:"email" bson:"email,omitempty"`
	FirstName    string             `json:"firstName" bson:"firstName,omitempty"`
	LastName     string             `json:"lastName" bson:"lastName,omitempty"`
	PasswordHash string             `json:"passwordHash" bson:"passwordHash,omitempty"`
	Version      int                `json:"version" bson:"version,omitempty"`
}

func NewAdmin

func NewAdmin(input *CreateAdminInput) (*Admin, error)

type AdminID

type AdminID struct {
	ID string `uri:"id" binding:"required,len=24"`
}

type CreateAdminInput

type CreateAdminInput struct {
	Email     string `json:"email" binding:"required,email"`
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
	Password  string `json:"password" binding:"required"`
	Version   int    `json:"version"`
}

type ErrorResponse

type ErrorResponse struct {
	Status  int      `json:"status"`
	Message string   `json:"message"`
	Errors  []string `json:"errors"`
}

func GenerateErrorResponse

func GenerateErrorResponse(status int, message string, errorMessages []string) *ErrorResponse

type Health

type Health struct {
	Alive bool `json:"alive"`
	Mongo bool `json:"mongo"`
}

type NewAdminResponse

type NewAdminResponse struct {
	ID string `json:"id"`
}

type NextPrevContent

type NextPrevContent struct {
	Count    int64       `json:"count,omitempty"`
	Next     string      `json:"next,omitempty"`
	Previous string      `json:"previous,omitempty"`
	Results  interface{} `json:"results"`
}

type Pagination

type Pagination struct {
	Count   int64       `json:"count"`
	Skip    int64       `json:"skip"`
	Limit   int64       `json:"limit"`
	Results interface{} `json:"results"`
}

type PaginationInput

type PaginationInput struct {
	Limit  int64  `form:"limit,default=10"  binding:"gte=1"`
	Offset int64  `form:"skip,default=0"`
	Email  string `form:"email"`
}

type Response

type Response struct {
	Status  int         `json:"status"`
	Message string      `json:"message"`
	Content interface{} `json:"content"`
}

func GenerateResponse

func GenerateResponse(status int, message string, content interface{}) *Response

func NewNextPrevResponse

func NewNextPrevResponse(status int, count int64, message, next, prev string, results interface{}) *Response

NewNextPrevResponse will create http paginated response based on next and prev

func NewResponse

func NewResponse(status int, message string, content interface{}) *Response

NewResponse is the Response struct factory function.

type UpdateAdminInput

type UpdateAdminInput struct {
	Email        string `json:"email,omitempty"`
	FirstName    string `json:"firstName,omitempty"`
	LastName     string `json:"lastName,omitempty"`
	Password     string `json:"password,omitempty"`
	PasswordHash string `json:"-"`
	Version      int    `json:"version,omitempty"`
}

Jump to

Keyboard shortcuts

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