Spaces:
Running
Running
restructure repo into production layout; add whatsapp-service, tests, ddl, docs, scripts; scrub hardcoded secrets
83d6851 | package instance_model | |
| import ( | |
| "time" | |
| "github.com/google/uuid" | |
| ) | |
| type Instance struct { | |
| Id string `json:"id"` | |
| Name string `json:"name"` | |
| Token string `json:"token"` | |
| Webhook string `json:"webhook"` | |
| RabbitmqEnable string `json:"rabbitmqEnable"` | |
| WebSocketEnable string `json:"websocketEnable"` | |
| NatsEnable string `json:"natsEnable"` | |
| Jid string `json:"jid"` | |
| Qrcode string `json:"qrcode"` | |
| Connected bool `json:"connected"` | |
| Expiration int64 `json:"expiration"` | |
| DisconnectReason string `json:"disconnect_reason"` | |
| Events string `json:"events"` | |
| OsName string `json:"os_name"` | |
| Proxy string `json:"proxy"` | |
| ClientName string `json:"client_name"` | |
| CreatedAt time.Time `json:"createdAt"` | |
| // Advanced Settings | |
| AlwaysOnline bool `json:"alwaysOnline"` | |
| RejectCall bool `json:"rejectCall"` | |
| MsgRejectCall string `json:"msgRejectCall"` | |
| ReadMessages bool `json:"readMessages"` | |
| IgnoreGroups bool `json:"ignoreGroups"` | |
| IgnoreStatus bool `json:"ignoreStatus"` | |
| } | |
| // AdvancedSettings representa as configurações avançadas de uma instância | |
| type AdvancedSettings struct { | |
| AlwaysOnline bool `json:"alwaysOnline"` | |
| RejectCall bool `json:"rejectCall"` | |
| MsgRejectCall string `json:"msgRejectCall"` | |
| ReadMessages bool `json:"readMessages"` | |
| IgnoreGroups bool `json:"ignoreGroups"` | |
| IgnoreStatus bool `json:"ignoreStatus"` | |
| } | |
| // EnsureID assigns a UUID when not already set. | |
| func (m *Instance) EnsureID() { | |
| if m.Id == "" { | |
| m.Id = uuid.New().String() | |
| } | |
| } | |