server

package
v0.0.0-...-f416a30 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORS

func CORS(c *gin.Context)

func New

func New(c Config) *api

Types

type AuthResponse

type AuthResponse struct {
	Token   string `json:"token"`
	Expires int64  `json:"expires"`
}

type Claims

type Claims struct {
	Username string `json:"username"`
	jwt.RegisteredClaims
}

type CommentResponse

type CommentResponse struct {
	ID   uint   `json:"id"`
	Text string `json:"text"`
}

type Config

type Config struct {
	Debug       bool
	AuthEnabled bool
	Port        int `validate:"required"`
	TodoService *todo.Service
	DB          *gorm.DB
	Logger      log.Logger

	PrometheusExporter *prometheus.Exporter
}

type Credentials

type Credentials struct {
	Password string `json:"password"`
	Username string `json:"username"`
}

type Error

type Error struct {
	Label   string `json:"label"`
	Message string `json:"message"`
}

func (*Error) Error

func (e *Error) Error() string

type Errors

type Errors struct {
	Errors []*Error `json:"errors"`
}

type LabelResponse

type LabelResponse struct {
	ID    uint   `json:"id"`
	Text  string `json:"text"`
	Color string `json:"color"`
}

type NewComment

type NewComment struct {
	Text string `json:"text" binding:"max=2047"`
}

type NewLabel

type NewLabel struct {
	Text  string `json:"text" binding:"max=2047"`
	Color string `json:"color"`
}

type NewTodo

type NewTodo struct {
	Title   string        `json:"title" binding:"max=2047"`
	DueDate types.DueDate `json:"due_date"`
}

type TodoResponse

type TodoResponse struct {
	ID      uint   `json:"id"`
	Title   string `json:"title"`
	DueDate string `json:"due_date"`
	Done    bool   `json:"done"`
}

type TodosQuery

type TodosQuery struct {
	Limit  uint32 `form:"limit" binding:"lte=1000"`
	Offset uint32 `form:"offset"`
}

type TodosResponse

type TodosResponse struct {
	HasMore    bool           `json:"has_more"`
	TotalCount int            `json:"total_count"`
	Data       []TodoResponse `json:"data"`
}

type UpdateTodo

type UpdateTodo struct {
	NewTodo
	Done bool `json:"done"`
}

Jump to

Keyboard shortcuts

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