model

package
v0.0.0-...-dd467ca Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: Apache-2.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 APIResponse

type APIResponse struct {
	Code    int32       `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

type CartItem

type CartItem struct {
	ID        primitive.ObjectID `bson:"_id,omitempty"  json:"_id"`
	Name      string             `bson:"name"           json:"name"`
	Qty       int64              `bson:"quantity"       json:"qty"`
	Price     float64            `bson:"price"          json:"price"`
	ImageURL  string             `bson:"image_url"      json:"image_url"`
	UserID    primitive.ObjectID `bson:"user"           json:"user"`
	ProductID primitive.ObjectID `bson:"product"        json:"product"`
}

type Category

type Category struct {
	ID        primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
	Name      string             `bson:"name"          json:"name"`
	CreatedAt time.Time          `bson:"created_at"    json:"created_at"`
	UpdatedAt time.Time          `bson:"updated_at"    json:"updated_at"`
}

func (*Category) BeforeSave

func (c *Category) BeforeSave() Category

type CategoryRequest

type CategoryRequest struct {
	Name string `bson:"name"       json:"name" validate:"required,min=3,max=20"`
}

type CreateOrderRequest

type CreateOrderRequest struct {
	DeliveryFee       string `json:"delivery_fee"`
	DeliveryAddressID string `json:"delivery_address"`
	User              User   `json:"-" validate:"-"`
}

type DeliveryAddress

type DeliveryAddress struct {
	ID        primitive.ObjectID `bson:"_id,omitempty"  json:"_id"`
	Name      string             `bson:"name"           json:"name"`
	Village   string             `bson:"village"        json:"village"`
	District  string             `bson:"district"       json:"district"`
	Regency   string             `bson:"regency"        json:"regency"`
	Province  string             `bson:"province"       json:"province"`
	Detail    string             `bson:"detail"         json:"detail"`
	CreatedAt time.Time          `bson:"created_at"     json:"created_at"`
	UpdatedAt time.Time          `bson:"updated_at"     json:"updated_at"`
}

func (*DeliveryAddress) BeforeSave

func (da *DeliveryAddress) BeforeSave() DeliveryAddress

type District

type District struct {
	Code        string `json:"code" csv:"kode"`
	Name        string `json:"name" csv:"nama"`
	RegencyCode string `csv:"kode_kabupaten"`
}

Kecamatan

type Invoice

type Invoice struct {
	Subtotal        int64              `bson:"subtotal" json:"subtotal"`
	DeliveryFee     int64              `bson:"delivery_fee" json:"delivery_fee"`
	DeliveryAddress DeliveryAddress    `bson:"delivery_address" json:"delivery_address"`
	Total           int64              `bson:"total" json:"total"`
	PaymentStatus   string             `bson:"payment_status" json:"payment_status"`
	User            User               `bson:"user" json:"user"`
	OrderID         primitive.ObjectID `bson:"order_id" json:"order_id"`
}

type Items

type Items struct {
	ID       string  `json:"_id"`
	Name     string  `json:"name"`
	Qty      int64   `json:"qty"`
	Price    float64 `json:"price"`
	ImageURL string  `json:"image_url"`
}

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type LoginResponse

type LoginResponse struct {
	User  *User  `json:"user"`
	Token string `json:"token"`
}

type Order

type Order struct {
	ID              primitive.ObjectID `bson:"_id" json:"_id"`
	OrderNumber     int64              `bson:"order_number" json:"order_number"`
	Status          string             `bson:"status" json:"status"`
	DeliveryFee     int64              `bson:"delivery_fee" json:"delivery_fee"`
	DeliveryAddress DeliveryAddress    `bson:"delivery_address" json:"delivery_address"`
	OrderItems      []OrderItem        `bson:"order_item" json:"order_item"`
	UserID          primitive.ObjectID `bson:"user_id" json:"user_id"`
}

type OrderItem

type OrderItem struct {
	ID        primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
	Name      string             `bson:"name" json:"name"`
	Price     int64              `bson:"price" json:"price"`
	Qty       int64              `bson:"quantity" json:"qty"`
	ProductID primitive.ObjectID `bson:"product_id" json:"product_id"`
	OrderID   primitive.ObjectID `bson:"order_id" json:"order_id"`
}

type Paging

type Paging struct {
	Limit  int64
	Offset int64
}

type Product

type Product struct {
	ID          primitive.ObjectID `bson:"_id,omitempty"  json:"_id"`
	Name        string             `bson:"name"           json:"name"        validate:"required,min=3,max=45"`
	Description string             `bson:"description"    json:"description" validate:"required"`
	Price       float32            `bson:"price"          json:"price"`
	ImageURL    string             `bson:"image_url"      json:"image_url"`
	CreatedAt   time.Time          `bson:"created_at"     json:"created_at"`
	UpdatedAt   time.Time          `bson:"updated_at"     json:"updated_at"`
	Category    Category           `bson:"-"              json:"category"`
	Tags        []Tag              `bson:"-"              json:"tags"`
}

func (*Product) BeforeSave

func (p *Product) BeforeSave() Product

type ProductRequest

type ProductRequest struct {
	ID          primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
	Name        string             `bson:"name"          json:"name"        validate:"required,min=3,max=45"`
	Description string             `bson:"description"   json:"description" validate:"required"`
	Price       float32            `bson:"price"         json:"price"`
	ImageURL    string             `bson:"image_url"     json:"image_url"`
	CategoryID  string             `bson:"category_id"   json:"category_id"`
	Tags        []string           `bson:"tags"          json:"-"`
}

type Province

type Province struct {
	Code string `json:"code" csv:"kode"`
	Name string `json:"name" csv:"nama"`
}

Provinsi

type ReadAllProductResponse

type ReadAllProductResponse struct {
	Code    int32       `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
	Total   int64       `json:"total"`
}

type ReadProductRequest

type ReadProductRequest struct {
	Limit    int64                `json:"limit"`
	Offset   int64                `json:"skip"`
	Keyword  string               `json:"q"`
	Category string               `json:"category"`
	Tags     []string             `json:"tags"`
	ItemIDs  []primitive.ObjectID `json:"-"`
}

type Regency

type Regency struct {
	Code         string `json:"code" csv:"kode"`
	Name         string `json:"name" csv:"nama"`
	ProvinceCode string `json:"province_code" csv:"kode_provinsi"`
}

Kabupaten

type RegisterRequest

type RegisterRequest struct {
	FullName string `bson:"full_name"     json:"full_name"     validate:"required,min=3,max=45"`
	Email    string `bson:"email"         json:"email"         validate:"required,email"`
	Password string `bson:"password"      json:"password"      validate:"required"`
}

type RegisterResponse

type RegisterResponse struct {
}

type ResponseError

type ResponseError struct {
	Message string `json:"errors"`
}

type Tag

type Tag struct {
	ID   primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	Name string             `bson:"name"          json:"name" validate:"required,min=3,max=20"`
}

type UpdateCartItemRequest

type UpdateCartItemRequest struct {
	Items []Items `json:"items"`
}

type User

type User struct {
	ID         primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
	FullName   string             `bson:"full_name"     json:"full_name"     validate:"required,min=3,max=45"`
	CustomerID int64              `bson:"-"             json:"customer_id"`
	Email      string             `bson:"email"         json:"email"         validate:"required,email"`
	Password   string             `bson:"password"      json:"password"      validate:"required"`
	Role       string             `bson:"role"          json:"role"          validate:"eq=user|eq=admin"`
	Token      string             `bson:"token"         json:"token"`
	CreatedAt  time.Time          `bson:"created_at"    json:"created_at"`
	UpdatedAt  time.Time          `bson:"updated_at"    json:"updated_at"`
}

func (*User) BeforeSave

func (u *User) BeforeSave() error

type Village

type Village struct {
	Code         string `json:"code" csv:"kode"`
	Name         string `json:"name" csv:"nama"`
	DistrictCode string `json:"district_code" csv:"kode_kecamatan"`
}

Kelurahan / Desa

Jump to

Keyboard shortcuts

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