model

package
v0.0.0-...-3393515 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 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        int64
	Name      string
	Email     string
	Password  string
	CreatedAt time.Time
	UpdatedAt sql.NullTime
}

func (*Account) GenerateClaims

func (a *Account) GenerateClaims() jwt.MapClaims

type AccountCreateRequest

type AccountCreateRequest struct {
	Name     string `json:"name" validate:"required"`
	Email    string `json:"email" validate:"required,email"`
	Password string `json:"password" validate:"required,gte=8"`
}

type AccountDeleteRequest

type AccountDeleteRequest struct {
	ID int64
}

type AccountGetRequest

type AccountGetRequest struct {
	ID int64
}

type AccountListRequest

type AccountListRequest struct {
	Limit  int
	Offset int
	Name   string
}

type AccountPasswordUpdateRequest

type AccountPasswordUpdateRequest struct {
	ID          int64  `json:"-"`
	OldPassword string `json:"old_password" validate:"required,gte=8"`
	NewPassword string `json:"new_password" validate:"required,gte=8"`
}

type AccountResponse

type AccountResponse struct {
	ID        int64      `json:"id"`
	Name      string     `json:"name"`
	Email     string     `json:"email"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt *time.Time `json:"updated_at"`
}

func NewAccountListResponse

func NewAccountListResponse(payloads []*Account) []*AccountResponse

func NewAccountResponse

func NewAccountResponse(payload *Account) *AccountResponse

type AccountUpdateRequest

type AccountUpdateRequest struct {
	ID    int64  `json:"-"`
	Name  string `json:"name" validate:"required"`
	Email string `json:"email" validate:"required,email"`
}

type AuthRequest

type AuthRequest struct {
	Email    string `json:"email" validate:"required,email"`
	Password string `json:"password" validate:"required,gte=8"`
}

type AuthResponse

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

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
}

type Post

type Post struct {
	ID        int64
	Title     string
	Body      string
	CreatedAt time.Time
	UpdatedAt sql.NullTime

	AccountID int64
	Account   Account
}

type PostCreateRequest

type PostCreateRequest struct {
	Title string `json:"title" validate:"required"`
	Body  string `json:"body" validate:"required"`
}

type PostDeleteRequest

type PostDeleteRequest struct {
	ID int64
}

type PostGetRequest

type PostGetRequest struct {
	ID int64
}

type PostListRequest

type PostListRequest struct {
	Limit  int
	Offset int
	Title  string
}

type PostResponse

type PostResponse struct {
	ID        int64      `json:"id"`
	Title     string     `json:"title"`
	Body      string     `json:"body"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt *time.Time `json:"updated_at"`

	AccountID int64            `json:"account_id"`
	Account   *AccountResponse `json:"account"`
}

func NewPostListResponse

func NewPostListResponse(payloads []*Post) []*PostResponse

func NewPostResponse

func NewPostResponse(payload *Post) *PostResponse

type PostUpdateRequest

type PostUpdateRequest struct {
	ID    int64  `json:"-"`
	Title string `json:"title" validate:"required"`
	Body  string `json:"body" validate:"required"`
}

Jump to

Keyboard shortcuts

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