dto

package
v0.0.0-...-ef33383 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MESSAGE_FAILED_GET_DATA_FROM_BODY = "failed get data from body"
	MESSAGE_FAILED_VERIFY_TOKEN       = "failed to verify JWT token"
)
View Source
const (
	MESSAGE_FAILED_GET_EVENT = "failed get event"
	MESSAGE_EVENT_NOT_FOUND  = "event not found"

	MESSAGE_SUCCESS_GET_EVENT = "success get event"
)
View Source
const (
	MESSAGE_FAILED_CREATE_LINK_SHORTENER = "failed create link shortener"
	MESSAGE_FAILED_GET_LINK_SHORTENER    = "failed get link shortener"

	MESSAGE_SUCCESS_CREATE_LINK_SHORTENER = "success create link shortener"
	MESSAGE_SUCCESS_GET_LINK_SHORTENER    = "success get link shortener"
)
View Source
const (
	// failed
	MESSAGE_FAILED_CREATE_TICKET   = "failed create ticket"
	MESSAGE_FAILED_GET_TICKET      = "failed get ticket"
	MESSAGE_FAILED_CONFIRM_PAYMENT = "failed confirm payment"
	MESSAGE_FAILED_CHECK_IN        = "failed check in"

	// success
	MESSAGE_SUCCESS_CREATE_TICKET   = "success create ticket"
	MESSAGE_SUCCESS_GET_TICKET      = "success get ticket"
	MESSAGE_SUCCESS_CONFIRM_PAYMENT = "success confirm payment"
	MESSAGE_SUCCESS_CHECK_IN        = "success check in"

	MAIN_EVENT_CLOSED = "closed"
	MAIN_EVENT_OPEN   = "open"
	MAIN_EVENT_FULL   = "full"
)
View Source
const (
	// Failed
	MESSAGE_FAILED_EVENT = "failed get event"

	// Success
	MESSAGE_SUCCESS_EVENT = "success get event"
)
View Source
const (
	MESSAGE_FAILED_GET_PE3_STATUS  = "Failed to get pre-Event 3 status"
	MESSAGE_SUCCESS_GET_PE3_STATUS = "Successfully get pre-Event 3 status"
)
View Source
const (
	MESSAGE_FAILED_GET_FILE = "failed get file"

	MESSAGE_SUCCESS_GET_FILE = "success get file"

	ENUM_STORAGE_FOLDER_MAIN_EVENT = "main-event"
	ENUM_FILE_TYPE_JPEG            = "image/jpeg"
	ENUM_FILE_TYPE_PNG             = "image/png"

	STORAGE_ENDPOINT_MAIN_EVENT = "/storage/main-event/"

	MB = 1 << 20
)
View Source
const (
	// Failed
	MESSAGE_FAILED_REGISTER_USER             = "failed create user"
	MESSAGE_FAILED_GET_USER                  = "failed get user"
	MESSAGE_FAILED_LOGIN                     = "failed login"
	MESSAGE_FAILED_UPDATE_USER               = "failed update user"
	MESSAGE_FAILED_VERIFY_USER               = "failed verify user"
	MESSAGE_FAILED_RESEND_VERIFY_EMAIL       = "failed resend verify email"
	MESSAGE_FAILED_RESET_PASSWORD            = "failed reset password"
	MESSAGE_FAILED_SEND_RESET_PASSWORD_EMAIL = "failed send reset password email"

	// Success
	MESSAGE_SUCCESS_REGISTER_USER             = "success create user. Please verify your email to activate your account"
	MESSAGE_SUCCESS_GET_USER                  = "success get user"
	MESSAGE_SUCCESS_LOGIN                     = "success login"
	MESSAGE_SUCCESS_UPDATE_USER               = "success update user"
	MESSAGE_SUCCESS_VERIFY_USER               = "success verify user"
	MESSAGE_SUCCESS_RESEND_VERIFY_EMAIL       = "success resend verify email"
	MESSAGE_SUCCESS_RESET_PASSWORD            = "success reset password"
	MESSAGE_SUCCESS_SEND_RESET_PASSWORD_EMAIL = "success send reset password email"
)

Variables

View Source
var (
	ErrTokenInvalid  = errors.New("token invalid")
	ErrTokenExpired  = errors.New("token expired")
	ErrTokenNotFound = errors.New("token not found")
)
View Source
var (
	ErrFailedToFetch = errors.New("failed to fetch event")
	ErrEventNotFound = errors.New("event not found")
)
View Source
var (
	ErrLinkFormatInvalid   = errors.New("link format should start with http:// or https://")
	ErrCreateLinkShortener = errors.New("failed to create link shortener")
	ErrAliasHasBeenTaken   = errors.New("alias has been taken")
	ErrAliasNotFound       = errors.New("alias not found")
)
View Source
var (
	ErrUserNotInTransaction     = errors.New("user not in transaction")
	ErrFailedToStorePaymentFile = errors.New("failed to store payment file")
	ErrMainEventFull            = errors.New("main event full")
	ErrMainEventNotYetOpen      = errors.New("main event not yet open")
	ErrMainEventClosed          = errors.New("main event closed")
	ErrMismatchData             = errors.New("mismatch data")
	ErrOpeningPaymentFile       = errors.New("failed to open payment file")
	ErrFailedToDownloadFile     = errors.New("failed to download file")
	ErrMaxFileSize5MB           = errors.New("max file size is 5MB")
	ErrFileMustBeImage          = errors.New("file must be an image (jpg/jpeg/png)")
	ErrFileNotFound             = errors.New("file not found")
)
View Source
var (
	ErrCreateTicket           = errors.New("failed to create ticket")
	ErrPE2RSVPNotOpen         = errors.New("pre event 2 RSVP is not yet open")
	ErrPE2RSVPClosed          = errors.New("pre event 2 RSVP is closed")
	ErrPE2RSVPFull            = errors.New("pre event 2 RSVP is full")
	ErrPE2RSVPEmailRegistered = errors.New("email already registered")
	ErrTicketNotFound         = errors.New("ticket not found")
)
View Source
var (
	ErrPreEvent3NotYetOpen = errors.New("pre-Event 3 registration is not yet open")
	ErrPreEvent3Closed     = errors.New("pre-Event 3 registration is closed")
)
View Source
var (
	ErrRoleNotAllowed               = errors.New("denied access for \"%v\" role")
	ErrCreateUser                   = errors.New("failed to create user")
	ErrGetUserById                  = errors.New("failed to get user by id")
	ErrEmailAlreadyExists           = errors.New("email already exist")
	ErrUpdateUser                   = errors.New("failed to update user")
	ErrUserNotFound                 = errors.New("user not found")
	ErrCredentialsNotMatched        = errors.New("credentials not matched")
	ErrAccountNotVerified           = errors.New("account not verified")
	ErrEmailFormatInvalid           = errors.New("email format invalid")
	ErrAccountAlreadyVerified       = errors.New("account already verified")
	ErrGenerateVerificationEmail    = errors.New("failed to generate verification email")
	ErrSendEmail                    = errors.New("failed to send email")
	ErrDecryptToken                 = errors.New("failed to decrypt token")
	ErrVerifyEmail                  = errors.New("failed to verify email")
	ErrInvalidToken                 = errors.New("invalid token")
	ErrHashPassword                 = errors.New("failed to hash password")
	ErrGenerateResetPasswordEmail   = errors.New("failed to generate reset password email")
	ErrAdminNotAllowedResetPassword = errors.New("admin not allowed to reset password")
)

Functions

This section is empty.

Types

type EventResponse

type EventResponse struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	Price       int       `json:"price"`
	Capacity    int       `json:"capacity,omitempty"`
	Registers   int       `json:"registers,omitempty"`
	StartDate   time.Time `json:"start_date"`
	EndDate     time.Time `json:"end_date"`
}

type LinkShortenerPaginationResponse

type LinkShortenerPaginationResponse struct {
	Data []LinkShortenerResponse `json:"data"`
	PaginationMetadata
}

type LinkShortenerRequest

type LinkShortenerRequest struct {
	Alias string `json:"alias" form:"alias" binding:"required"`
	Link  string `json:"link" form:"link" binding:"required"`
}

type LinkShortenerResponse

type LinkShortenerResponse struct {
	ID    string `json:"id,omitempty"`
	Alias string `json:"alias"`
	Link  string `json:"link"`
}

type MainEventCheckInRequest

type MainEventCheckInRequest struct {
	Code string `json:"code" form:"code" binding:"required"`
}

type MainEventConfirmPaymentRequest

type MainEventConfirmPaymentRequest struct {
	Code string `json:"code" form:"code" binding:"required"`
}

type MainEventPaginationData

type MainEventPaginationData struct {
	ID        string `json:"id" form:"id"`
	Name      string `json:"name" form:"name"`
	Email     string `json:"email" form:"email"`
	Confirmed bool   `json:"confirmed" form:"confirmed"`
	CheckedIn bool   `json:"checked_in" form:"checked_in"`
	EventName string `json:"event_name" form:"event_name"`
	Price     int    `json:"price" form:"price"`
}

type MainEventRegister

type MainEventRegister struct {
	EventID     string                `json:"event_id" form:"event_id" binding:"required"`
	Handphone   string                `json:"handphone" form:"handphone" binding:"required"`
	Birthdate   time.Time             `json:"birthdate" form:"birthdate" binding:"required"`
	PaymentFile *multipart.FileHeader `json:"payment_file" form:"payment_file" binding:"required"`
}

type MainEventResponse

type MainEventResponse struct {
	ID        string `json:"id" form:"id"`
	Name      string `json:"name" form:"name"`
	Email     string `json:"email" form:"email"`
	Confirmed bool   `json:"confirmed" form:"confirmed"`
	CheckedIn bool   `json:"checked_in" form:"checked_in"`
	EventName string `json:"event_name" form:"event_name"`
	Price     int    `json:"price" form:"price"`

	Handphone    string    `json:"handphone" form:"handphone"`
	Birthdate    time.Time `json:"birthdate" form:"birthdate"`
	Seat         string    `json:"seat" form:"seat"`
	Payment      string    `json:"payment" form:"payment"`
	WithKit      bool      `json:"with_kit" form:"with_kit"`
	RegisterDate time.Time `json:"registerdate" form:"registerdate"`
}

type MainEventStatusDetail

type MainEventStatusDetail struct {
	Status      string        `json:"status"`
	NoMerchID   string        `json:"no_merch_id"`
	WithMerchID string        `json:"with_merch_id"`
	UntilOpen   RemainingTime `json:"until_open"`
	UntilClosed RemainingTime `json:"until_closed"`
}

type MainEventStatusResponse

type MainEventStatusResponse struct {
	EarlyBird MainEventStatusDetail `json:"early_bird"`
	PreSale   MainEventStatusDetail `json:"pre_sale"`
	Normal    MainEventStatusDetail `json:"normal"`
}

type PE2RSVPCounter

type PE2RSVPCounter struct {
	Total   int64 `json:"total" form:"total"`
	Attends int64 `json:"attends" form:"attends"`
}

type PE2RSVPPaginationData

type PE2RSVPPaginationData struct {
	ID                   uuid.UUID `json:"id" form:"id"`
	Name                 string    `json:"name" form:"name"`
	Institute            string    `json:"institute" form:"institute"`
	Batch                string    `json:"batch" form:"batch"`
	WillingToCome        bool      `json:"willing_to_come" form:"willing_to_come"`
	WillingToBeContacted bool      `json:"willing_to_be_contacted" form:"willing_to_be_contacted"`
}

type PE2RSVPPaginationResponse

type PE2RSVPPaginationResponse struct {
	Data []PE2RSVPPaginationData `json:"data"`
	PaginationMetadata
}

type PE2RSVPRequest

type PE2RSVPRequest struct {
	Name       string `json:"name" form:"name" binding:"required"`
	Email      string `json:"email" form:"email" binding:"required"`
	Institute  string `json:"institute" form:"institute" binding:"required"`
	Department string `json:"department" form:"department"`
	StudentID  string `json:"student_id" form:"student_id"`
	Batch      string `json:"batch" form:"batch"`

	WillingToCome        bool   `json:"willing_to_come" form:"willing_to_come" binding:"boolean"`
	WillingToBeContacted bool   `json:"willing_to_be_contacted" form:"willing_to_be_contacted" binding:"boolean"`
	Essay                string `json:"essay" form:"essay" binding:"required"`
}

type PE2RSVPResponse

type PE2RSVPResponse struct {
	ID         uuid.UUID `json:"id" form:"id"`
	Name       string    `json:"name" form:"name"`
	Email      string    `json:"email" form:"email"`
	Institute  string    `json:"institute" form:"institute"`
	Department string    `json:"department" form:"department"`
	StudentID  string    `json:"student_id" form:"student_id"`
	Batch      string    `json:"batch" form:"batch"`

	WillingToCome        bool   `json:"willing_to_come" form:"willing_to_come"`
	WillingToBeContacted bool   `json:"willing_to_be_contacted" form:"willing_to_be_contacted"`
	Essay                string `json:"essay" form:"essay"`
}

type PE3RSVPRegister

type PE3RSVPRegister struct {
	Handphone   string                `json:"handphone" form:"handphone" binding:"required"`
	Birthdate   time.Time             `json:"birthdate" form:"birthdate" binding:"required"`
	PaymentFile *multipart.FileHeader `json:"payment_file" form:"payment_file" binding:"required"`
}

type PE3RSVPStatus

type PE3RSVPStatus struct {
	Status *bool `json:"status"`
}

type PaginationMetadata

type PaginationMetadata struct {
	Page    int   `json:"page"`
	PerPage int   `json:"per_page"`
	MaxPage int64 `json:"max_page"`
	Count   int64 `json:"count"`
}

func (*PaginationMetadata) GetLimit

func (p *PaginationMetadata) GetLimit() int

func (*PaginationMetadata) GetPage

func (p *PaginationMetadata) GetPage() int

type PaginationQuery

type PaginationQuery struct {
	Search  string `form:"search"`
	Page    int    `form:"page"`
	PerPage int    `form:"per_page"`
}

func (*PaginationQuery) GetOffset

func (p *PaginationQuery) GetOffset() int

type RemainingTime

type RemainingTime struct {
	Days    int `json:"days"`
	Hours   int `json:"hours"`
	Minutes int `json:"minutes"`
	Seconds int `json:"seconds"`
}

type TicketCounter

type TicketCounter struct {
	Total             int64 `json:"total" form:"total"`
	ConfirmedPayments int64 `json:"confirmed_payments" form:"confirmed_payments"`
	CheckedIns        int64 `json:"checked_ins" form:"checked_ins"`
}

type TicketPaginationResponse

type TicketPaginationResponse struct {
	Data []MainEventPaginationData `json:"data"`
	PaginationMetadata
}

type UserLoginRequest

type UserLoginRequest struct {
	Email    string `json:"email" form:"email" binding:"required"`
	Password string `json:"password" form:"password" binding:"required"`
}

type UserPaginationResponse

type UserPaginationResponse struct {
	Data []UserResponse `json:"data"`
	PaginationMetadata
}

type UserRequest

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

type UserResendVerifyEmailRequest

type UserResendVerifyEmailRequest struct {
	Email string `json:"email" form:"email" binding:"required"`
}

type UserResendVerifyEmailResponse

type UserResendVerifyEmailResponse struct {
	Email string `json:"email"`
}

type UserResetPasswordRequest

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

type UserResponse

type UserResponse struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	Email      string `json:"email"`
	RoleID     string `json:"role_id,omitempty"`
	Role       string `json:"role,omitempty"`
	IsVerified bool   `json:"is_verified"`
}

type UserSendResetPassworRequest

type UserSendResetPassworRequest struct {
	Email string `json:"email" form:"email" binding:"required"`
}

Jump to

Keyboard shortcuts

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