* Introduced ModelPublicAPIKey, ModelPublicEventLog, ModelPublicHook, ModelPublicSession, ModelPublicUser, and ModelPublicWhatsappAccount * Removed deprecated ModelPublicUsers * Updated database schema definitions to reflect new model structure * Adjusted seed data to use correct types for timestamps
71 lines
3.1 KiB
Go
71 lines
3.1 KiB
Go
// Code generated by relspecgo. DO NOT EDIT.
|
|
package models
|
|
|
|
import (
|
|
"fmt"
|
|
resolvespec_common "github.com/bitechdev/ResolveSpec/pkg/spectypes"
|
|
"github.com/uptrace/bun"
|
|
)
|
|
|
|
type ModelPublicWhatsappAccount struct {
|
|
bun.BaseModel `bun:"table:public.whatsapp_account,alias:whatsapp_account"`
|
|
ID resolvespec_common.SqlString `bun:"id,type:varchar(36),pk," json:"id"` // UUID
|
|
AccountType resolvespec_common.SqlString `bun:"account_type,type:varchar(50),notnull," json:"account_type"` // whatsmeow or business-api
|
|
Active bool `bun:"active,type:boolean,default:true,notnull," json:"active"`
|
|
Config resolvespec_common.SqlString `bun:"config,type:text,nullzero," json:"config"` // JSON encoded additional config
|
|
CreatedAt resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamp,default:now(),notnull," json:"created_at"`
|
|
DeletedAt resolvespec_common.SqlTimeStamp `bun:"deleted_at,type:timestamp,nullzero," json:"deleted_at"`
|
|
DisplayName resolvespec_common.SqlString `bun:"display_name,type:varchar(255),nullzero," json:"display_name"`
|
|
LastConnectedAt resolvespec_common.SqlTimeStamp `bun:"last_connected_at,type:timestamp,nullzero," json:"last_connected_at"`
|
|
PhoneNumber resolvespec_common.SqlString `bun:"phone_number,type:varchar(50),notnull," json:"phone_number"`
|
|
SessionPath resolvespec_common.SqlString `bun:"session_path,type:text,nullzero," json:"session_path"`
|
|
Status resolvespec_common.SqlString `bun:"status,type:varchar(50),default:'disconnected',notnull," json:"status"` // connected
|
|
UpdatedAt resolvespec_common.SqlTimeStamp `bun:"updated_at,type:timestamp,default:now(),notnull," json:"updated_at"`
|
|
UserID resolvespec_common.SqlString `bun:"user_id,type:varchar(36),notnull," json:"user_id"`
|
|
}
|
|
|
|
// TableName returns the table name for ModelPublicWhatsappAccount
|
|
func (m ModelPublicWhatsappAccount) TableName() string {
|
|
return "public.whatsapp_account"
|
|
}
|
|
|
|
// TableNameOnly returns the table name without schema for ModelPublicWhatsappAccount
|
|
func (m ModelPublicWhatsappAccount) TableNameOnly() string {
|
|
return "whatsapp_account"
|
|
}
|
|
|
|
// SchemaName returns the schema name for ModelPublicWhatsappAccount
|
|
func (m ModelPublicWhatsappAccount) SchemaName() string {
|
|
return "public"
|
|
}
|
|
|
|
// GetID returns the primary key value
|
|
func (m ModelPublicWhatsappAccount) GetID() int64 {
|
|
return m.ID.Int64()
|
|
}
|
|
|
|
// GetIDStr returns the primary key as a string
|
|
func (m ModelPublicWhatsappAccount) GetIDStr() string {
|
|
return fmt.Sprintf("%d", m.ID)
|
|
}
|
|
|
|
// SetID sets the primary key value
|
|
func (m ModelPublicWhatsappAccount) SetID(newid int64) {
|
|
m.UpdateID(newid)
|
|
}
|
|
|
|
// UpdateID updates the primary key value
|
|
func (m *ModelPublicWhatsappAccount) UpdateID(newid int64) {
|
|
m.ID.FromString(fmt.Sprintf("%d", newid))
|
|
}
|
|
|
|
// GetIDName returns the name of the primary key column
|
|
func (m ModelPublicWhatsappAccount) GetIDName() string {
|
|
return "id"
|
|
}
|
|
|
|
// GetPrefix returns the table prefix
|
|
func (m ModelPublicWhatsappAccount) GetPrefix() string {
|
|
return "WAH"
|
|
}
|