feat: sync public links and phone change updates
This commit is contained in:
parent
41c7f1d018
commit
da04c0fa6a
53 changed files with 3029 additions and 111 deletions
|
|
@ -7,6 +7,8 @@ package sqlcgen
|
|||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
const getAuthKey = `-- name: GetAuthKey :one
|
||||
|
|
@ -15,9 +17,16 @@ FROM auth_keys
|
|||
WHERE auth_key_id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetAuthKey(ctx context.Context, authKeyID int64) (AuthKey, error) {
|
||||
type GetAuthKeyRow struct {
|
||||
AuthKeyID int64
|
||||
Body []byte
|
||||
ServerSalt int64
|
||||
CreatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
func (q *Queries) GetAuthKey(ctx context.Context, authKeyID int64) (GetAuthKeyRow, error) {
|
||||
row := q.db.QueryRow(ctx, getAuthKey, authKeyID)
|
||||
var i AuthKey
|
||||
var i GetAuthKeyRow
|
||||
err := row.Scan(
|
||||
&i.AuthKeyID,
|
||||
&i.Body,
|
||||
|
|
|
|||
|
|
@ -164,10 +164,16 @@ type AttachMenuUserState struct {
|
|||
}
|
||||
|
||||
type AuthKey struct {
|
||||
AuthKeyID int64
|
||||
Body []byte
|
||||
ServerSalt int64
|
||||
CreatedAt pgtype.Timestamptz
|
||||
AuthKeyID int64
|
||||
Body []byte
|
||||
ServerSalt int64
|
||||
CreatedAt pgtype.Timestamptz
|
||||
Layer int32
|
||||
DeviceModel string
|
||||
Platform string
|
||||
SystemVersion string
|
||||
ApiID int32
|
||||
AppVersion string
|
||||
}
|
||||
|
||||
type Authorization struct {
|
||||
|
|
@ -201,6 +207,22 @@ type AvailableReaction struct {
|
|||
SortOrder int32
|
||||
}
|
||||
|
||||
type BootstrapUpdateJob struct {
|
||||
ID int64
|
||||
Kind string
|
||||
UserID int64
|
||||
AuthKeyID int64
|
||||
SessionID int64
|
||||
MessageBoxID int32
|
||||
Status string
|
||||
Attempts int32
|
||||
LastError string
|
||||
CreatedAt pgtype.Timestamptz
|
||||
UpdatedAt pgtype.Timestamptz
|
||||
ReadyAt pgtype.Timestamptz
|
||||
PublishedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type Bot struct {
|
||||
BotUserID int64
|
||||
OwnerUserID int64
|
||||
|
|
@ -218,6 +240,24 @@ type Bot struct {
|
|||
BotInlineGeo bool
|
||||
}
|
||||
|
||||
type BotApiUpdate struct {
|
||||
ID int64
|
||||
BotUserID int64
|
||||
UpdateKind string
|
||||
PeerType string
|
||||
PeerID int64
|
||||
MessageID int32
|
||||
SourcePts int32
|
||||
Date int32
|
||||
CreatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type BotApiUpdateState struct {
|
||||
BotUserID int64
|
||||
ConfirmedUpdateID int64
|
||||
UpdatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type BotApp struct {
|
||||
ID int64
|
||||
BotUserID int64
|
||||
|
|
@ -663,6 +703,30 @@ type ChannelUpdateEvent struct {
|
|||
CreatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type ChatlistInvite struct {
|
||||
ID int64
|
||||
OwnerUserID int64
|
||||
FilterID int32
|
||||
Slug string
|
||||
Title string
|
||||
Peers []byte
|
||||
Revoked bool
|
||||
Deleted bool
|
||||
CreatedAt pgtype.Timestamptz
|
||||
UpdatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type ChatlistMembership struct {
|
||||
UserID int64
|
||||
LocalFilterID int32
|
||||
OwnerUserID int64
|
||||
OwnerFilterID int32
|
||||
Slug string
|
||||
HiddenUpdates bool
|
||||
JoinedAt pgtype.Timestamptz
|
||||
UpdatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type Contact struct {
|
||||
UserID int64
|
||||
ContactUserID int64
|
||||
|
|
@ -857,6 +921,8 @@ type GroupCall struct {
|
|||
InviteLink string
|
||||
RandomID int64
|
||||
MigratedFromPhoneCallID int64
|
||||
RtmpStream bool
|
||||
ScheduleDate int32
|
||||
}
|
||||
|
||||
type GroupCallChainBlock struct {
|
||||
|
|
@ -895,6 +961,7 @@ type GroupCallParticipant struct {
|
|||
LastCheckDate int32
|
||||
PublicKey []byte
|
||||
JoinBlock []byte
|
||||
JoinAsChannelID int64
|
||||
}
|
||||
|
||||
type GroupCallParticipantOverride struct {
|
||||
|
|
@ -905,6 +972,17 @@ type GroupCallParticipantOverride struct {
|
|||
Volume int32
|
||||
}
|
||||
|
||||
type GroupCallRtmpKey struct {
|
||||
ChannelID int64
|
||||
StreamKey string
|
||||
UpdatedAt int32
|
||||
}
|
||||
|
||||
type GroupCallScheduleSubscriber struct {
|
||||
CallID int64
|
||||
UserID int64
|
||||
}
|
||||
|
||||
type LangPack struct {
|
||||
LangPack string
|
||||
LangCode string
|
||||
|
|
@ -1197,6 +1275,7 @@ type ScheduledMessage struct {
|
|||
Body string
|
||||
Entities []byte
|
||||
Media []byte
|
||||
RichMessage []byte
|
||||
Silent bool
|
||||
Noforwards bool
|
||||
ReplyToMsgID int32
|
||||
|
|
@ -1555,6 +1634,7 @@ type UserUpdateEvent struct {
|
|||
QuickReplyMessage []byte
|
||||
StoryPayload []byte
|
||||
ReactionPayload []byte
|
||||
EventPhone string
|
||||
}
|
||||
|
||||
type UserUpdateWatermark struct {
|
||||
|
|
|
|||
|
|
@ -881,6 +881,56 @@ func (q *Queries) UpdateUserPersonalChannel(ctx context.Context, arg UpdateUserP
|
|||
return i, err
|
||||
}
|
||||
|
||||
const updateUserPhone = `-- name: UpdateUserPhone :one
|
||||
UPDATE users
|
||||
SET phone = $1::text,
|
||||
updated_at = now()
|
||||
WHERE id = $2::bigint
|
||||
RETURNING id, access_hash, phone, first_name, last_name, username, country_code, created_at, updated_at, verified, support, about, last_seen_at, default_history_ttl_period, is_bot, bot_info_version, premium_expires_at, emoji_status_document_id, emoji_status_until, color_set, color, color_background_emoji_id, profile_color_set, profile_color, profile_color_background_emoji_id, birthday_day, birthday_month, birthday_year, personal_channel_id
|
||||
`
|
||||
|
||||
type UpdateUserPhoneParams struct {
|
||||
Phone string
|
||||
ID int64
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateUserPhone(ctx context.Context, arg UpdateUserPhoneParams) (User, error) {
|
||||
row := q.db.QueryRow(ctx, updateUserPhone, arg.Phone, arg.ID)
|
||||
var i User
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.AccessHash,
|
||||
&i.Phone,
|
||||
&i.FirstName,
|
||||
&i.LastName,
|
||||
&i.Username,
|
||||
&i.CountryCode,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.Verified,
|
||||
&i.Support,
|
||||
&i.About,
|
||||
&i.LastSeenAt,
|
||||
&i.DefaultHistoryTtlPeriod,
|
||||
&i.IsBot,
|
||||
&i.BotInfoVersion,
|
||||
&i.PremiumExpiresAt,
|
||||
&i.EmojiStatusDocumentID,
|
||||
&i.EmojiStatusUntil,
|
||||
&i.ColorSet,
|
||||
&i.Color,
|
||||
&i.ColorBackgroundEmojiID,
|
||||
&i.ProfileColorSet,
|
||||
&i.ProfileColor,
|
||||
&i.ProfileColorBackgroundEmojiID,
|
||||
&i.BirthdayDay,
|
||||
&i.BirthdayMonth,
|
||||
&i.BirthdayYear,
|
||||
&i.PersonalChannelID,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const updateUserProfile = `-- name: UpdateUserProfile :one
|
||||
UPDATE users
|
||||
SET first_name = $2,
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ INSERT INTO user_update_events (
|
|||
date,
|
||||
event_type,
|
||||
event_bool,
|
||||
event_phone,
|
||||
event_peers,
|
||||
peer_settings,
|
||||
message_ids,
|
||||
|
|
@ -41,7 +42,7 @@ INSERT INTO user_update_events (
|
|||
$4,
|
||||
$5,
|
||||
$6::boolean,
|
||||
$7::jsonb,
|
||||
$7::text,
|
||||
$8::jsonb,
|
||||
$9::jsonb,
|
||||
$10::jsonb,
|
||||
|
|
@ -49,15 +50,16 @@ INSERT INTO user_update_events (
|
|||
$12::jsonb,
|
||||
$13::jsonb,
|
||||
$14::jsonb,
|
||||
$15,
|
||||
$16::text,
|
||||
$17::bigint,
|
||||
$18::int,
|
||||
$15::jsonb,
|
||||
$16,
|
||||
$17::text,
|
||||
$18::bigint,
|
||||
$19::int,
|
||||
$20::int,
|
||||
$21::int,
|
||||
$22::boolean,
|
||||
$23::int
|
||||
$22::int,
|
||||
$23::boolean,
|
||||
$24::int
|
||||
)
|
||||
`
|
||||
|
||||
|
|
@ -68,6 +70,7 @@ type AppendUserUpdateEventParams struct {
|
|||
Date int32
|
||||
EventType string
|
||||
EventBool bool
|
||||
EventPhone string
|
||||
EventPeers []byte
|
||||
PeerSettings []byte
|
||||
MessageIds []byte
|
||||
|
|
@ -95,6 +98,7 @@ func (q *Queries) AppendUserUpdateEvent(ctx context.Context, arg AppendUserUpdat
|
|||
arg.Date,
|
||||
arg.EventType,
|
||||
arg.EventBool,
|
||||
arg.EventPhone,
|
||||
arg.EventPeers,
|
||||
arg.PeerSettings,
|
||||
arg.MessageIds,
|
||||
|
|
@ -124,6 +128,7 @@ SELECT
|
|||
e.date,
|
||||
e.event_type,
|
||||
e.event_bool,
|
||||
e.event_phone,
|
||||
COALESCE(e.event_peers::text, '[]')::text AS event_peers_json,
|
||||
COALESCE(e.peer_settings::text, '{}')::text AS peer_settings_json,
|
||||
COALESCE(e.message_ids::text, '[]')::text AS message_ids_json,
|
||||
|
|
@ -260,6 +265,7 @@ type BatchListDispatchEventsRow struct {
|
|||
Date int32
|
||||
EventType string
|
||||
EventBool bool
|
||||
EventPhone string
|
||||
EventPeersJson string
|
||||
PeerSettingsJson string
|
||||
MessageIdsJson string
|
||||
|
|
@ -394,6 +400,7 @@ func (q *Queries) BatchListDispatchEvents(ctx context.Context, arg BatchListDisp
|
|||
&i.Date,
|
||||
&i.EventType,
|
||||
&i.EventBool,
|
||||
&i.EventPhone,
|
||||
&i.EventPeersJson,
|
||||
&i.PeerSettingsJson,
|
||||
&i.MessageIdsJson,
|
||||
|
|
@ -681,6 +688,7 @@ SELECT
|
|||
e.date,
|
||||
e.event_type,
|
||||
e.event_bool,
|
||||
e.event_phone,
|
||||
COALESCE(e.event_peers::text, '[]')::text AS event_peers_json,
|
||||
COALESCE(e.peer_settings::text, '{}')::text AS peer_settings_json,
|
||||
COALESCE(e.message_ids::text, '[]')::text AS message_ids_json,
|
||||
|
|
@ -820,6 +828,7 @@ type ListUserUpdateEventsAfterRow struct {
|
|||
Date int32
|
||||
EventType string
|
||||
EventBool bool
|
||||
EventPhone string
|
||||
EventPeersJson string
|
||||
PeerSettingsJson string
|
||||
MessageIdsJson string
|
||||
|
|
@ -952,6 +961,7 @@ func (q *Queries) ListUserUpdateEventsAfter(ctx context.Context, arg ListUserUpd
|
|||
&i.Date,
|
||||
&i.EventType,
|
||||
&i.EventBool,
|
||||
&i.EventPhone,
|
||||
&i.EventPeersJson,
|
||||
&i.PeerSettingsJson,
|
||||
&i.MessageIdsJson,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue