handler

package
v0.0.0-...-3d8588d Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Animal

type Animal struct {
	ID             primitive.ObjectID   `json:"id"`
	Name           string               `json:"name"`
	Description    string               `json:"description"`
	Birthdate      time.Time            `json:"birthdate"`
	Sex            model.Sex            `json:"sex"`
	Color          string               `json:"color"`
	AdoptionStatus model.AdoptionStatus `json:"adoptionStatus"`
	Pictures       []primitive.ObjectID `json:"pictures"`
	CreationDate   time.Time            `json:"creationDate"`
	UpdateDate     time.Time            `json:"updateDate"`
}

Animal create animal reply

type AnimalHandler

type AnimalHandler interface {
	CreateAnimal(c echo.Context, req CreateAnimalRequest) (*Animal, error)
	ListAnimal(c echo.Context, req ListAnimalRequest) (*ListAnimalReply, error)
	GetAnimal(c echo.Context, req GetAnimalRequest) (*Animal, error)
	UpdateAnimal(c echo.Context, req UpdateAnimalRequest) (*Animal, error)
}

AnimalHandler animal handler

func NewAnimalHandler

func NewAnimalHandler(db *dao.DAO) AnimalHandler

NewAnimalHandler return a new animal handler

type Article

type Article struct {
	ID      primitive.ObjectID `json:"id"`
	Name    string             `json:"name"`
	Content string             `json:"content"`
	Date    time.Time          `json:"date"`
}

Article create article reply

type ArticleHandler

type ArticleHandler interface {
	CreateArticle(c echo.Context, req CreateArticleRequest) (*Article, error)
	ListArticle(c echo.Context, req ListArticleRequest) (*ListArticleReply, error)
	GetArticle(c echo.Context, req GetArticleRequest) (*Article, error)
	UpdateArticle(c echo.Context, req UpdateArticleRequest) (*Article, error)
}

ArticleHandler article handler

func NewArticleHandler

func NewArticleHandler(db *dao.DAO) ArticleHandler

NewArticleHandler return a new article handler

type AuthHandler

type AuthHandler interface {
	GetUser(c echo.Context, req GetUserRequest) (*GetUserResponse, error)

	Login(c echo.Context) (*LoginResponse, error)
	RenewSession(c echo.Context) (*RenewSessionResponse, error)
	Logout(c echo.Context, req LogoutRequest) error

	SetKey(c echo.Context, req SetKeyRequest) error
	LostPassword(c echo.Context, req LostPasswordRequest) error

	Check(c echo.Context) (*CheckResponse, error)
}

AuthHandler authentication handler

func NewAuthHandler

func NewAuthHandler(dao *dao.DAO) AuthHandler

NewAuthHandler return a new animal handler

type CheckResponse

type CheckResponse struct {
	Authenticated bool `json:"authenticated"`
}

CheckResponse check response

type CreateAnimalRequest

type CreateAnimalRequest struct {
	Name           string               `json:"name"`
	Description    string               `json:"description"`
	Birthdate      time.Time            `json:"birthdate"`
	Sex            model.Sex            `json:"sex"`
	Color          string               `json:"color"`
	AdoptionStatus model.AdoptionStatus `json:"adoptionStatus"`
	Pictures       []primitive.ObjectID `json:"pictures"`
}

CreateAnimalRequest create animal request

type CreateArticleRequest

type CreateArticleRequest struct {
	Name    string    `json:"name"`
	Content string    `json:"content"`
	Date    time.Time `json:"date"`
}

CreateArticleRequest create article request

type CreateImageRequest

type CreateImageRequest struct {
	Name string `form:"name"`
}

CreateImageRequest create image request

type CreatePageRequest

type CreatePageRequest struct {
	Name     string `json:"name"`
	Content  string `json:"content"`
	Priority int    `json:"priority"`
	Category string `json:"category"`
}

CreatePageRequest create page request

type DeleteImageRequest

type DeleteImageRequest struct {
	ID string `param:"id"`
}

DeleteImageRequest update image request

type GetAnimalRequest

type GetAnimalRequest struct {
	ID string `param:"id"`
}

GetAnimalRequest get animal request

type GetArticleRequest

type GetArticleRequest struct {
	ID string `param:"id"`
}

GetArticleRequest get article request

type GetImageRequest

type GetImageRequest struct {
	ID string `param:"id"`
}

GetImageRequest get image request

type GetPageRequest

type GetPageRequest struct {
	ID string `param:"id"`
}

GetPageRequest get page request

type GetUserRequest

type GetUserRequest struct {
	Email string `param:"email"`
}

GetUserRequest get seed request

type GetUserResponse

type GetUserResponse struct {
	ID    string `json:"id"`
	Email string `json:"email"`
	Seed  string `json:"seed"`
}

GetUserResponse get seed response

type ImageData

type ImageData struct {
	ID   primitive.ObjectID `json:"id"`
	Name string             `json:"name"`
}

ImageData create image reply

type ImageHandler

type ImageHandler interface {
	CreateImage(c echo.Context, req CreateImageRequest) (*ImageData, error)
	ListImage(c echo.Context, req ListImageRequest) (*ListImageReply, error)
	GetImage(c echo.Context, req GetImageRequest) error
	GetImageThumbnail(c echo.Context, req GetImageRequest) error
	DeleteImage(c echo.Context, req DeleteImageRequest) error
}

ImageHandler image handler

func NewImageHandler

func NewImageHandler(db *dao.DAO) ImageHandler

NewImageHandler return a new image handler

type ListAnimalReply

type ListAnimalReply struct {
	Animals []Animal `json:"animals"`
	Count   int      `json:"count"`
}

ListAnimalReply list animal reply

type ListAnimalRequest

type ListAnimalRequest struct {
	Name           *string               `query:"name"`
	Description    *string               `query:"description"`
	Birthdate      *time.Time            `query:"birthdate"`
	Sex            *model.Sex            `query:"sex"`
	Color          *string               `query:"color"`
	AdoptionStatus *model.AdoptionStatus `query:"adoptionStatus"`
	StdPaging
}

ListAnimalRequest list animal request

type ListArticleReply

type ListArticleReply struct {
	Articles []Article `json:"articles"`
	Count    int       `json:"count"`
}

ListArticleReply list article reply

type ListArticleRequest

type ListArticleRequest struct {
	Name *string `query:"name"`
	StdPaging
}

ListArticleRequest list article request

type ListImageReply

type ListImageReply struct {
	Images []ImageData `json:"images"`
	Count  int         `json:"count"`
}

ListImageReply list image reply

type ListImageRequest

type ListImageRequest struct {
	Name *string `query:"name"`
	ID   *string `query:"id"`
	StdPaging
}

ListImageRequest list image request

type ListPageReply

type ListPageReply struct {
	Pages []PageLight `json:"pages"`
	Count int         `json:"count"`
}

ListPageReply list page reply

type ListPageRequest

type ListPageRequest struct {
	Name *string `query:"name"`
	StdPaging
}

ListPageRequest list page request

type LoginResponse

type LoginResponse struct {
	SessionID string `json:"sessionId"`
	Key       string `json:"key"`
	UseBefore string `json:"useBefore"`
}

LoginResponse login response

type LogoutRequest

type LogoutRequest struct {
	Everywhere bool `query:"everywhere"`
}

LogoutRequest logout request

type LostPasswordRequest

type LostPasswordRequest struct {
	Email string `param:"email"`
}

LostPasswordRequest request a renewal password link

type Page

type Page struct {
	ID       primitive.ObjectID `json:"id"`
	Name     string             `json:"name"`
	Content  string             `json:"content"`
	Priority int                `json:"priority"`
	Category string             `json:"category"`
}

Page create page reply

type PageHandler

type PageHandler interface {
	CreatePage(c echo.Context, req CreatePageRequest) (*Page, error)
	ListPage(c echo.Context, req ListPageRequest) (*ListPageReply, error)
	GetPage(c echo.Context, req GetPageRequest) (*Page, error)
	UpdatePage(c echo.Context, req UpdatePageRequest) (*Page, error)
}

PageHandler page handler

func NewPageHandler

func NewPageHandler(db *dao.DAO) PageHandler

NewPageHandler return a new page handler

type PageLight

type PageLight struct {
	ID       primitive.ObjectID `json:"id"`
	Name     string             `json:"name"`
	Priority int                `json:"priority"`
	Category string             `json:"category"`
}

PageLight list page reply

type RenewSessionResponse

type RenewSessionResponse struct {
	SessionID string `json:"sessionId"`
	UseBefore string `json:"useBefore"`
}

RenewSessionResponse session renewal response

type SetKeyRequest

type SetKeyRequest struct {
	Email string `param:"email"`
	Key   string `json:"key"`
	Token string `json:"token" description:"token used when resetting lost password"`
}

SetKeyRequest set key request

type StdPaging

type StdPaging struct {
	Limit  *int64  `json:"limit" query:"limit"`
	Offset *int64  `json:"offset" query:"offset"`
	Sort   *string `json:"sort" query:"sort"`
}

StdPaging containt standard paging information

func (StdPaging) ToDAO

func (s StdPaging) ToDAO() paging.StdPaging

ToDAO convert paging to DAO paging

type UpdateAnimalRequest

type UpdateAnimalRequest struct {
	ID             string               `param:"id"`
	Name           string               `json:"name"`
	Description    string               `json:"description"`
	Birthdate      time.Time            `json:"birthdate"`
	Sex            model.Sex            `json:"sex"`
	Color          string               `json:"color"`
	AdoptionStatus model.AdoptionStatus `json:"adoptionStatus"`
	Pictures       []primitive.ObjectID `json:"pictures"`
}

UpdateAnimalRequest update animal request

type UpdateArticleRequest

type UpdateArticleRequest struct {
	ID      string    `param:"id"`
	Name    string    `json:"name"`
	Content string    `json:"content"`
	Date    time.Time `json:"date"`
}

UpdateArticleRequest update article request

type UpdatePageRequest

type UpdatePageRequest struct {
	ID       string `param:"id"`
	Name     string `json:"name"`
	Content  string `json:"content"`
	Priority int    `json:"priority"`
	Category string `json:"category"`
}

UpdatePageRequest update page request

Jump to

Keyboard shortcuts

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