api

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthRefresh    = "RefreshToken"
	AuthHeaderkey  = "authorization"
	AuthTypeBearer = "bearer"
	AuthPayload    = "authorization_payload"
)
View Source
const (
	Like       = "like"
	Unlike     = "unlike"
	Retweet    = "retweet"
	Unretweet  = "unretweet"
	Comment    = "comment"
	Qretweet   = "qoute-retweet"
	Unqretweet = "unqoute-retweet(Delete)"
	Posttag    = "post"
	Accountag  = "account"
)

Variables

View Source
var (
	AlphaNumCheck = regexp.MustCompile(`^[a-zA-Z0-9_\s]+$`).MatchString
	AlphaCheck    = regexp.MustCompile(`^[a-zA-Z_\s]+$`).MatchString
	NumCheckByte  = regexp.MustCompile(`^[0-9]+$`).Match
	NumCheck      = regexp.MustCompile(`^[0-9]+$`).MatchString
	StringsCheck  = regexp.MustCompile(`^[a-zA-Z0-9_\s'"?!,.&%$@-]+$`).MatchString
)

A for Allow

Functions

func ConverterParam

func ConverterParam(context echo.Context, param string) int

func GetErrorValidator

func GetErrorValidator(c echo.Context, err error, tag string) (int, error)

func ValidateAlpha

func ValidateAlpha(fullname string, min, max int) error

func ValidateAlphanum

func ValidateAlphanum(username string, min, max int) error

func ValidateEmail

func ValidateEmail(email string, min, max int) error

func ValidateError

func ValidateError(errorTag, errorString string) string

func ValidateID

func ValidateID(num int) error

func ValidateString

func ValidateString(strings string, min, max int) error

func ValidateURI

func ValidateURI[T int64 | int](context echo.Context, URIparam string) (T, error)

Types

type BasicResponse

type BasicResponse map[string]interface{}

type CommentPostResp

type CommentPostResp struct {
	PostID     uuid.UUID `json:"id"`
	Comment    string    `json:"comment"`
	SumComment int64     `json:"sum_comment"`
	LikeAT     int64     `json:"like_at"`
}

type CreateAccountsResponse

type CreateAccountsResponse struct {
	ID          int64  `json:"id"`
	Owner       string `json:"owner"`
	AccountType bool   `json:"is_private"`
	Follower    int64  `json:"follower"`
	Following   int64  `json:"following"`
	CreatedAt   int64  `json:"created_at"`
	PhototDir   string `json:"photo_dir"`
}

func AccountResponse

func AccountResponse(input db2.Account) CreateAccountsResponse

type CreatePostResponse

type CreatePostResponse struct {
	ID                 uuid.UUID           `json:"post_id"`
	PictureDescription string              `json:"picture_description"`
	PostFeature        postfeatureresponse `json:"post_feature"`
	IsRetweet          bool                `json:"is_retweet"`
	CreatedAt          int64               `json:"created_at"`
}

func PostResponse

func PostResponse(input db2.Post, input2 db2.PostFeature) CreatePostResponse

func PostResponsePointer

func PostResponsePointer(input *db2.Post, input2 db2.PostFeature) CreatePostResponse

type CreateUserResponse

type CreateUserResponse struct {
	Username  string                 `json:"username"`
	FullName  string                 `json:"full_name"`
	Email     string                 `json:"email"`
	Account   CreateAccountsResponse `json:"account"`
	CreatedAt int64                  `json:"created_at"`
}

func CreateUserResponses

func CreateUserResponses(input db2.User, input2 CreateAccountsResponse) CreateUserResponse

func UserResponse

func UserResponse(input db2.User, account db2.Account) CreateUserResponse

type FollowResponse

type FollowResponse struct {
	Follow      accountfollowresp      `json:"follow_info"`
	FromAccount CreateAccountsResponse `json:"from_account"`
	ToAccount   CreateAccountsResponse `json:"to_account"`
}

type GetPostResponses

type GetPostResponses struct {
	ID                 uuid.UUID       `json:"id"`
	PictureDescription string          `json:"picture_description"`
	PostFeature        db2.PostFeature `json:"post_feature"`
	PostComment        []commentresp   `json:"post_comment"`
	CreatedAt          int64           `json:"created_at"`
}

func GetPostResponse

func GetPostResponse(input db2.Post, input2 db2.PostFeature, comment []db2.ListCommentRow) GetPostResponses

type H

type H = map[string]interface{}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func (*Handler) AuthAccount

func (s *Handler) AuthAccount(c echo.Context) (int, *token.Payload, error)

type HandlerService

type HandlerService interface {
	Helper
}

func NewHandler

func NewHandler(store db.PostgresStore, gcpClient gcp.GCPService, redis redis.Store, config util.Config, token token.Maker, apiutil apiutil.UtilTools) HandlerService

type Helper

type Helper interface {
	AuthAccount(c echo.Context) (int, *token.Payload, error)
}

type LikePostResp

type LikePostResp struct {
	PostID  uuid.UUID `json:"id"`
	SumLike int64     `json:"like"`
	LikeAT  int64     `json:"like_at"`
}

type OwnerGetAccountResponse

type OwnerGetAccountResponse struct {
	Account      db2.Account     `json:"account"`
	QueueAccount []QueueResponse `json:"queue"`
}

func OwnerAccountResponse

func OwnerAccountResponse(Account db2.Account, Queue ...db2.ListQueueRow) OwnerGetAccountResponse

type PublicAccountResp

type PublicAccountResp struct {
	Accounts []PublicAccountResponse `json:"accounts"`
	PageInfo map[string]interface{}  `json:"page_info"`
}

func FuncPublicAccountsResp

func FuncPublicAccountsResp(input []db2.Account, pageInfo map[string]interface{}) PublicAccountResp

type PublicAccountResponse

type PublicAccountResponse struct {
	ID          int64  `json:"id"`
	Owner       string `json:"owner"`
	AccountType bool   `json:"is_private"`
	Follower    int64  `json:"follower"`
	Following   int64  `json:"following"`
	CreatedAt   int64  `json:"created_at"`
	PhotoDir    string `json:"photo_dir"`
}

func FuncPublicAccountResponse

func FuncPublicAccountResponse(input []db2.Account) []PublicAccountResponse

type QouteRetweetPostResp

type QouteRetweetPostResp struct {
	Qoute       string             `json:"qoute"`
	PostFeature CreatePostResponse `json:"post_feature"`
	RetweetAt   int64              `json:"retweet_at"`
}

type QueueResponse

type QueueResponse struct {
	Owner     string `json:"owner"`
	AccountID int64  `json:"accountid"`
}

type RetweetPostResp

type RetweetPostResp struct {
	PostID      uuid.UUID          `json:"id"`
	Postfeature CreatePostResponse `json:"post_feature"`
	RetweetAt   int64              `json:"retweet_at"`
}

type RetweetResponse

type RetweetResponse struct {
	Post    db2.Post
	Feature db2.PostFeature
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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