models

package
v0.0.0-...-f10ba98 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllModels = []interface{}{
	User{},
	UserRole{},
	Invitation{},
	Bride{},
	Groom{},
	Attachment{},
}

Functions

func SuccessResponseWithPagination

func SuccessResponseWithPagination(ctx echo.Context, data any, pagination *Pagination) error

func TranslateError

func TranslateError(err error) map[string]string

Types

type Attachment

type Attachment struct {
	ID        uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid();primaryKey"`
	TableName string    `json:"table_name"`
	TableID   string    `json:"table_id"`
	FileName  string    `json:"file_name"`
	FileSize  int       `json:"file_size"`
	FileType  string    `json:"file_type"`
	FileURL   string    `json:"file_url"`
	IsActive  bool      `json:"is_active"`
	CreatedAt time.Time
}

type AttachmentView

type AttachmentView struct {
	TableName api.TableName `json:"table_name"`
	TableID   string        `json:"table_id"`
}

type Bride

type Bride struct {
	ID     uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid();primaryKey"`
	UserID uuid.UUID `json:"user_id"`
	User   User

	Name           string `json:"name"`
	InstaID        string `json:"insta_id"`
	Address        string `json:"address"`
	FatherName     string `json:"father_name"`
	MotherName     string `json:"mother_name"`
	ChildTo        string `json:"child_to"`
	AdditionalInfo string `json:"additional_info"`
}

type BrideView

type BrideView struct {
	Name           string `json:"name"`
	InstaID        string `json:"insta_id"`
	Address        string `json:"address"`
	FatherName     string `json:"father_name"`
	MotherName     string `json:"mother_name"`
	ChildTo        string `json:"child_to"`
	AdditionalInfo string `json:"additional_info"`
}

type Confirmation

type Confirmation struct {
	ID       uuid.UUID `json:"" gorm:"type:uuid;default:gen_random_uuid();primaryKey"`
	FullName string    `json:""`
	Message  string    `json:""`
}

type Groom

type Groom struct {
	ID     uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid();primaryKey"`
	UserID uuid.UUID `json:"user_id"`
	User   User

	Name           string `json:"name"`
	InstaID        string `json:"insta_id"`
	Address        string `json:"address"`
	FatherName     string `json:"father_name"`
	MotherName     string `json:"mother_name"`
	ChildTo        string `json:"child_to"`
	AdditionalInfo string `json:"additional_info"`
}

type GroomView

type GroomView struct {
	Name           string `json:"name"`
	InstaID        string `json:"insta_id"`
	Address        string `json:"address"`
	FatherName     string `json:"father_name"`
	MotherName     string `json:"mother_name"`
	ChildTo        string `json:"child_to"`
	AdditionalInfo string `json:"additional_info"`
}

type IdModel

type IdModel struct {
	ID uuid.UUID `json:"id,omitempty" gorm:"type:uuid;default:gen_random_uuid();primaryKey"`
}

type Invitation

type Invitation struct {
	ID        uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid();primaryKey"`
	UserID    uuid.UUID `json:"user_id,omitempty"`
	User      User
	Title     string `json:"title"`
	Quotes    string `json:"quotes"`
	Moment    string `json:"moment"`
	LoveStory string `json:"lover_story"`
}

type InvitationDate

type InvitationDate struct {
	InvitationID uuid.UUID  `json:""`
	Invitation   Invitation `json:""`
	ID           uuid.UUID  `json:"" gorm:"type:uuid;default:gen_random_uuid();primaryKey"`
	EventName    string     `json:""`
	Date         time.Time  `json:""`
	Location     string     `json:""`
	MapUrl       string     `json:""`
}

type InvitationView

type InvitationView struct {
	UserID    uuid.UUID `json:"user_id"`
	Title     string    `json:"title"`
	Quotes    string    `json:"quotes"`
	Moment    string    `json:"moment"`
	LoveStory string    `json:"lover_story"`
}

type Pagination

type Pagination struct {
	CurrentPage  int   `json:"page_number"`
	TotalPage    int   `json:"total_pages"`
	Limit        int   `json:"limit"`
	CurrentCount int   `json:"current_page_total"`
	TotalCount   int64 `json:"total"`
}

type QueryParams

type QueryParams struct {
	Inactive   *bool  `json:"is_active"`
	Pagination bool   `json:"pagination"`
	Page       int    `json:"page"`
	Limit      int    `json:"limit"`
	TableName  string `json:"table_name"`
	TableId    string `json:"table_id"`
}

type RefreshTokenView

type RefreshTokenView struct {
	RefreshToken string `json:"refresh_token" validate:"required"`
}

type RoleReference

type RoleReference struct {
	ID          uuid.UUID       `json:"id"`
	Name        string          `json:"name" gorm:"unique"`
	Permissions utils.ArrayList `json:"permissions"`
}

type Speech

type Speech struct {
	ID       uuid.UUID `json:"" gorm:"type:uuid;default:gen_random_uuid();primaryKey"`
	FullName string    `json:""`
	Address  string    `json:""`
	Media    []string  `json:""`
	// contains filtered or unexported fields
}

type Token

type Token struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	Iat          int64  `json:"-"`
}

type User

type User struct {
	UserLoginAttempt
	ID                 uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid();primaryKey"`
	Phone              string    `json:"phone"`
	Email              string    `json:"email"`
	Password           string    `json:"password"`
	IsActive           bool      `json:"is_active"`
	TokenLastRevokedAt time.Time `json:"-"`
	CreatedAt          time.Time `json:"created_at"`
}

func (User) GetId

func (u User) GetId() *uuid.UUID

func (*User) GetUserRole

func (ur *User) GetUserRole(db *gorm.DB) *uuid.UUID

type UserLoginAttempt

type UserLoginAttempt struct {
	FailedAttempt  int       `json:"-"`
	LockedUntil    time.Time `json:"-"`
	LockedDuration int       `json:"-"`
}

type UserLoginView

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

type UserRole

type UserRole struct {
	IdModel
	UserId uuid.UUID     `json:"user_id"`
	User   User          `json:"user"`
	RoleId uuid.UUID     `json:"role_id"`
	Role   RoleReference `json:"role"`
}

type UserView

type UserView struct {
	Phone    string `json:"phone" validate:"required,len=13,number"`
	Email    string `json:"email" validate:"required,lowercase,email,contains=@"`
	Password string `json:"password" validate:"required"`
}

Jump to

Keyboard shortcuts

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