From dab43e3746c319726b3ef0c8d35e713cdc94bd39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20D=C3=B6ll?= Date: Wed, 1 May 2024 20:27:54 +0000 Subject: [PATCH] wip: model validation --- internal/api/models/system.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/api/models/system.go b/internal/api/models/system.go index 5ec329b2..f6622b62 100644 --- a/internal/api/models/system.go +++ b/internal/api/models/system.go @@ -9,9 +9,12 @@ import ( // System ... type System struct { - ID uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid()"` - Name string `json:"name" gorm:"unique"` - Description string `json:"description"` + // ID is the unique identifier for the system. + ID uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid()"` + // Name is the name of the system. + Name string `json:"name" gorm:"unique" validate:"required,min=3,max=128"` + // Description is the description of the system. + Description string `json:"description" validate:"max=1024"` // Operator is the operator this is associated with this system to operate. Operator Operator `json:"operator" gorm:"foreignKey:OperatorID"`