mirror of
https://github.com/ForFarmTeam/ForFarm.git
synced 2025-12-19 14:04:08 +01:00
feat: add domain plant
This commit is contained in:
parent
c70fe5ab99
commit
1839f8dfc0
51
backend/internal/domain/plant.go
Normal file
51
backend/internal/domain/plant.go
Normal file
@ -0,0 +1,51 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
validation "github.com/go-ozzo/ozzo-validation/v4"
|
||||
)
|
||||
|
||||
type Plant struct {
|
||||
UUID string
|
||||
Name string
|
||||
Variety *string
|
||||
RowSpacing *float64
|
||||
OptimalTemp *float64
|
||||
PlantingDepth *float64
|
||||
AverageHeight *float64
|
||||
LightProfileID int
|
||||
SoilConditionID int
|
||||
PlantingDetail *string
|
||||
IsPerennial bool
|
||||
DaysToEmerge *int
|
||||
DaysToFlower *int
|
||||
DaysToMaturity *int
|
||||
HarvestWindow *int
|
||||
PHValue *float64
|
||||
EstimateLossRate *float64
|
||||
EstimateRevenuePerHU *float64
|
||||
HarvestUnitID int
|
||||
WaterNeeds *float64
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
func (p *Plant) Validate() error {
|
||||
return validation.ValidateStruct(p,
|
||||
validation.Field(&p.UUID, validation.Required),
|
||||
validation.Field(&p.Name, validation.Required),
|
||||
validation.Field(&p.LightProfileID, validation.Required),
|
||||
validation.Field(&p.SoilConditionID, validation.Required),
|
||||
validation.Field(&p.HarvestUnitID, validation.Required),
|
||||
)
|
||||
}
|
||||
|
||||
type PlantRepository interface {
|
||||
GetByUUID(context.Context, string) (Plant, error)
|
||||
GetAll(context.Context) ([]Plant, error)
|
||||
//Create(context.Context, *Plant) error
|
||||
//Update(context.Context, *Plant) error
|
||||
//Delete(context.Context, string) error
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user