feat: tmp uc
This commit is contained in:
parent
dba8d1deeb
commit
fa9b188811
|
@ -5,7 +5,6 @@ import (
|
||||||
"code.30cm.net/digimon/app-cloudep-product-service/pkg/domain/repository"
|
"code.30cm.net/digimon/app-cloudep-product-service/pkg/domain/repository"
|
||||||
"code.30cm.net/digimon/app-cloudep-product-service/pkg/domain/usecase"
|
"code.30cm.net/digimon/app-cloudep-product-service/pkg/domain/usecase"
|
||||||
"context"
|
"context"
|
||||||
"google.golang.org/protobuf/proto"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ProductUseCaseParam struct {
|
type ProductUseCaseParam struct {
|
||||||
|
@ -28,28 +27,11 @@ func MustProductUseCase(param ProductUseCaseParam) usecase.ProductUseCase {
|
||||||
func (use *ProductUseCase) Create(ctx context.Context, product *usecase.Product) error {
|
func (use *ProductUseCase) Create(ctx context.Context, product *usecase.Product) error {
|
||||||
//use.ProductRepo.Transaction()
|
//use.ProductRepo.Transaction()
|
||||||
insert := &entity.Product{
|
insert := &entity.Product{
|
||||||
UID: *product.UID,
|
UID: *product.UID,
|
||||||
Title: *product.Title,
|
Title: *product.Title,
|
||||||
ShortTitle: product.ShortTitle,
|
ShortTitle: product.ShortTitle,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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"` // 自定義屬性
|
|
||||||
|
|
||||||
|
|
||||||
err := use.ProductRepo.Insert(ctx, insert)
|
err := use.ProductRepo.Insert(ctx, insert)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue