domain

package
v0.0.0-...-00178ea Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Member

type Member struct {
	ID           uint       `gorm:"primaryKey;autoIncrement" json:"id"`   // 기본 키
	MemberNumber string     `gorm:"unique;not null" json:"member_number"` // 회원번호
	AccountId    string     `gorm:"unique;not null" json:"account_id"`    // 아이디
	Password     string     `gorm:"not null" json:"password"`             // 패스워드 (해싱 처리)
	NickName     string     `gorm:"not null" json:"nick_name"`            // 회원명
	Email        string     `gorm:"unique;not null" json:"email"`         // 이메일
	CreatedAt    time.Time  `gorm:"autoCreateTime" json:"created_at"`     // 가입일
	IsAdmin      bool       `gorm:"default:false" json:"is_admin"`        // 관리자 여부
	IsWithdrawn  bool       `gorm:"default:false" json:"is_withdrawn"`    // 탈퇴 여부
	WithdrawnAt  *time.Time `gorm:"index" json:"withdrawn_at,omitempty"`  // 탈퇴일
}

func (*Member) AssignPassword

func (m *Member) AssignPassword(password string) error

func (*Member) CheckPassword

func (m *Member) CheckPassword(password string) bool

func (*Member) Validate

func (m *Member) Validate() error

type Order

type Order struct {
	ID            int        `gorm:"primaryKey;autoIncrement" json:"id"`  // 기본 키
	OrderNumber   string     `gorm:"unique;not null" json:"order_number"` // 주문번호
	OrderDate     time.Time  `gorm:"not null" json:"order_date"`          // 주문일
	MemberNumber  string     `gorm:"not null" json:"member_number"`       // 회원번호
	ProductNumber string     `gorm:"not null" json:"product_number"`      // 상품번호
	Price         int64      `gorm:"not null" json:"price"`               // 가격
	Quantity      int        `gorm:"not null" json:"quantity"`            // 수량
	TotalAmount   int64      `gorm:"not null" json:"total_amount"`        // 금액
	IsCanceled    bool       `gorm:"default:false" json:"is_canceled"`    // 취소여부
	CanceledAt    *time.Time `json:"canceled_at,omitempty"`               // 취소일
}

func (*Order) Cancel

func (o *Order) Cancel() error

func (*Order) Validate

func (o *Order) Validate() error

type Product

type Product struct {
	ID            int    `gorm:"primaryKey;autoIncrement" json:"id"`                           // 기본 키
	ProductNumber string `gorm:"unique;not null" json:"product_number"`                        // 상품번호
	ProductName   string `gorm:"not null;index:idx_category_product_name" json:"product_name"` // 상품명
	Category      string `gorm:"index:idx_category_product_name" json:"category"`              // 카테고리
	Price         int64  `gorm:"not null" json:"price"`                                        // 가격
	StockQuantity int    `gorm:"not null" json:"stock_quantity"`                               // 재고수량
}

func (*Product) CanBeDeleted

func (p *Product) CanBeDeleted(db *gorm.DB) (bool, error)

func (*Product) UpdateStock

func (p *Product) UpdateStock(quantity int) error

func (*Product) Validate

func (p *Product) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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