domain

package
v0.0.0-...-5ee6a2d Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 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 CreateTagRequest

type CreateTagRequest struct {
	Key      string `json:"key"`
	Alias    string `json:"alias"`
	Color    string `json:"color"`
	ImageUrl string `json:"image_url"`
}

type DeleteTagRequest

type DeleteTagRequest struct {
	ID uint64 `path:"id"`
}

type ErrorResponse

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

type FetchAllResponse

type FetchAllResponse struct {
	Response
	Data []TagInfo `json:"data"`
}

type FetchTagRequest

type FetchTagRequest struct {
	Page     uint64  `form:"page"`
	PageSize uint64  `form:"page_size"`
	Key      *string `form:"key"`
}

type FetchTagResponse

type FetchTagResponse struct {
	Response
	Data       []TagInfo `json:"data"`
	Pagination `json:"pagination"`
}

type GetByIDResponse

type GetByIDResponse struct {
	Response
	Data TagInfo `json:"data"`
}

type GetTagByIDRequest

type GetTagByIDRequest struct {
	ID uint64 `path:"id"`
}

type JwtCustomClaims

type JwtCustomClaims struct {
	Name string `json:"name"`
	ID   string `json:"id"`
	jwt.RegisteredClaims
}

type JwtCustomRefreshClaims

type JwtCustomRefreshClaims struct {
	ID string `json:"id"`
	jwt.RegisteredClaims
}

type LoginRequest

type LoginRequest struct {
	Email    string `form:"email" binding:"required,email"`
	Password string `form:"password" binding:"required"`
}

type LoginResponse

type LoginResponse struct {
	AccessToken  string `json:"accessToken"`
	RefreshToken string `json:"refreshToken"`
}

type LoginUsecase

type LoginUsecase interface {
	GetUserByEmail(c context.Context, email string) (User, error)
	CreateAccessToken(user *User, secret string, expiry int) (accessToken string, err error)
	CreateRefreshToken(user *User, secret string, expiry int) (refreshToken string, err error)
}

type Pagination

type Pagination struct {
	Page     uint64 `json:"page"`
	PageSize uint64 `json:"page_size"`
	Total    uint64 `json:"total"`
}

type Profile

type Profile struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

type ProfileUsecase

type ProfileUsecase interface {
	GetProfileByID(c context.Context, userID string) (*Profile, error)
}

type RefreshTokenRequest

type RefreshTokenRequest struct {
	RefreshToken string `form:"refreshToken" binding:"required"`
}

type RefreshTokenResponse

type RefreshTokenResponse struct {
	AccessToken  string `json:"accessToken"`
	RefreshToken string `json:"refreshToken"`
}

type RefreshTokenUsecase

type RefreshTokenUsecase interface {
	GetUserByID(c context.Context, id string) (User, error)
	CreateAccessToken(user *User, secret string, expiry int) (accessToken string, err error)
	CreateRefreshToken(user *User, secret string, expiry int) (refreshToken string, err error)
	ExtractIDFromToken(requestToken string, secret string) (string, error)
}

type Response

type Response struct {
	Msg  string      `json:"msg"`
	Code int         `json:"code"`
	Data interface{} `json:"data,omitempty"`
}

type SignupRequest

type SignupRequest struct {
	Name     string `form:"name" binding:"required"`
	Email    string `form:"email" binding:"required,email"`
	Password string `form:"password" binding:"required"`
}

type SignupResponse

type SignupResponse struct {
	AccessToken  string `json:"accessToken"`
	RefreshToken string `json:"refreshToken"`
}

type SignupUsecase

type SignupUsecase interface {
	Create(c context.Context, user *User) error
	GetUserByEmail(c context.Context, email string) (User, error)
	CreateAccessToken(user *User, secret string, expiry int) (accessToken string, err error)
	CreateRefreshToken(user *User, secret string, expiry int) (refreshToken string, err error)
}

type Tag

type Tag struct {
	ID        *uint64
	Key       *string
	Alias     *string
	Color     *string
	ImageUrl  *string
	CreatedAt *time.Time
	UpdateAt  *time.Time
}

type TagInfo

type TagInfo struct {
	ID        *uint64   `json:"id"`
	Key       *string   `json:"key"`
	Alias     *string   `json:"alias"`
	Color     *string   `json:"color"`
	ImageUrl  *string   `json:"image_url"`
	CreatedAt time.Time `json:"created_at"`
	UpdateAt  time.Time `json:"updated_at"`
}

type TagRepository

type TagRepository interface {
	Create(c context.Context, tag Tag) error
	Update(c context.Context, tag Tag) error
	Delete(c context.Context, tagID uint64) error
	GetByID(c context.Context, tagID uint64) (*Tag, error)
	Fetch(c context.Context, r FetchTagRequest) ([]Tag, *Pagination, error)
	FetchAll(c context.Context) ([]Tag, error)
}

type TagUsecase

type TagUsecase interface {
	Create(c context.Context, tag Tag) error
	Update(c context.Context, tag Tag) error
	Delete(c context.Context, tagID uint64) error
	GetByID(c context.Context, tagID uint64) (*Tag, error)
	Fetch(c context.Context, r FetchTagRequest) ([]Tag, *Pagination, error)
	FetchAll(c context.Context) ([]Tag, error)
}

type UpdateTagRequest

type UpdateTagRequest struct {
	ID       uint64  `json:"id"`
	Key      *string `json:"key"`
	Alias    *string `json:"alias"`
	Color    *string `json:"color"`
	ImageUrl *string `json:"image_url"`
}

type User

type User struct {
	ID       string
	Name     string
	Email    string
	Password string
}

type UserRepository

type UserRepository interface {
	Create(c context.Context, user *User) error
	GetByEmail(c context.Context, email string) (User, error)
	GetByID(c context.Context, id string) (User, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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