models

package
v0.0.0-...-4733ae6 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrimaryOwner userType = "primary_owner"
	Client       userType = "client"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Name         string
	AddressLine1 string `validate:"required"`
	AddressLine2 string
	City         string `validate:"required"`
	State        string `validate:"required"`
	PostalCode   int    `validate:"required"`
	Phone        string `validate:"required"`
}

type User

type User struct {
	ID             uint      `gorm:"primaryKey;autoIncrement" swaggerignore:"true"`
	Name           string    `gorm:"size:50;not null" validate:"required"`
	Email          string    `gorm:"size:100;unique;not null" validate:"required,email"`
	Password       string    `gorm:"-" validate:"required"`
	PasswordHash   string    `gorm:"size:60;not null" swaggerignore:"true"`
	UserType       userType  `gorm:"type:user_type;not null" validate:"required"`
	CompanyName    string    `gorm:"size:100" validate:"required"`
	PrimaryOwnerID uint      `validate:"required"`
	Addresses      []Address `gorm:"type:json" swaggerignore:"true"` // Address struct for JSON serialization
	CreatedAt      int       `gorm:"autoCreateTime" swaggerignore:"true"`
	UpdatedAt      int       `gorm:"autoUpdateTime" swaggerignore:"true"`
}

User model info @Description User model to create a new user

Jump to

Keyboard shortcuts

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