mirror of
https://github.com/ForFarmTeam/ForFarm.git
synced 2025-12-19 05:54:08 +01:00
37 lines
806 B
Go
37 lines
806 B
Go
package domain
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
validation "github.com/go-ozzo/ozzo-validation/v4"
|
|
)
|
|
|
|
type Cropland struct {
|
|
UUID string
|
|
Name string
|
|
Status string
|
|
Priority int
|
|
LandSize float64
|
|
GrowthStage string
|
|
PlantID string
|
|
FarmID string
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
func (c *Cropland) Validate() error {
|
|
return validation.ValidateStruct(c,
|
|
validation.Field(&c.Name, validation.Required),
|
|
validation.Field(&c.Status, validation.Required),
|
|
validation.Field(&c.GrowthStage, validation.Required),
|
|
validation.Field(&c.LandSize, validation.Required),
|
|
)
|
|
}
|
|
|
|
type CroplandRepository interface {
|
|
GetByID(context.Context, string) (Cropland, error)
|
|
CreateOrUpdate(context.Context, *Cropland) error
|
|
// Delete(context.Context, string) error
|
|
}
|