server

package
v0.0.0-...-7fb4172 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidRequest  = errors.New("invalid request")
	ErrMustBeLoggedIn  = errors.New("please log in to your account")
	ErrValidationError = errors.New("request body contained unexpected values")
	ErrUnexpectedError = errors.New("unexpected error occurred")
)

Functions

This section is empty.

Types

type DiscoverRequest

type DiscoverRequest struct {
	MinAge  int      `json:"minAge" validate:"omitempty,min=18,max=150"`
	MaxAge  int      `json:"maxAge" validate:"omitempty,min=18,max=150"`
	Genders []string `json:"genders" validate:"dive,oneof=male female other"`
	Lat     float64  `json:"lat" validate:"required"`
	Long    float64  `json:"long" validate:"required"`
}

type DiscoverResponse

type DiscoverResponse struct {
	Results []*db.DiscoverProfile `json:"results"`
}

type LoginRequest

type LoginRequest struct {
	Username string `json:"username" validate:"required"`
	Password string `json:"password" validate:"required"`
}

type LoginResponse

type LoginResponse struct {
	Token string `json:"token"`
}

type Server

type Server struct {
	Validate  *validator.Validate
	Generator namegenerator.NameGenerator
	Store     db.ProfileStore
}

func (*Server) Start

func (s *Server) Start(addr string)

type ServerError

type ServerError struct {
	Error string `json:"error"`
}

type ServerHandler

type ServerHandler func(http.ResponseWriter, *http.Request)

type SwipeRequest

type SwipeRequest struct {
	UserId int32 `json:"user" validate:"required"`
	Liked  bool  `json:"liked"`
}

type SwipeResponse

type SwipeResponse struct {
	Matched bool `json:"matched"`
	MatchId int  `json:"matchId,omitempty"`
}

Jump to

Keyboard shortcuts

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