types

package
v0.0.0-...-f17982d Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Id       string `json:"id"`
	Username string `json:"username"`
	Password string `json:"-"`
	Created  string `json:"created"`
	Salt     string `json:"-"`
	IsAdmin  bool   `json:"is_admin"`
}

type AccountCreateDto

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

func (*AccountCreateDto) Validate

func (a *AccountCreateDto) Validate(ctx context.Context) map[string]string

type AccountUpdateDto

type AccountUpdateDto struct {
	NewPassword string `json:"new_password"`
	OldPassword string `json:"old_password"`
}

func (*AccountUpdateDto) Validate

func (a *AccountUpdateDto) Validate(ctx context.Context) map[string]string

type Category

type Category struct {
	Id            string
	Subcategories []Category
	Posts         []Post
	Name          string
}

type Message

type Message struct {
	StatusCode int    `json:"status_code"`
	Message    string `json:"message"`
}

type Page

type Page[T any] struct {
	Content []T          `json:"content"`
	Meta    PageMetadata `json:"meta"`
}

type PageMetadata

type PageMetadata struct {
	HasNext     bool `json:"has_next"`
	HasPrevious bool `json:"has_previous"`
	Total       int  `json:"total"`
	Size        int  `json:"size"`
}

type Post

type Post struct {
	Id       string `json:"id"`
	Title    string `json:"title"`
	Content  string `json:"content"`
	Created  string `json:"created"`
	Author   string `json:"author"`
	AuthorId string `json:"author_id"`
	Comments int    `json:"comments_count"`
}

type PostCreateDto

type PostCreateDto struct {
	Title   string `json:"title"`
	Content string `json:"content"`
}

func (*PostCreateDto) Validate

func (p *PostCreateDto) Validate(ctx context.Context) map[string]string

type PostUpdateDto

type PostUpdateDto struct {
	Title   string `json:"title"`
	Content string `json:"content"`
}

func (*PostUpdateDto) Validate

func (p *PostUpdateDto) Validate(ctx context.Context) map[string]string

type ValidationError

type ValidationError struct {
	StatusCode int               `json:"status_code"`
	Errors     map[string]string `json:"errors"`
}

Jump to

Keyboard shortcuts

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