22 lines
411 B
Go
Raw Normal View History

2025-02-24 16:48:20 +08:00
package subscribeplanrepository
import (
subscribeplandomain "legalgo-BE-go/internal/domain/subscribe_plan"
2025-02-24 16:48:20 +08:00
"github.com/google/uuid"
)
2025-02-24 20:18:09 +08:00
func (s *SubsPlan) Create(spec subscribeplandomain.SubscribePlanReq) error {
data := &subscribeplandomain.SubscribePlan{
ID: uuid.NewString(),
2025-02-24 20:18:09 +08:00
Code: spec.Code,
Name: spec.Name,
2025-02-24 16:48:20 +08:00
}
2025-02-24 20:18:09 +08:00
if err := s.DB.Create(&data).Error; err != nil {
2025-02-24 16:48:20 +08:00
return err
}
return nil
}