entity

package
v0.0.0-...-cd49875 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GeneralLogFilePath = "/storage/log/general"
	WorkerLogFilePath  = "/storage/log/worker"
)
View Source
const (
	SUCCESS_CODE         = "00"
	SUCCESS_MSG          = "Success"
	INVALID_AUTH_CODE    = "01"
	INVALID_AUTH_MSG     = "Invalid Email or Password"
	INVALID_PAYLOAD_CODE = "02"
	INVALID_PAYLOAD_MSG  = "Invalid Payload Request Data"
	INVALID_TOKEN_CODE   = "05"
	INVALID_TOKEN_MSG    = "Invalid Access Token"
	BAD_REQUEST_CODE     = "30"
	BAD_REQUEST_MSG      = "Bad Request"
	DATA_NOT_FOUND_MSG   = "Data not found"
	USER_NOT_FOUND_MSG   = "User not found"

	GENERAL_ERROR_MESSAGE = "Something went wrong. Please try again later."
)
View Source
const (
	PRODUCTION_ENV = "production"
)
View Source
const (
	VALIDATE_CUSTOM_EXAMPLE = "validate_custom_example"
)

Variables

This section is empty.

Functions

func GetRoleName

func GetRoleName(role UserRole) string

Types

type CaptureFields

type CaptureFields map[string]string

type Claims

type Claims struct {
	jwt.RegisteredClaims
	UserID     int64  `json:"user_id"`
	Email      string `json:"email"`
	RoleAccess int8   `json:"role"`
}

type CreateUserReq

type CreateUserReq struct {
	Name            string `json:"name" validate:"required" name:"Nama"`
	Email           string `json:"email" validate:"required"`
	Password        string `json:"password" validate:"required"`
	ReenterPassword string `json:"reenter_password" validate:"required"`
	Phone           string `json:"phone" validate:"required" name:"Nomor Telepon"`
	RoleAccess      int8   `json:"role_access" validate:"required" name:"Hak Akses"`
}

type CreateUserResponse

type CreateUserResponse struct {
	UserID     int64  `json:"user_id"`
	Name       string `json:"name"`
	Email      string `json:"email"`
	RoleAccess string `json:"role_access"`
	Phone      string `json:"phone"`
	Token      string `json:"access_token"`
}

type CustomErrorResponse

type CustomErrorResponse struct {
	Message  string `json:"message,omitempty"`
	ErrCode  string `json:"code,omitempty"`
	HTTPCode int    `json:"http_code"`
}

type CustomErrorResponseWithMeta

type CustomErrorResponseWithMeta struct {
	Message  string          `json:"message,omitempty"`
	ErrCode  string          `json:"code,omitempty"`
	HTTPCode int             `json:"http_code"`
	Meta     []ErrorResponse `json:"meta,omitempty"`
}

type ErrorResponse

type ErrorResponse struct {
	FailedField string `json:"failed_field"`
	Tag         string `json:"tag"`
	Value       string `json:"value"`
	Message     string `json:"message"`
}

type GeneralResponse

type GeneralResponse struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

type Log

type Log struct {
	FuncName     string        `json:"func_name"`
	Message      string        `json:"message"`
	ErrorMessage string        `json:"error_message"`
	Process      string        `json:"process"`
	Status       LogType       `json:"status"`
	LogFields    CaptureFields `json:"capture_fields"`
}

func (*Log) LoadFromMap

func (c *Log) LoadFromMap(m map[string]interface{}) error

type LogType

type LogType string
const (
	LogSuccess LogType = "SUCCESS"
	LogError   LogType = "ERROR"
	LogInfo    LogType = "INFO"
	LogWarning LogType = "WARNING"
	LogDebug   LogType = "DEBUG"
)

type LoginReq

type LoginReq struct {
	Email    string `json:"email" validate:"required"`
	Password string `json:"password" validate:"required"`
}

type LoginResponse

type LoginResponse struct {
	UserID     int64  `json:"user_id"`
	Name       string `json:"name"`
	Email      string `json:"email"`
	RoleAccess int8   `json:"role_access"`
	Token      string `json:"access_token"`
}

type TodoListReq

type TodoListReq struct {
	ID          int64  `json:"id,omitempty" swaggerignore:"true"`
	UserID      int64  `json:"user_id,omitempty" validate:"required"`
	Title       string `json:"title,omitempty" validate:"required" name:"Judul"`
	Description string `json:"description" validate:"required" name:"Deskripsi"`
	DoingAt     string `json:"doing_at" validate:"required" name:"Tanggal Aktifitas"`
}

func (*TodoListReq) SetID

func (r *TodoListReq) SetID(ID int64)

func (*TodoListReq) SetUserID

func (r *TodoListReq) SetUserID(UserID int64)

type TodoListResponse

type TodoListResponse struct {
	ID          int64  `json:"id,omitempty"`
	Title       string `json:"title"`
	Description string `json:"description"`
	DoingAt     string `json:"doing_at"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
}

type UserRole

type UserRole int8
const (
	Admin UserRole = 1
	Guest UserRole = 2
)

type ValidationError

type ValidationError struct {
	Field string `json:"field"`
	Error string `json:"error"`
}

Jump to

Keyboard shortcuts

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