mirror of
https://github.com/ForFarmTeam/ForFarm.git
synced 2025-12-18 21:44:08 +01:00
feat: add domain farm
This commit is contained in:
parent
da20126888
commit
c38397659c
33
backend/internal/domain/farm.go
Normal file
33
backend/internal/domain/farm.go
Normal file
@ -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
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user