Files
whatshooked/pkg/models/sql_public_whatsapp_accounts.go
Hein f9773bd07f
Some checks failed
CI / Test (1.23) (push) Failing after -22m46s
CI / Test (1.22) (push) Failing after -22m32s
CI / Build (push) Failing after -23m30s
CI / Lint (push) Failing after -23m12s
refactor(API): Relspect integration
2026-02-05 13:39:43 +02:00

72 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:whatsapp_accounts,alias:whatsapp_accounts"`
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.SqlTime `bun:"created_at,type:timestamp,default:now(),notnull," json:"created_at"`
DeletedAt resolvespec_common.SqlTime `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.SqlTime `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.SqlTime `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"`
RelUserID *ModelPublicUser `bun:"rel:has-one,join:user_id=id" json:"reluserid,omitempty"` // Has one ModelPublicUser
}
// TableName returns the table name for ModelPublicWhatsappAccount
func (m ModelPublicWhatsappAccount) TableName() string {
return "whatsapp_accounts"
}
// TableNameOnly returns the table name without schema for ModelPublicWhatsappAccount
func (m ModelPublicWhatsappAccount) TableNameOnly() string {
return "whatsapp_accounts"
}
// 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"
}