refactor(API): ✨ Relspect integration
This commit is contained in:
70
pkg/models/sql_public_api_keys.go
Normal file
70
pkg/models/sql_public_api_keys.go
Normal file
@@ -0,0 +1,70 @@
|
||||
// Code generated by relspecgo. DO NOT EDIT.
|
||||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
resolvespec_common "github.com/bitechdev/ResolveSpec/pkg/spectypes"
|
||||
"github.com/uptrace/bun"
|
||||
)
|
||||
|
||||
type ModelPublicAPIKey struct {
|
||||
bun.BaseModel `bun:"table:api_keys,alias:api_keys"`
|
||||
ID resolvespec_common.SqlString `bun:"id,type:varchar(36),pk," json:"id"` // UUID
|
||||
Active bool `bun:"active,type:boolean,default:true,notnull," json:"active"`
|
||||
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"`
|
||||
ExpiresAt resolvespec_common.SqlTime `bun:"expires_at,type:timestamp,nullzero," json:"expires_at"`
|
||||
Key resolvespec_common.SqlString `bun:"key,type:varchar(255),notnull," json:"key"` // Hashed API key
|
||||
KeyPrefix resolvespec_common.SqlString `bun:"key_prefix,type:varchar(20),nullzero," json:"key_prefix"` // First few characters for display
|
||||
LastUsedAt resolvespec_common.SqlTime `bun:"last_used_at,type:timestamp,nullzero," json:"last_used_at"`
|
||||
Name resolvespec_common.SqlString `bun:"name,type:varchar(255),notnull," json:"name"` // Friendly name for the API key
|
||||
Permissions resolvespec_common.SqlString `bun:"permissions,type:text,nullzero," json:"permissions"` // JSON array of permissions
|
||||
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 ModelPublicAPIKey
|
||||
func (m ModelPublicAPIKey) TableName() string {
|
||||
return "api_keys"
|
||||
}
|
||||
|
||||
// TableNameOnly returns the table name without schema for ModelPublicAPIKey
|
||||
func (m ModelPublicAPIKey) TableNameOnly() string {
|
||||
return "api_keys"
|
||||
}
|
||||
|
||||
// SchemaName returns the schema name for ModelPublicAPIKey
|
||||
func (m ModelPublicAPIKey) SchemaName() string {
|
||||
return "public"
|
||||
}
|
||||
|
||||
// GetID returns the primary key value
|
||||
func (m ModelPublicAPIKey) GetID() int64 {
|
||||
return m.ID.Int64()
|
||||
}
|
||||
|
||||
// GetIDStr returns the primary key as a string
|
||||
func (m ModelPublicAPIKey) GetIDStr() string {
|
||||
return fmt.Sprintf("%d", m.ID)
|
||||
}
|
||||
|
||||
// SetID sets the primary key value
|
||||
func (m ModelPublicAPIKey) SetID(newid int64) {
|
||||
m.UpdateID(newid)
|
||||
}
|
||||
|
||||
// UpdateID updates the primary key value
|
||||
func (m *ModelPublicAPIKey) UpdateID(newid int64) {
|
||||
m.ID.FromString(fmt.Sprintf("%d", newid))
|
||||
}
|
||||
|
||||
// GetIDName returns the name of the primary key column
|
||||
func (m ModelPublicAPIKey) GetIDName() string {
|
||||
return "id"
|
||||
}
|
||||
|
||||
// GetPrefix returns the table prefix
|
||||
func (m ModelPublicAPIKey) GetPrefix() string {
|
||||
return "AKP"
|
||||
}
|
||||
70
pkg/models/sql_public_event_logs.go
Normal file
70
pkg/models/sql_public_event_logs.go
Normal file
@@ -0,0 +1,70 @@
|
||||
// Code generated by relspecgo. DO NOT EDIT.
|
||||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
resolvespec_common "github.com/bitechdev/ResolveSpec/pkg/spectypes"
|
||||
"github.com/uptrace/bun"
|
||||
)
|
||||
|
||||
type ModelPublicEventLog struct {
|
||||
bun.BaseModel `bun:"table:event_logs,alias:event_logs"`
|
||||
ID resolvespec_common.SqlString `bun:"id,type:varchar(36),pk," json:"id"` // UUID
|
||||
Action resolvespec_common.SqlString `bun:"action,type:varchar(50),nullzero," json:"action"` // create
|
||||
CreatedAt resolvespec_common.SqlTime `bun:"created_at,type:timestamp,default:now(),notnull," json:"created_at"`
|
||||
Data resolvespec_common.SqlString `bun:"data,type:text,nullzero," json:"data"` // JSON encoded event data
|
||||
EntityID resolvespec_common.SqlString `bun:"entity_id,type:varchar(36),nullzero," json:"entity_id"`
|
||||
EntityType resolvespec_common.SqlString `bun:"entity_type,type:varchar(100),nullzero," json:"entity_type"` // user
|
||||
Error resolvespec_common.SqlString `bun:"error,type:text,nullzero," json:"error"`
|
||||
EventType resolvespec_common.SqlString `bun:"event_type,type:varchar(100),notnull," json:"event_type"`
|
||||
IpAddress resolvespec_common.SqlString `bun:"ip_address,type:varchar(50),nullzero," json:"ip_address"`
|
||||
Success bool `bun:"success,type:boolean,default:true,notnull," json:"success"`
|
||||
UserAgent resolvespec_common.SqlString `bun:"user_agent,type:text,nullzero," json:"user_agent"`
|
||||
UserID resolvespec_common.SqlString `bun:"user_id,type:varchar(36),nullzero," json:"user_id"` // Optional user reference
|
||||
RelUserID *ModelPublicUser `bun:"rel:has-one,join:user_id=id" json:"reluserid,omitempty"` // Has one ModelPublicUser
|
||||
}
|
||||
|
||||
// TableName returns the table name for ModelPublicEventLog
|
||||
func (m ModelPublicEventLog) TableName() string {
|
||||
return "event_logs"
|
||||
}
|
||||
|
||||
// TableNameOnly returns the table name without schema for ModelPublicEventLog
|
||||
func (m ModelPublicEventLog) TableNameOnly() string {
|
||||
return "event_logs"
|
||||
}
|
||||
|
||||
// SchemaName returns the schema name for ModelPublicEventLog
|
||||
func (m ModelPublicEventLog) SchemaName() string {
|
||||
return "public"
|
||||
}
|
||||
|
||||
// GetID returns the primary key value
|
||||
func (m ModelPublicEventLog) GetID() int64 {
|
||||
return m.ID.Int64()
|
||||
}
|
||||
|
||||
// GetIDStr returns the primary key as a string
|
||||
func (m ModelPublicEventLog) GetIDStr() string {
|
||||
return fmt.Sprintf("%d", m.ID)
|
||||
}
|
||||
|
||||
// SetID sets the primary key value
|
||||
func (m ModelPublicEventLog) SetID(newid int64) {
|
||||
m.UpdateID(newid)
|
||||
}
|
||||
|
||||
// UpdateID updates the primary key value
|
||||
func (m *ModelPublicEventLog) UpdateID(newid int64) {
|
||||
m.ID.FromString(fmt.Sprintf("%d", newid))
|
||||
}
|
||||
|
||||
// GetIDName returns the name of the primary key column
|
||||
func (m ModelPublicEventLog) GetIDName() string {
|
||||
return "id"
|
||||
}
|
||||
|
||||
// GetPrefix returns the table prefix
|
||||
func (m ModelPublicEventLog) GetPrefix() string {
|
||||
return "ELV"
|
||||
}
|
||||
73
pkg/models/sql_public_hooks.go
Normal file
73
pkg/models/sql_public_hooks.go
Normal file
@@ -0,0 +1,73 @@
|
||||
// Code generated by relspecgo. DO NOT EDIT.
|
||||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
resolvespec_common "github.com/bitechdev/ResolveSpec/pkg/spectypes"
|
||||
"github.com/uptrace/bun"
|
||||
)
|
||||
|
||||
type ModelPublicHook struct {
|
||||
bun.BaseModel `bun:"table:hooks,alias:hooks"`
|
||||
ID resolvespec_common.SqlString `bun:"id,type:varchar(36),pk," json:"id"` // UUID
|
||||
Active bool `bun:"active,type:boolean,default:true,notnull," json:"active"`
|
||||
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"`
|
||||
Description resolvespec_common.SqlString `bun:"description,type:text,nullzero," json:"description"`
|
||||
Events resolvespec_common.SqlString `bun:"events,type:text,nullzero," json:"events"` // JSON array of event types
|
||||
Headers resolvespec_common.SqlString `bun:"headers,type:text,nullzero," json:"headers"` // JSON encoded headers
|
||||
Method resolvespec_common.SqlString `bun:"method,type:varchar(10),default:POST,notnull," json:"method"` // HTTP method
|
||||
Name resolvespec_common.SqlString `bun:"name,type:varchar(255),notnull," json:"name"`
|
||||
RetryCount resolvespec_common.SqlInt32 `bun:"retry_count,type:int,default:3,notnull," json:"retry_count"`
|
||||
Secret resolvespec_common.SqlString `bun:"secret,type:varchar(255),nullzero," json:"secret"` // HMAC signature secret
|
||||
Timeout resolvespec_common.SqlInt32 `bun:"timeout,type:int,default:30,notnull," json:"timeout"` // Timeout in seconds
|
||||
UpdatedAt resolvespec_common.SqlTime `bun:"updated_at,type:timestamp,default:now(),notnull," json:"updated_at"`
|
||||
URL resolvespec_common.SqlString `bun:"url,type:text,notnull," json:"url"`
|
||||
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 ModelPublicHook
|
||||
func (m ModelPublicHook) TableName() string {
|
||||
return "hooks"
|
||||
}
|
||||
|
||||
// TableNameOnly returns the table name without schema for ModelPublicHook
|
||||
func (m ModelPublicHook) TableNameOnly() string {
|
||||
return "hooks"
|
||||
}
|
||||
|
||||
// SchemaName returns the schema name for ModelPublicHook
|
||||
func (m ModelPublicHook) SchemaName() string {
|
||||
return "public"
|
||||
}
|
||||
|
||||
// GetID returns the primary key value
|
||||
func (m ModelPublicHook) GetID() int64 {
|
||||
return m.ID.Int64()
|
||||
}
|
||||
|
||||
// GetIDStr returns the primary key as a string
|
||||
func (m ModelPublicHook) GetIDStr() string {
|
||||
return fmt.Sprintf("%d", m.ID)
|
||||
}
|
||||
|
||||
// SetID sets the primary key value
|
||||
func (m ModelPublicHook) SetID(newid int64) {
|
||||
m.UpdateID(newid)
|
||||
}
|
||||
|
||||
// UpdateID updates the primary key value
|
||||
func (m *ModelPublicHook) UpdateID(newid int64) {
|
||||
m.ID.FromString(fmt.Sprintf("%d", newid))
|
||||
}
|
||||
|
||||
// GetIDName returns the name of the primary key column
|
||||
func (m ModelPublicHook) GetIDName() string {
|
||||
return "id"
|
||||
}
|
||||
|
||||
// GetPrefix returns the table prefix
|
||||
func (m ModelPublicHook) GetPrefix() string {
|
||||
return "HOO"
|
||||
}
|
||||
66
pkg/models/sql_public_message_cache.go
Normal file
66
pkg/models/sql_public_message_cache.go
Normal file
@@ -0,0 +1,66 @@
|
||||
// Code generated by relspecgo. DO NOT EDIT.
|
||||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
resolvespec_common "github.com/bitechdev/ResolveSpec/pkg/spectypes"
|
||||
"github.com/uptrace/bun"
|
||||
)
|
||||
|
||||
type ModelPublicMessageCache struct {
|
||||
bun.BaseModel `bun:"table:message_cache,alias:message_cache"`
|
||||
ID resolvespec_common.SqlString `bun:"id,type:varchar(36),pk," json:"id"` // UUID
|
||||
AccountID resolvespec_common.SqlString `bun:"account_id,type:varchar(36),notnull," json:"account_id"`
|
||||
ChatID resolvespec_common.SqlString `bun:"chat_id,type:varchar(255),notnull," json:"chat_id"`
|
||||
Content resolvespec_common.SqlString `bun:"content,type:text,notnull," json:"content"` // JSON encoded message content
|
||||
CreatedAt resolvespec_common.SqlTime `bun:"created_at,type:timestamp,default:now(),notnull," json:"created_at"`
|
||||
FromMe bool `bun:"from_me,type:boolean,notnull," json:"from_me"`
|
||||
MessageID resolvespec_common.SqlString `bun:"message_id,type:varchar(255),notnull," json:"message_id"`
|
||||
MessageType resolvespec_common.SqlString `bun:"message_type,type:varchar(50),notnull," json:"message_type"` // text
|
||||
Timestamp resolvespec_common.SqlTime `bun:"timestamp,type:timestamp,notnull," json:"timestamp"`
|
||||
}
|
||||
|
||||
// TableName returns the table name for ModelPublicMessageCache
|
||||
func (m ModelPublicMessageCache) TableName() string {
|
||||
return "message_cache"
|
||||
}
|
||||
|
||||
// TableNameOnly returns the table name without schema for ModelPublicMessageCache
|
||||
func (m ModelPublicMessageCache) TableNameOnly() string {
|
||||
return "message_cache"
|
||||
}
|
||||
|
||||
// SchemaName returns the schema name for ModelPublicMessageCache
|
||||
func (m ModelPublicMessageCache) SchemaName() string {
|
||||
return "public"
|
||||
}
|
||||
|
||||
// GetID returns the primary key value
|
||||
func (m ModelPublicMessageCache) GetID() int64 {
|
||||
return m.ID.Int64()
|
||||
}
|
||||
|
||||
// GetIDStr returns the primary key as a string
|
||||
func (m ModelPublicMessageCache) GetIDStr() string {
|
||||
return fmt.Sprintf("%d", m.ID)
|
||||
}
|
||||
|
||||
// SetID sets the primary key value
|
||||
func (m ModelPublicMessageCache) SetID(newid int64) {
|
||||
m.UpdateID(newid)
|
||||
}
|
||||
|
||||
// UpdateID updates the primary key value
|
||||
func (m *ModelPublicMessageCache) UpdateID(newid int64) {
|
||||
m.ID.FromString(fmt.Sprintf("%d", newid))
|
||||
}
|
||||
|
||||
// GetIDName returns the name of the primary key column
|
||||
func (m ModelPublicMessageCache) GetIDName() string {
|
||||
return "id"
|
||||
}
|
||||
|
||||
// GetPrefix returns the table prefix
|
||||
func (m ModelPublicMessageCache) GetPrefix() string {
|
||||
return "MCE"
|
||||
}
|
||||
66
pkg/models/sql_public_sessions.go
Normal file
66
pkg/models/sql_public_sessions.go
Normal file
@@ -0,0 +1,66 @@
|
||||
// Code generated by relspecgo. DO NOT EDIT.
|
||||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
resolvespec_common "github.com/bitechdev/ResolveSpec/pkg/spectypes"
|
||||
"github.com/uptrace/bun"
|
||||
)
|
||||
|
||||
type ModelPublicSession struct {
|
||||
bun.BaseModel `bun:"table:sessions,alias:sessions"`
|
||||
ID resolvespec_common.SqlString `bun:"id,type:varchar(36),pk," json:"id"` // UUID
|
||||
CreatedAt resolvespec_common.SqlTime `bun:"created_at,type:timestamp,default:now(),notnull," json:"created_at"`
|
||||
ExpiresAt resolvespec_common.SqlTime `bun:"expires_at,type:timestamp,notnull," json:"expires_at"`
|
||||
IpAddress resolvespec_common.SqlString `bun:"ip_address,type:varchar(50),nullzero," json:"ip_address"`
|
||||
Token resolvespec_common.SqlString `bun:"token,type:varchar(255),notnull," json:"token"` // Session token hash
|
||||
UpdatedAt resolvespec_common.SqlTime `bun:"updated_at,type:timestamp,default:now(),notnull," json:"updated_at"`
|
||||
UserAgent resolvespec_common.SqlString `bun:"user_agent,type:text,nullzero," json:"user_agent"`
|
||||
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 ModelPublicSession
|
||||
func (m ModelPublicSession) TableName() string {
|
||||
return "sessions"
|
||||
}
|
||||
|
||||
// TableNameOnly returns the table name without schema for ModelPublicSession
|
||||
func (m ModelPublicSession) TableNameOnly() string {
|
||||
return "sessions"
|
||||
}
|
||||
|
||||
// SchemaName returns the schema name for ModelPublicSession
|
||||
func (m ModelPublicSession) SchemaName() string {
|
||||
return "public"
|
||||
}
|
||||
|
||||
// GetID returns the primary key value
|
||||
func (m ModelPublicSession) GetID() int64 {
|
||||
return m.ID.Int64()
|
||||
}
|
||||
|
||||
// GetIDStr returns the primary key as a string
|
||||
func (m ModelPublicSession) GetIDStr() string {
|
||||
return fmt.Sprintf("%d", m.ID)
|
||||
}
|
||||
|
||||
// SetID sets the primary key value
|
||||
func (m ModelPublicSession) SetID(newid int64) {
|
||||
m.UpdateID(newid)
|
||||
}
|
||||
|
||||
// UpdateID updates the primary key value
|
||||
func (m *ModelPublicSession) UpdateID(newid int64) {
|
||||
m.ID.FromString(fmt.Sprintf("%d", newid))
|
||||
}
|
||||
|
||||
// GetIDName returns the name of the primary key column
|
||||
func (m ModelPublicSession) GetIDName() string {
|
||||
return "id"
|
||||
}
|
||||
|
||||
// GetPrefix returns the table prefix
|
||||
func (m ModelPublicSession) GetPrefix() string {
|
||||
return "SES"
|
||||
}
|
||||
72
pkg/models/sql_public_users.go
Normal file
72
pkg/models/sql_public_users.go
Normal file
@@ -0,0 +1,72 @@
|
||||
// Code generated by relspecgo. DO NOT EDIT.
|
||||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
resolvespec_common "github.com/bitechdev/ResolveSpec/pkg/spectypes"
|
||||
"github.com/uptrace/bun"
|
||||
)
|
||||
|
||||
type ModelPublicUser struct {
|
||||
bun.BaseModel `bun:"table:users,alias:users"`
|
||||
ID resolvespec_common.SqlString `bun:"id,type:varchar(36),pk," json:"id"` // UUID
|
||||
Active bool `bun:"active,type:boolean,default:true,notnull," json:"active"`
|
||||
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"` // Soft delete
|
||||
Email resolvespec_common.SqlString `bun:"email,type:varchar(255),notnull," json:"email"`
|
||||
FullName resolvespec_common.SqlString `bun:"full_name,type:varchar(255),nullzero," json:"full_name"`
|
||||
Password resolvespec_common.SqlString `bun:"password,type:varchar(255),notnull," json:"password"` // Bcrypt hashed password
|
||||
Role resolvespec_common.SqlString `bun:"role,type:varchar(50),default:user,notnull," json:"role"` // admin
|
||||
UpdatedAt resolvespec_common.SqlTime `bun:"updated_at,type:timestamp,default:now(),notnull," json:"updated_at"`
|
||||
Username resolvespec_common.SqlString `bun:"username,type:varchar(255),notnull," json:"username"`
|
||||
RelUserIDPublicAPIKeys []*ModelPublicAPIKey `bun:"rel:has-many,join:id=user_id" json:"reluseridpublicapikeys,omitempty"` // Has many ModelPublicAPIKey
|
||||
RelUserIDPublicHooks []*ModelPublicHook `bun:"rel:has-many,join:id=user_id" json:"reluseridpublichooks,omitempty"` // Has many ModelPublicHook
|
||||
RelUserIDPublicWhatsappAccounts []*ModelPublicWhatsappAccount `bun:"rel:has-many,join:id=user_id" json:"reluseridpublicwhatsappaccounts,omitempty"` // Has many ModelPublicWhatsappAccount
|
||||
RelUserIDPublicEventLogs []*ModelPublicEventLog `bun:"rel:has-many,join:id=user_id" json:"reluseridpubliceventlogs,omitempty"` // Has many ModelPublicEventLog
|
||||
RelUserIDPublicSessions []*ModelPublicSession `bun:"rel:has-many,join:id=user_id" json:"reluseridpublicsessions,omitempty"` // Has many ModelPublicSession
|
||||
}
|
||||
|
||||
// TableName returns the table name for ModelPublicUser
|
||||
func (m ModelPublicUser) TableName() string {
|
||||
return "users"
|
||||
}
|
||||
|
||||
// TableNameOnly returns the table name without schema for ModelPublicUser
|
||||
func (m ModelPublicUser) TableNameOnly() string {
|
||||
return "users"
|
||||
}
|
||||
|
||||
// SchemaName returns the schema name for ModelPublicUser
|
||||
func (m ModelPublicUser) SchemaName() string {
|
||||
return "public"
|
||||
}
|
||||
|
||||
// GetID returns the primary key value
|
||||
func (m ModelPublicUser) GetID() int64 {
|
||||
return m.ID.Int64()
|
||||
}
|
||||
|
||||
// GetIDStr returns the primary key as a string
|
||||
func (m ModelPublicUser) GetIDStr() string {
|
||||
return fmt.Sprintf("%d", m.ID)
|
||||
}
|
||||
|
||||
// SetID sets the primary key value
|
||||
func (m ModelPublicUser) SetID(newid int64) {
|
||||
m.UpdateID(newid)
|
||||
}
|
||||
|
||||
// UpdateID updates the primary key value
|
||||
func (m *ModelPublicUser) UpdateID(newid int64) {
|
||||
m.ID.FromString(fmt.Sprintf("%d", newid))
|
||||
}
|
||||
|
||||
// GetIDName returns the name of the primary key column
|
||||
func (m ModelPublicUser) GetIDName() string {
|
||||
return "id"
|
||||
}
|
||||
|
||||
// GetPrefix returns the table prefix
|
||||
func (m ModelPublicUser) GetPrefix() string {
|
||||
return "USE"
|
||||
}
|
||||
71
pkg/models/sql_public_whatsapp_accounts.go
Normal file
71
pkg/models/sql_public_whatsapp_accounts.go
Normal file
@@ -0,0 +1,71 @@
|
||||
// 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"
|
||||
}
|
||||
Reference in New Issue
Block a user