diff --git a/backend/internal/domain/cropland.go b/backend/internal/domain/cropland.go new file mode 100644 index 0000000..17a7192 --- /dev/null +++ b/backend/internal/domain/cropland.go @@ -0,0 +1,36 @@ +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 +} diff --git a/backend/internal/domain/farm.go b/backend/internal/domain/farm.go new file mode 100644 index 0000000..5bc1154 --- /dev/null +++ b/backend/internal/domain/farm.go @@ -0,0 +1,33 @@ +package domain + +import ( + "context" + "time" + + validation "github.com/go-ozzo/ozzo-validation/v4" +) + +type Farm struct { + UUID string + Name string + Lat float64 + Lon float64 + CreatedAt time.Time + UpdatedAt time.Time + OwnerID string +} + +func (f *Farm) Validate() error { + return validation.ValidateStruct(f, + validation.Field(&f.Name, validation.Required), + validation.Field(&f.Lat, validation.Required), + validation.Field(&f.Lon, validation.Required), + validation.Field(&f.OwnerID, validation.Required), + ) +} + +type FarmRepository interface { + GetByID(context.Context, string) (Farm, error) + CreateOrUpdate(context.Context, *Farm) error + // Delete(context.Context, string) error +}