Manage optionnal fields

This commit is contained in:
William Bouzourène 2025-01-06 17:05:03 +01:00
parent dcc322c71d
commit d35b06e2a9
Signed by: bouzoure
SSH key fingerprint: SHA256:19MbXpLua4rUtk8tunMesD8KUKb91LXLHg8E/qTooww
7 changed files with 518 additions and 0 deletions

40
models/fields.go Normal file
View file

@ -0,0 +1,40 @@
package models
import (
"database/sql"
"gorm.io/gorm"
)
type Field struct {
gorm.Model
Name string
PersonType string
FieldType string
ListID uint
List List
}
type FieldValue struct {
gorm.Model
FieldID uint
Field Field
ValueString sql.NullString
ValueInt sql.NullInt64
ValueDate sql.NullTime
ListItemID uint
ListItem ListItem
}
var PersonTypes = map[string]string{
"member": "Membre",
"contact": "Contact",
}
var FieldTypes = map[string]string{
"text": "Texte",
"longtext": "Texte multiligne",
"number": "Nombre",
"date": "Date",
"list": "Liste",
}