45 lines
2.1 KiB
Go
Executable File
45 lines
2.1 KiB
Go
Executable File
package entity
|
|
|
|
import "go.mongodb.org/mongo-driver/bson/primitive"
|
|
|
|
type Stage struct {
|
|
Stage uint64 `bson:"stage"` // 第幾階段
|
|
Target uint64 `bson:"target"` // 階段目標金額
|
|
Description string `bson:"description"` // 階段描述
|
|
}
|
|
|
|
// Product 專案,頻道,等共用的東西
|
|
type Product struct {
|
|
ID primitive.ObjectID `bson:"_id,omitempty"` // 專案 ID
|
|
UID string `bson:"uid"` // 專案擁有者 UID
|
|
Title string `bson:"title"` // 專案名稱
|
|
ShortTitle *string `bson:"short_title,omitempty"` // 計畫簡短標題 -> 不一定要有
|
|
Details *string `bson:"details"` // 詳細內容
|
|
ShortDescription string `bson:"short_description,omitempty"` // 簡短描述
|
|
Media []Media `bson:"media,omitempty"` // 專案動態內容(圖片或者影片)
|
|
Slug *string `bson:"slug,omitempty"` // URL 後綴(查詢用)
|
|
IsPublished bool `bson:"is_published" ` // 是否已上架
|
|
Amount uint64 `bson:"amount,omitempty"` // 目標金額
|
|
StartTime *int64 `bson:"start_time,omitempty"` // 專案開始時間
|
|
EndTime *int64 `bson:"end_time,omitempty"` // 專案結束時間
|
|
Category string `bson:"category"` // 類別
|
|
CustomFields []CustomFields `bson:"custom_fields,omitempty"` // 自定義屬性
|
|
UpdatedAt int64 `bson:"updated_at,omitempty"` // 更新時間
|
|
CreatedAt int64 `bson:"created_at,omitempty"` // 建立時間
|
|
}
|
|
|
|
type Media struct {
|
|
Sort uint64 `bson:"sort"`
|
|
Type string `bson:"type"`
|
|
URL string `bson:"url"`
|
|
}
|
|
|
|
type CustomFields struct {
|
|
Key string `bson:"key"`
|
|
Value string `bson:"value"`
|
|
}
|
|
|
|
func (p *Product) CollectionName() string {
|
|
return "product"
|
|
}
|