model

package
v0.0.0-...-3915515 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	// Action: LOGIN, REGISTER
	Action string     `json:"action,omitempty"`
	User   *User      `json:"user,omitempty"`
	Token  *AuthToken `json:"token,omitempty"`
	// Provider: GOOGLE, DISCORD
	Provider string `json:"provider,omitempty"`
}

type AuthAccessTokenClaims

type AuthAccessTokenClaims struct {
	UserId   string `json:"user_id"`
	Username string `json:"username"`
	Role     string `json:"role"`
	Exp      int64  `json:"exp"`
}

type AuthRefreshTokenClaims

type AuthRefreshTokenClaims struct {
	UserId string `json:"user_id"`
	Exp    int64  `json:"exp"`
}

type AuthToken

type AuthToken struct {
	AccessToken  string `json:"access_token,omitempty"`
	RefreshToken string `json:"refresh_token,omitempty"`
}

type Badge

type Badge struct {
	Id          primitive.ObjectID `json:"id,omitempty" bson:"id,omitempty"`
	Slug        string             `json:"slug,omitempty" bson:"slug,omitempty"`
	Name        string             `json:"name,omitempty" bson:"name,omitempty"`
	Description string             `json:"description,omitempty" bson:"description,omitempty"`
	Icon        *string            `json:"icon,omitempty" bson:"icon,omitempty"`
	CreatedAt   *time.Time         `json:"created_at,omitempty" bson:"created_at,omitempty"`
	UpdatedAt   *time.Time         `json:"updated_at,omitempty" bson:"updated_at,omitempty"`
}

type Category

type Category struct {
	Id          primitive.ObjectID `json:"id,omitempty" bson:"id,omitempty"`
	Slug        string             `json:"slug,omitempty" bson:"slug,omitempty"`
	Name        string             `json:"name,omitempty" bson:"name,omitempty"`
	Description string             `json:"description,omitempty" bson:"description,omitempty"`
}

type Item

type Item struct {
	Id          primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
	StoreId     string             `json:"store_id,omitempty" bson:"store_id,omitempty"`
	Slug        string             `json:"slug,omitempty" bson:"slug,omitempty"`
	Name        string             `json:"name,omitempty" bson:"name,omitempty"`
	Description string             `json:"description,omitempty" bson:"description,omitempty"`
	Price       int                `json:"price,omitempty" bson:"price,omitempty"`
	Categories  []ItemCategory     `json:"categories" bson:"categories"`
	StockCount  *int               `json:"stock_count" bson:"stock_count,omitempty"`
	CreatedAt   *time.Time         `json:"created_at,omitempty" bson:"created_at,omitempty"`
	UpdatedAt   *time.Time         `json:"updated_at,omitempty" bson:"updated_at,omitempty"`
}

type ItemCategory

type ItemCategory struct {
	CategoryID string    `json:"category_id,omitempty" bson:"category_id,omitempty"`
	Category   *Category `json:"category,omitempty" bson:"-"`
}

type ItemCreate

type ItemCreate struct {
	StoreId     string         `validate:"required,mongodb" json:"store_id,omitempty" bson:"store_id,omitempty"`
	Name        string         `validate:"required,min=3" json:"name,omitempty" bson:"name,omitempty"`
	Description string         `validate:"required,min=8" json:"description,omitempty" bson:"description,omitempty"`
	Categories  []ItemCategory `json:"categories,omitempty" bson:"categories,omitempty"`
	Price       int            `validate:"required,min=1000" json:"price,omitempty" bson:"price,omitempty"`
}

type ItemFilter

type ItemFilter struct {
	Id      string `validate:"omitempty,mongodb" json:"id,omitempty" bson:"_id,omitempty"`
	StoreId string `validate:"omitempty,mongodb" json:"store_id,omitempty" bson:"store_id,omitempty"`
	Slug    string `validate:"omitempty,min=3,lowercase" json:"slug,omitempty" bson:"slug,omitempty"`
}

type ItemUpdate

type ItemUpdate struct {
	StoreId     string         `validate:"omitempty,mongodb" json:"store_id,omitempty" bson:"store_id,omitempty"`
	Slug        string         `validate:"omitempty,min=3,lowercase" json:"slug,omitempty" bson:"slug,omitempty"`
	Name        string         `validate:"omitempty,min=3" json:"name,omitempty" bson:"name,omitempty"`
	Description string         `validate:"omitempty,min=8" json:"description,omitempty" bson:"description,omitempty"`
	Categories  []ItemCategory `json:"categories,omitempty" bson:"categories,omitempty"`
	Price       int            `validate:"omitempty,min=1000" json:"price,omitempty" bson:"price,omitempty"`
}

type Mail

type Mail struct {
	From    string   `json:"from,omitempty"`
	To      []string `json:"to,omitempty"`
	Cc      *MailCc  `json:"cc,omitempty"`
	Subject string   `json:"subject,omitempty"`
	Body    string   `json:"body,omitempty"`
}

type MailCc

type MailCc struct {
	Address string `json:"address,omitempty"`
	Name    string `json:"name,omitempty"`
}

type Notification

type Notification struct {
	Title        string             `json:"title,omitempty"`
	ShortContent string             `json:"short_content,omitempty"`
	Content      string             `json:"content,omitempty"`
	Target       NotificationTarget `json:"target,omitempty"`
	CreatedAt    *time.Time         `json:"created_at,omitempty"`
}

type NotificationTarget

type NotificationTarget struct {
	Email          string `json:"email,omitempty"`
	DiscordWebhook string `json:"discord_webhook,omitempty"`
}

type Order

type Order struct {
	Id              primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
	Code            string             `json:"code,omitempty" bson:"code,omitempty"`
	StoreId         string             `json:"store_id,omitempty" bson:"store_id,omitempty"`
	Items           []OrderItem        `json:"items,omitempty" bson:"items,omitempty"`
	PaymentBankType PaymentBankType    `json:"payment_bank_type,omitempty" bson:"payment_bank_type,omitempty"`
	PaymentBankCode PaymentBankCode    `json:"payment_bank_code,omitempty" bson:"payment_bank_code,omitempty"`
	Payment         *Payment           `json:"payment,omitempty" bson:"payment,omitempty"`
	Fees            []OrderFee         `json:"fees,omitempty" bson:"fees,omitempty"`
	Customer        *OrderCustomer     `json:"customer,omitempty" bson:"customer,omitempty"`
	Subtotal        int                `json:"subtotal,omitempty" bson:"subtotal,omitempty"`
	Status          OrderStatus        `json:"status,omitempty" bson:"status,omitempty"`
	CreatedAt       *time.Time         `json:"created_at,omitempty" bson:"created_at,omitempty"`
	UpdatedAt       *time.Time         `json:"updated_at,omitempty" bson:"updated_at,omitempty"`
}

type OrderCreate

type OrderCreate struct {
	StoreId         string               `validate:"required,mongodb" json:"store_id,omitempty" bson:"store_id,omitempty"`
	Items           []OrderItem          `validate:"required,min=1" json:"items,omitempty" bson:"items,omitempty"`
	Customer        *OrderCustomerCreate `validate:"required" json:"customer,omitempty" bson:"customer,omitempty"`
	PaymentBankType PaymentBankType      `validate:"required" json:"payment_bank_type,omitempty" bson:"payment_bank_type,omitempty"`
	PaymentBankCode PaymentBankCode      `validate:"required" json:"payment_bank_code,omitempty" bson:"payment_bank_code,omitempty"`
}

type OrderCustomer

type OrderCustomer struct {
	Name  string `json:"name,omitempty" bson:"name,omitempty"`
	Email string `json:"email,omitempty" bson:"email,omitempty"`
}

type OrderCustomerCreate

type OrderCustomerCreate struct {
	Name  string `validate:"required,min=3" json:"name,omitempty" bson:"name,omitempty"`
	Email string `validate:"required,email" json:"email,omitempty" bson:"email,omitempty"`
}

type OrderCustomerFilter

type OrderCustomerFilter struct {
	Name  string `validate:"omitempty,min=3" json:"name,omitempty" bson:"name,omitempty"`
	Email string `validate:"omitempty,email" json:"email,omitempty" bson:"email,omitempty"`
}

type OrderFee

type OrderFee struct {
	Name   string `json:"name,omitempty" bson:"name,omitempty"`
	Amount int    `json:"amount,omitempty" bson:"amount,omitempty"`
}

type OrderFilter

type OrderFilter struct {
	Id       string               `validate:"omitempty,mongodb" json:"id,omitempty" bson:"_id,omitempty"`
	Code     string               `validate:"omitempty" json:"code,omitempty" bson:"code,omitempty"`
	StoreId  string               `validate:"omitempty,mongodb" json:"store_id,omitempty" bson:"store_id,omitempty"`
	Customer *OrderCustomerFilter `validate:"omitempty" json:"customer,omitempty" bson:"customer,omitempty"`
}

type OrderItem

type OrderItem struct {
	ItemId   string `validate:"required,mongodb" json:"item_id,omitempty" bson:"item_id,omitempty"`
	Name     string `validate:"omitempty,min=3" json:"name,omitempty" bson:"name,omitempty"`
	Price    int    `validate:"omitempty" json:"price,omitempty" bson:"price,omitempty"`
	Quantity int    `validate:"required,min=1" json:"quantity,omitempty" bson:"quantity,omitempty"`
}

type OrderStatus

type OrderStatus string

NOT_CONFIRMED, PENDING, PROCESSED, CANCELLED, FAILED, DONE

type OrderUpdate

type OrderUpdate struct {
	Status OrderStatus `json:"status,omitempty" bson:"status,omitempty"`
}

type Payment

type Payment struct {
	Id             string          `json:"id,omitempty"`
	LinkId         string          `json:"link_id,omitempty"`
	Status         PaymentStatus   `json:"status,omitempty"`
	PaymentChannel *PaymentChannel `json:"payment_channel,omitempty"`
}

type PaymentBankCode

type PaymentBankCode string

flip.FlipCode...

type PaymentBankType

type PaymentBankType string

flip.FlipAccountType...

type PaymentChannel

type PaymentChannel struct {
	AccountNumber string `json:"account_number,omitempty"`
	AccountType   string `json:"account_type,omitempty"`
	BankCode      string `json:"bank_code,omitempty"`
	AccountHolder string `json:"account_holder,omitempty"`
	QrCodeData    string `json:"qr_code_data,omitempty"`
}

type PaymentStatus

type PaymentStatus string

NOT_CONFIRMED, PENDING, PROCESSED, CANCELLED, FAILED, DONE

type Stock

type Stock struct {
	Id        primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
	StoreId   string             `json:"store_id,omitempty" bson:"store_id,omitempty"`
	ItemId    string             `json:"item_id,omitempty" bson:"item_id,omitempty"`
	Separator string             `json:"separator,omitempty" bson:"separator,omitempty"`
	Contents  *string            `json:"contents" bson:"contents,omitempty"`
	Count     int                `json:"count,omitempty" bson:"count,omitempty"`
	CreatedAt *time.Time         `json:"created_at,omitempty" bson:"created_at,omitempty"`
	UpdatedAt *time.Time         `json:"updated_at,omitempty" bson:"updated_at,omitempty"`
}

type StockCreate

type StockCreate struct {
	StoreId   string `validate:"required,mongodb" json:"store_id,omitempty" bson:"store_id,omitempty"`
	ItemId    string `validate:"required,mongodb" json:"item_id,omitempty" bson:"item_id,omitempty"`
	Separator string `validate:"required" json:"separator,omitempty" bson:"separator,omitempty"`
	Contents  string `json:"contents,omitempty" bson:"contents,omitempty"`
}

type StockFilter

type StockFilter struct {
	Id        string `json:"id,omitempty" bson:"_id,omitempty"`
	StoreId   string `validate:"omitempty,mongodb" json:"store_id,omitempty" bson:"store_id,omitempty"`
	ItemId    string `validate:"omitempty,mongodb" json:"item_id,omitempty" bson:"item_id,omitempty"`
	Separator string `validate:"omitempty" json:"separator,omitempty" bson:"separator,omitempty"`
}

type StockUpdate

type StockUpdate struct {
	StoreId   string `validate:"omitempty,mongodb" json:"store_id,omitempty" bson:"store_id,omitempty"`
	ItemId    string `validate:"omitempty,mongodb" json:"item_id,omitempty" bson:"item_id,omitempty"`
	Separator string `validate:"omitempty" json:"separator,omitempty" bson:"separator,omitempty"`
	Contents  string `json:"contents,omitempty" bson:"contents,omitempty"`
}

type Store

type Store struct {
	Id          primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
	Slug        string             `json:"slug,omitempty" bson:"slug"`
	Name        string             `json:"name,omitempty" bson:"name"`
	Description string             `json:"description,omitempty" bson:"description"`
	AuthorID    string             `json:"author_id,omitempty" bson:"author_id"`
	Banner      string             `json:"banner,omitempty" bson:"banner,omitempty"`
	Badges      []*StoreBadge      `json:"badges" bson:"badges"`
	CreatedAt   *time.Time         `json:"created_at,omitempty" bson:"created_at"`
	UpdatedAt   *time.Time         `json:"updated_at,omitempty" bson:"updated_at"`
}

type StoreBadge

type StoreBadge struct {
	BadgeID   string     `json:"badge_id,omitempty" bson:"badge_id"`
	Badge     *Badge     `json:"badge,omitempty" bson:"-"`
	CreatedAt *time.Time `json:"created_at,omitempty" bson:"created_at"`
	UpdatedAt *time.Time `json:"updated_at,omitempty" bson:"updated_at"`
}

type StoreBadgeUpdate

type StoreBadgeUpdate struct {
	BadgeID string `validate:"omitempty,mongodb" json:"badge_id,omitempty" bson:"badge_id"`
}

type StoreCreate

type StoreCreate struct {
	Slug        string `validate:"required,min=3,lowercase" json:"slug,omitempty" bson:"slug"`
	Name        string `validate:"required,min=3" json:"name,omitempty" bson:"name"`
	Description string `validate:"required,min=8" json:"description,omitempty" bson:"description"`
	AuthorID    string `validate:"required,mongodb" json:"author_id,omitempty" bson:"author_id"`
	Banner      string `validate:"omitempty,url" json:"banner,omitempty" bson:"banner"`
}

type StoreFilter

type StoreFilter struct {
	Id       string `validate:"omitempty,mongodb" json:"id,omitempty" bson:"_id"`
	Slug     string `validate:"omitempty,min=3,lowercase" json:"slug,omitempty" bson:"slug"`
	AuthorID string `validate:"omitempty,mongodb" json:"author_id,omitempty" bson:"author_id"`
}

type StoreUpdate

type StoreUpdate struct {
	Slug        string             `validate:"omitempty,min=3,lowercase" json:"slug,omitempty" bson:"slug"`
	Name        string             `validate:"omitempty,min=3" json:"name,omitempty" bson:"name"`
	Description string             `validate:"omitempty,min=8" json:"description,omitempty" bson:"description"`
	AuthorID    string             `validate:"omitempty,mongodb" json:"author_id,omitempty" bson:"author_id"`
	Banner      string             `validate:"omitempty,url" json:"banner,omitempty" bson:"banner"`
	Badges      []StoreBadgeUpdate `json:"badges,omitempty" bson:"badges"`
}

type User

type User struct {
	Id       primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
	Username string             `json:"username,omitempty" bson:"username"`
	FullName string             `json:"full_name,omitempty" bson:"full_name"`
	Email    string             `json:"email,omitempty" bson:"email"`
	Phone    *string            `json:"phone,omitempty" bson:"phone"`
	// Role: USER, SELLER, ADMIN
	Role         string           `json:"role,omitempty" bson:"role"`
	VerifyStatus UserVerifyStatus `json:"verify_status,omitempty" bson:"verify_status"`
	Image        *string          `json:"image,omitempty"`
	CreatedAt    *time.Time       `json:"created_at,omitempty" bson:"created_at,omitempty"`
	UpdatedAt    *time.Time       `json:"updated_at,omitempty" bson:"updated_at,omitempty"`
}

type UserCreate

type UserCreate struct {
	Username     string           `validate:"required,min=3" bson:"username,omitempty" json:"username,omitempty"`
	FullName     string           `validate:"required,min=3" bson:"full_name,omitempty" json:"full_name,omitempty"`
	Email        string           `validate:"required,email" bson:"email,omitempty" json:"email,omitempty"`
	Phone        *string          `validate:"omitempty,e164" bson:"phone,omitempty" json:"phone,omitempty"`
	Image        string           `validate:"omitempty,url" bson:"image,omitempty" json:"image,omitempty"`
	VerifyStatus UserVerifyStatus `bson:"verify_status,omitempty" json:"verify_status,omitempty"`
}

type UserFilter

type UserFilter struct {
	Id       string `validate:"omitempty,mongodb" bson:"_id,omitempty" json:"id,omitempty"`
	Username string `validate:"omitempty,min=3" bson:"username,omitempty" json:"username,omitempty"`
	Email    string `validate:"omitempty,email" bson:"email,omitempty" json:"email,omitempty"`
	Phone    string `validate:"omitempty,e164" bson:"phone,omitempty" json:"phone,omitempty"`
}

type UserUpdate

type UserUpdate struct {
	Username     string           `validate:"omitempty,min=3" bson:"username,omitempty" json:"username,omitempty"`
	FullName     string           `validate:"omitempty,min=3" bson:"full_name,omitempty" json:"full_name,omitempty"`
	Email        string           `validate:"omitempty,email" bson:"email,omitempty" json:"email,omitempty"`
	Phone        string           `validate:"omitempty,e164" bson:"phone,omitempty" json:"phone,omitempty"`
	Image        *string          `validate:"omitempty,url" bson:"image,omitempty" json:"image,omitempty"`
	VerifyStatus UserVerifyStatus `bson:"verify_status,omitempty" json:"verify_status,omitempty"`
}

type UserVerifyStatus

type UserVerifyStatus struct {
	Email bool `json:"email" bson:"email"`
	Phone bool `json:"phone" bson:"phone"`
}

Jump to

Keyboard shortcuts

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