bitrix/internal/models/getListFields.go
2024-09-26 15:43:25 +03:00

48 lines
1.8 KiB
Go

package models
import (
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/model"
"strconv"
"time"
)
type FieldsResponse struct {
Result []Fields `json:"result"`
Total int `json:"total"`
}
type Fields struct {
ID string `json:"ID"`
EntityID model.FieldsType `json:"ENTITY_ID"`
FieldName string `json:"FIELD_NAME"`
UserTypeID model.CustomFieldsType `json:"USER_TYPE_ID"`
Sort string `json:"SORT"`
Multiple string `json:"MULTIPLE"`
Mandatory string `json:"MANDATORY"`
ShowFilter string `json:"SHOW_FILTER"`
ShowInList string `json:"SHOW_IN_LIST"`
EditInList string `json:"EDIT_IN_LIST"`
IsSearchable string `json:"IS_SEARCHABLE"`
EditFormLabel string `json:"EDIT_FORM_LABEL"`
ListColumnLabel string `json:"LIST_COLUMN_LABEL"`
ListFilterLabel string `json:"LIST_FILTER_LABEL"`
ErrorMessage string `json:"ERROR_MESSAGE"`
HelpMessage string `json:"HELP_MESSAGE"`
}
type AddFields struct {
FieldName string `json:"FIELD_NAME"`
EditFormLabel string `json:"EDIT_FORM_LABEL"`
ListColumnLabel string `json:"LIST_COLUMN_LABEL"`
UserTypeID string `json:"USER_TYPE_ID"` // Тип поля
XMLID string `json:"XML_ID"`
Settings map[string]interface{} `json:"SETTINGS"`
}
func (a *AddFields) GenFieldName() {
currentTime := time.Now().Unix()
currentTimeStr := strconv.FormatInt(currentTime, 10)
a.FieldName = currentTimeStr
a.XMLID = currentTimeStr
}