Skip to content

Commit ab7ed60

Browse files
committed
add stellar validation to farm model
1 parent 0f57022 commit ab7ed60

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

node-registrar/pkg/db/models.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ type Account struct {
2222

2323
type Farm struct {
2424
FarmID uint64 `gorm:"primaryKey;autoIncrement" json:"farm_id"`
25-
FarmName string `gorm:"size:40;not null;unique;check:farm_name <> ''" json:"farm_name"`
25+
FarmName string `gorm:"size:40;not null;unique;check:farm_name <> ''" json:"farm_name" binding:"alphanum,required"`
2626
TwinID uint64 `json:"twin_id" gorm:"not null;check:twin_id > 0"` // Farmer account reference
27-
StellarAddress string `json:"stellar_address"`
27+
StellarAddress string `json:"stellar_address" binding:"max=56,startswith=G,len=56,alphanum,uppercase"`
2828
Dedicated bool `json:"dedicated"`
2929
CreatedAt time.Time `json:"created_at"`
3030
UpdatedAt time.Time `json:"updated_at"`

0 commit comments

Comments
 (0)