models

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErrBadRequest

func IsErrBadRequest(err error) bool

func IsErrConflict

func IsErrConflict(err error) bool

func IsErrNotFound

func IsErrNotFound(err error) bool

func ParseStatusError added in v0.0.2

func ParseStatusError(err error) (int, string)

Types

type ErrPetAdoptionNotFound added in v0.0.2

type ErrPetAdoptionNotFound struct {
	PetID string
}

func (ErrPetAdoptionNotFound) Error added in v0.0.2

func (err ErrPetAdoptionNotFound) Error() string

type ErrPetNotFound

type ErrPetNotFound struct {
	ID   string
	Name string
}

func (ErrPetNotFound) Error

func (err ErrPetNotFound) Error() string

type ErrShelterAlreadyExist

type ErrShelterAlreadyExist struct {
	ID   string
	Name string
}

func (ErrShelterAlreadyExist) Error

func (err ErrShelterAlreadyExist) Error() string

type ErrShelterNotFound

type ErrShelterNotFound struct {
	ID   string
	Name string
}

func (ErrShelterNotFound) Error

func (err ErrShelterNotFound) Error() string

type ErrUserAlreadyExist

type ErrUserAlreadyExist struct {
	Username string
	Email    string
}

func (ErrUserAlreadyExist) Error

func (err ErrUserAlreadyExist) Error() string

type ErrUserNotAuthenticated

type ErrUserNotAuthenticated struct{}

func (ErrUserNotAuthenticated) Error

func (err ErrUserNotAuthenticated) Error() string

type ErrUserNotFound

type ErrUserNotFound struct {
	ID       string
	Username string
	Email    string
}

func (ErrUserNotFound) Error

func (err ErrUserNotFound) Error() string

type ErrUserPasswordMismatch

type ErrUserPasswordMismatch struct{}

func (ErrUserPasswordMismatch) Error

type Pet

type Pet struct {
	XKey           string            `json:"_key"`
	ID             string            `json:"id"`
	Name           string            `json:"name"`
	Type           PetType           `json:"type"`
	Breed          string            `json:"breed"`
	Gender         string            `json:"gender"`
	Photo          string            `json:"photo"`
	AdoptionStatus PetAdoptionStatus `json:"adoptionStatus"`

	// ShelterID will always be set, even if any user adopts it
	// AdoptionStatus will be set to adopted, if anyone adopts it
	ShelterID string `json:"shelterID"`
}

func (*Pet) APIFormat

func (pet *Pet) APIFormat() gqtypes.Pet

type PetAdoption added in v0.0.2

type PetAdoption struct {
	XKey   string `json:"_key"`
	ID     string `json:"id"`
	PetID  string `json:"petID"`
	UserID string `json:"userID"`
}

type PetAdoptionStatus

type PetAdoptionStatus int
const (
	PetAvailable PetAdoptionStatus = iota
	PetAdopted
)

func (PetAdoptionStatus) String

func (s PetAdoptionStatus) String() string

type PetType added in v0.0.2

type PetType string
const (
	PetCat PetType = "Cat"
	PetDog PetType = "Dog"
)

type Shelter

type Shelter struct {
	XKey               string `json:"_key"`
	ID                 string `json:"id"`
	Name               string `json:"name"`
	Description        string `json:"description"`
	Website            string `json:"website"`
	Location           string `json:"location"`
	ContactInformation string `json:"contactInformation"`
	NumberOfPets       int64  `json:"numberOfPets"`
	// Assuming a shelter can have only one owner
	OwnerID string `json:"ownerID"`
}

func (*Shelter) APIFormat

func (s *Shelter) APIFormat() gqtypes.Shelter

type StatusError

type StatusError struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
}

func (StatusError) Error

func (err StatusError) Error() string

type User

type User struct {
	XKey      string `json:"_key"`
	ID        string `json:"id"`
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
	Bio       string `json:"bio"`
	Location  string `json:"location"`
	Avatar    string `json:"avatar"`

	Username     string `json:"username"`
	Email        string `json:"email"`
	PasswordHash string `json:"passwordHash"`

	IsActive bool `json:"isActive"`
	IsAdmin  bool `json:"isAdmin"`

	CreatedUnix   int64 `json:"createdUnix"`
	UpdatedUnix   int64 `json:"updatedUnix"`
	LastLoginUnix int64 `json:"lastLoginUnix"`
}

func (*User) APIFormat

func (u *User) APIFormat() gqtypes.User

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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