forms

package
v0.0.0-...-7b45942 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateCategoryForm

type CreateCategoryForm struct {
	Slug string `json:"slug" binding:"required,alphanum,max=100"`
	Name string `json:"name" binding:"required,max=100"`
}

func (*CreateCategoryForm) ToCategoryModel

func (form *CreateCategoryForm) ToCategoryModel() (model *models.CategoryModel)

func (*CreateCategoryForm) Validate

func (form *CreateCategoryForm) Validate(
	svc *service.Service,
	ctx context.Context,
) (err error)

type CreateCommentForm

type CreateCommentForm struct {
	PostUid string `json:"postUid" binding:"required,alphanum,len=24"`
	Email   string `json:"email" binding:"required,email"`
	Name    string `json:"name" binding:"required,max=50"`
	Content string `json:"content" bindinng:"required,max=255"`
	// contains filtered or unexported fields
}

func (*CreateCommentForm) ToCommentModel

func (form *CreateCommentForm) ToCommentModel() (model *models.CommentModel, err error)

func (*CreateCommentForm) Validate

func (form *CreateCommentForm) Validate(
	svc *service.Service,
	ctx context.Context,
) (post *models.PostModel, err error)

type CreateCommentReplyForm

type CreateCommentReplyForm struct {
	ParentCommentUid string `json:"commentUid" binding:"required,len=24"`
	Email            string `json:"email" binding:"required,email"`
	Name             string `json:"name" binding:"required,max=50"`
	Content          string `json:"content" binding:"required,max=255"`
	// contains filtered or unexported fields
}

func (*CreateCommentReplyForm) ToCommentReplyModel

func (form *CreateCommentReplyForm) ToCommentReplyModel() (model *models.CommentModel, err error)

func (*CreateCommentReplyForm) Validate

func (form *CreateCommentReplyForm) Validate(
	svc *service.Service,
	ctx context.Context,
) (parentComment *models.CommentModel, err error)

type CreatePageForm

type CreatePageForm struct {
	Slug       string `json:"slug" binding:"required,max=100"`
	Title      string `json:"title" binding:"required,max=100"`
	Content    string `json:"content" binding:"required"`
	PublishNow bool   `json:"publishNow" binding:"omitempty"`
}

func (*CreatePageForm) ToPageModel

func (form *CreatePageForm) ToPageModel(author *models.UserModel) (
	page *models.PageModel,
	content *models.PageContentModel,
	err error,
)

func (*CreatePageForm) Validate

func (form *CreatePageForm) Validate(
	svc *service.Service,
	ctx context.Context,
) (err error)

type CreatePostForm

type CreatePostForm struct {
	Slug               string   `json:"slug" binding:"required,alphanum,max=100"`
	Title              string   `json:"title" binding:"required,max=100"`
	Description        string   `json:"description" binding:"omitempty,max=255"`
	FeaturingImagePath string   `json:"featuringImagePath" binding:"omitempty,url"`
	Categories         []string `json:"categories" binding:"required,dive,len=24"`
	Tags               []string `json:"tags" binding:"omitempty,dive,alphanum,max=32"`
	Content            string   `json:"content" binding:"required"`
	PublishNow         bool     `json:"publishNow" binding:"omitempty"`
	// contains filtered or unexported fields
}

func (*CreatePostForm) ToPostModel

func (form *CreatePostForm) ToPostModel(author *models.UserModel) (
	post *models.PostModel,
	content *models.PostContentModel,
	err error,
)

func (*CreatePostForm) Validate

func (form *CreatePostForm) Validate(
	svc *service.Service,
	ctx context.Context,
) (err error)

type CreateUserForm

type CreateUserForm struct {
	FirstName       string `json:"firstName" binding:"max=50"`
	LastName        string `json:"lastName" binding:"max=50"`
	Username        string `json:"username" binding:"required,alphanum,min=5,max=16"`
	Email           string `json:"email" binding:"required,email"`
	Password        string `json:"password" binding:"required,min=8,max=32"`
	PasswordConfirm string `json:"passwordConfirm" binding:"required,min=8,max=32"`
	Roles           []int  `json:"roles" binding:"omitempty,dive,number"`
}

func (*CreateUserForm) ToUserModel

func (form *CreateUserForm) ToUserModel() (user *models.UserModel, err error)

func (*CreateUserForm) Validate

func (form *CreateUserForm) Validate(
	svc *service.Service,
	ctx context.Context,
	creator *models.UserModel,
) (err error)

type PasswordConfirmForm

type PasswordConfirmForm struct {
	Password string `json:"password" binding:"required"`
}

type SignInForm

type SignInForm struct {
	Username string `json:"username" binding:"required"`
	Password string `json:"password" binding:"required"`
}

type UpdateCategoryForm

type UpdateCategoryForm struct {
	Slug string `json:"slug" binding:"omitempty,max=100"`
	Name string `json:"name" binding:"omitempty,max=100"`
}

func (*UpdateCategoryForm) ToCategoryModel

func (form *UpdateCategoryForm) ToCategoryModel(
	category *models.CategoryModel,
) (updatedCategory *models.CategoryModel)

func (*UpdateCategoryForm) Validate

func (form *UpdateCategoryForm) Validate(
	svc *service.Service,
	ctx context.Context,
	target *models.CategoryModel,
) (err error)

type UpdateMeForm

type UpdateMeForm struct {
	FirstName string `json:"firstname" binding:"omitempty,max=50"`
	LastName  string `json:"lastname" binding:"omitempty,max=50"`
	Username  string `json:"username" binding:"omitempty,min=5,max=16"`
	Email     string `json:"email" binding:"omitempty,email"`
}

func (*UpdateMeForm) ToUserModel

func (form *UpdateMeForm) ToUserModel(
	me *models.UserModel,
) (updatedMe *models.UserModel)

func (*UpdateMeForm) Validate

func (form *UpdateMeForm) Validate(
	svc *service.Service,
	ctx context.Context,
	me *models.UserModel,
) (err error)

type UpdateMePasswordForm

type UpdateMePasswordForm struct {
	NewPassword        string `json:"newpassword" bind:"required,min=8,max=32"`
	NewPasswordConfirm string `json:"newpasswordconfirm" bind:"required,min=8,max=32"`
}

func (*UpdateMePasswordForm) ToUserModel

func (form *UpdateMePasswordForm) ToUserModel(
	me *models.UserModel,
) (updatedMe *models.UserModel, err error)

func (*UpdateMePasswordForm) Validate

func (form *UpdateMePasswordForm) Validate(me *models.UserModel) (err error)

type UpdatePageForm

type UpdatePageForm struct {
	Slug       string `json:"slug" binding:"omitempty,max=100"`
	Title      string `json:"title" binding:"omitempty,max=100"`
	Content    string `json:"content" binding:"omitempty"`
	PublishNow bool   `json:"publishNow" binding:"omitempty"`
}

func (*UpdatePageForm) ToPageModel

func (form *UpdatePageForm) ToPageModel(
	page *models.PageModel,
	pageContent *models.PageContentModel,
) (
	updatedPage *models.PageModel,
	updatedPageContent *models.PageContentModel,
	err error,
)

func (*UpdatePageForm) Validate

func (form *UpdatePageForm) Validate(
	svc *service.Service,
	ctx context.Context,
	page *models.PageModel,
) (err error)

type UpdatePostForm

type UpdatePostForm struct {
	Slug               string   `json:"slug" binding:"omitempty,alphanum,max=100"`
	Title              string   `json:"title" binding:"omitempty,max=100"`
	Description        string   `json:"description" binding:"omitempty,max=255"`
	FeaturingImagePath string   `json:"featuringImagePath" binding:"omitempty,url"`
	Categories         []string `json:"categories" binding:"omitempty,dive,len=24"`
	Tags               []string `json:"tags" binding:"omitempty,dive,max=32"`
	Content            string   `json:"content" binding:"omitempty"`
	PublishNow         bool     `json:"publishNow" binding:"omitempty"`
	// contains filtered or unexported fields
}

func (*UpdatePostForm) ToPostModel

func (form *UpdatePostForm) ToPostModel(
	post *models.PostModel,
	postContent *models.PostContentModel,
) (
	updatedPost *models.PostModel,
	updatedPostContent *models.PostContentModel,
	err error,
)

func (*UpdatePostForm) Validate

func (form *UpdatePostForm) Validate(
	svc *service.Service,
	ctx context.Context,
	target *models.PostModel,
) (err error)

type UpdateUserForm

type UpdateUserForm struct {
	FirstName       string `json:"firstName" binding:"omitempty,max=50"`
	LastName        string `json:"lastName" binding:"omitempty,max=50"`
	Username        string `json:"username" binding:"omitempty,alphanum,min=5,max=16"`
	Email           string `json:"email" binding:"omitempty,email"`
	Password        string `json:"password" binding:"omitempty,min=8,max=32"`
	PasswordConfirm string `json:"passwordConfirm" binding:"omitempty,min=8,max=32"`
	Roles           []int  `json:"roles" binding:"omitempty,dive,number"`
}

func (*UpdateUserForm) ToUserModel

func (form *UpdateUserForm) ToUserModel(
	user *models.UserModel,
) (updatedUser *models.UserModel, err error)

func (*UpdateUserForm) Validate

func (form *UpdateUserForm) Validate(
	svc *service.Service,
	ctx context.Context,
	creator *models.UserModel,
	target *models.UserModel,
) (err error)

Jump to

Keyboard shortcuts

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