feat: sync account deletion lifecycle

Sync telesrv 73f5c91 (feat(account): implement unified account deletion lifecycle).

Skipped telesrv docs changes per public sync rules.
This commit is contained in:
A 2026-07-19 20:35:58 +08:00
parent 96a419b565
commit edb7057757
32 changed files with 3236 additions and 88 deletions

View file

@ -167,7 +167,7 @@ func (q *Queries) InsertBot(ctx context.Context, arg InsertBotParams) error {
const insertBotUser = `-- name: InsertBotUser :one
INSERT INTO users (access_hash, phone, first_name, last_name, username, country_code, is_bot, bot_info_version)
VALUES ($1, '', $2, '', $3, '', TRUE, 1)
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
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, deleted_at, deletion_source, deletion_reason, account_delete_at
`
type InsertBotUserParams struct {
@ -209,6 +209,10 @@ func (q *Queries) InsertBotUser(ctx context.Context, arg InsertBotUserParams) (U
&i.BirthdayMonth,
&i.BirthdayYear,
&i.PersonalChannelID,
&i.DeletedAt,
&i.DeletionSource,
&i.DeletionReason,
&i.AccountDeleteAt,
)
return i, err
}

View file

@ -8,6 +8,32 @@ import (
"github.com/jackc/pgx/v5/pgtype"
)
type AccountDeletionNotification struct {
ID int64
TargetUserID int64
DeletedUserID int64
Status string
Attempts int32
NextAttemptAt pgtype.Timestamptz
LeaseUntil pgtype.Timestamptz
LastError string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
type AccountDeletionRequest struct {
ID int64
UserID int64
RequesterAuthKeyID int64
State string
Reason string
ConfirmHashDigest []byte
RequestedAt pgtype.Timestamptz
ExecuteAt pgtype.Timestamptz
CompletedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
type AccountPassword struct {
UserID int64
HasRecovery bool
@ -30,6 +56,7 @@ type AccountPassword struct {
RecoveryCode string
RecoveryCodeExpiresAt pgtype.Timestamptz
LoginEmail string
PasswordChangedAt pgtype.Timestamptz
}
type AccountPrivacyRule struct {
@ -694,6 +721,42 @@ type ChannelMessageViewer struct {
CreatedAt pgtype.Timestamptz
}
type ChannelStarsBalance struct {
ChannelID int64
Balance int64
UpdatedAt pgtype.Timestamptz
}
type ChannelStarsTransaction struct {
ID int64
ChannelID int64
ActorUserID int64
Amount int64
Reason string
PeerType string
PeerID int64
GiftID *int64
Date int32
}
type ChannelTonBalance struct {
ChannelID int64
BalanceNanoton int64
UpdatedAt pgtype.Timestamptz
}
type ChannelTonTransaction struct {
ID int64
ChannelID int64
ActorUserID int64
AmountNanoton int64
Reason string
PeerType string
PeerID int64
GiftID *int64
Date int32
}
type ChannelTopicRead struct {
ChannelID int64
UserID int64
@ -1156,19 +1219,33 @@ type PasskeyCredential struct {
}
type PeerStarGift struct {
ID int64
OwnerPeerID int64
FromUserID int64
GiftID int64
MsgID int32
GiftDate int32
NameHidden bool
Unsaved bool
Converted bool
ConvertStars int64
Message string
OwnerPeerType string
SavedID int64
ID int64
OwnerPeerID int64
FromUserID int64
GiftID int64
MsgID int32
GiftDate int32
NameHidden bool
Unsaved bool
Converted bool
ConvertStars int64
Message string
OwnerPeerType string
SavedID int64
CatalogRevisionID int64
UniqueGiftID *int64
UpgradeMsgID int32
PinnedOrder int32
PrepaidUpgradeStars int64
LifecycleStatus string
TransferStars int64
PrepaidUpgradeHash string
GiftNum int32
CanExportAt int32
CanTransferAt int32
CanResellAt int32
DropOriginalDetailsStars int64
CanCraftAt int32
}
type PeerTranslationSetting struct {
@ -1417,6 +1494,382 @@ type SeedState struct {
UpdatedAt pgtype.Timestamptz
}
type StarGiftAuction struct {
GiftID int64
Slug string
Version int32
StartDate int32
EndDate int32
RoundDuration int32
GiftsPerRound int32
TotalRounds int32
CurrentRound int32
NextRoundAt int32
LastGiftNum int32
GiftsLeft int32
MinBidAmount int64
Status string
UpdatedAt pgtype.Timestamptz
}
type StarGiftAuctionAcquired struct {
ID int64
GiftID int64
BidderUserID int64
RecipientPeerType string
RecipientPeerID int64
SavedGiftID *int64
BidAmount int64
Round int32
Pos int32
GiftNum *int32
AcquiredAt int32
HideName bool
Message string
}
type StarGiftAuctionBid struct {
GiftID int64
BidderUserID int64
RecipientPeerType string
RecipientPeerID int64
Amount int64
BidDate int32
HideName bool
Message string
Returned bool
AcquiredCount int32
Active bool
Version int64
}
type StarGiftAuctionBidPayment struct {
UserID int64
FormID int64
GiftID int64
BidAmount int64
BalanceAfter int64
CreatedAt int32
}
type StarGiftCatalog struct {
GiftID int64
ActiveRevisionID int64
Enabled bool
SortOrder int32
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
CollectibleRevisionID *int64
AvailabilityRemains int32
AvailabilityResale int64
ResellMinStars int64
FirstSaleDate int32
LastSaleDate int32
}
type StarGiftCatalogRevision struct {
ID int64
GiftID int64
Revision int32
Title string
Stars int64
ConvertStars int64
DocumentID int64
AnimationJson []byte
AnimationSha256 []byte
SourceName string
SourceFormat string
Width int32
Height int32
FrameRate float64
InPoint float64
OutPoint float64
CreatedBy string
CommandID string
CreatedAt pgtype.Timestamptz
OfficialGiftID *int64
SourceManifestSha256 []byte
OfficialSource []byte
Limited bool
SoldOut bool
Birthday bool
RequirePremium bool
LimitedPerUser bool
PeerColorAvailable bool
Auction bool
AvailabilityTotal int32
ReleasedByPeerType *string
ReleasedByPeerID *int64
PerUserTotal int32
LockedUntilDate int32
AuctionSlug string
GiftsPerRound int32
AuctionStartDate int32
UpgradeVariants int32
BackgroundCenterColor *int32
BackgroundEdgeColor *int32
BackgroundTextColor *int32
}
type StarGiftCollectibleBackdrop struct {
ID int64
CollectibleRevisionID int64
Name string
BackdropID int32
CenterColor int32
EdgeColor int32
PatternColor int32
TextColor int32
RarityPermille *int32
SortOrder int32
RarityKind string
}
type StarGiftCollectibleModel struct {
ID int64
CollectibleRevisionID int64
Name string
DocumentID int64
AnimationJson []byte
AnimationSha256 []byte
SourceName string
SourceFormat string
Width int32
Height int32
FrameRate float64
InPoint float64
OutPoint float64
RarityPermille *int32
SortOrder int32
RarityKind string
Crafted bool
OfficialDocumentID *int64
}
type StarGiftCollectiblePattern struct {
ID int64
CollectibleRevisionID int64
Name string
DocumentID int64
AnimationJson []byte
AnimationSha256 []byte
SourceName string
SourceFormat string
Width int32
Height int32
FrameRate float64
InPoint float64
OutPoint float64
RarityPermille *int32
SortOrder int32
RarityKind string
OfficialDocumentID *int64
}
type StarGiftCollectibleRevision struct {
ID int64
GiftID int64
Revision int32
UpgradeStars int64
SupplyTotal int32
Issued int32
SlugPrefix string
Status string
CreatedBy string
CommandID string
CreatedAt pgtype.Timestamptz
PublishedAt pgtype.Timestamptz
OfficialGiftID *int64
SourceManifestSha256 []byte
}
type StarGiftCollection struct {
CollectionID int32
OwnerPeerType string
OwnerPeerID int64
Title string
SortOrder int32
Hash int64
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
type StarGiftCollectionItem struct {
CollectionID int32
SavedGiftID int64
SortOrder int32
CreatedAt pgtype.Timestamptz
}
type StarGiftConversion struct {
SavedGiftID int64
ActorUserID int64
OwnerPeerType string
OwnerPeerID int64
Amount int64
BalanceAfter int64
ConvertedAt int32
}
type StarGiftCraftCommand struct {
UserID int64
CommandKey string
InputUniqueGiftIds []int64
GiftID int64
Success bool
ResultUniqueGiftID *int64
ChancePermille int32
CreatedAt int32
SourceEditPts []int32
}
type StarGiftDropDetailsCommand struct {
UserID int64
CommandKey string
SavedGiftID int64
UniqueGiftID int64
FormID int64
ChargeStars int64
BalanceAfter int64
CreatedAt int32
}
type StarGiftListing struct {
UniqueGiftID int64
SellerPeerType string
SellerPeerID int64
Currency string
Amount int64
ListedAt int32
UpdatedAt int32
Version int64
}
type StarGiftNotificationSetting struct {
UserID int64
ChannelID int64
Enabled bool
UpdatedAt pgtype.Timestamptz
}
type StarGiftOffer struct {
ID int64
BuyerUserID int64
OwnerPeerType string
OwnerPeerID int64
UniqueGiftID int64
Currency string
Amount int64
RandomID int64
OfferMsgID int32
BuyerMsgID int32
Status string
CreatedAt int32
ExpiresAt int32
ResolvedAt int32
BalanceAfter int64
ResolutionNotified bool
}
type StarGiftPrepaidUpgradeCommand struct {
PayerUserID int64
CommandKey string
SavedGiftID int64
FormID int64
ChargeStars int64
BalanceAfter int64
CreatedAt int32
}
type StarGiftPurchaseCommand struct {
BuyerUserID int64
CommandKey string
GiftID int64
RecipientPeerType string
RecipientPeerID int64
SavedGiftID int64
FormID int64
ChargeStars int64
BalanceAfter int64
CreatedAt int32
}
type StarGiftPurchaseForm struct {
BuyerUserID int64
FormID int64
GiftID int64
RevisionID int64
RecipientPeerType string
RecipientPeerID int64
IncludeUpgrade bool
HideName bool
Message string
ChargeStars int64
IssuedAt int32
ExpiresAt int32
}
type StarGiftSale struct {
ID int64
UniqueGiftID int64
SellerPeerType string
SellerPeerID int64
BuyerPeerType string
BuyerPeerID int64
Currency string
Amount int64
CommissionAmount int64
SoldAt int32
CommandKey string
}
type StarGiftTransferCommand struct {
ActorUserID int64
CommandKey string
UniqueGiftID int64
FromPeerType string
FromPeerID int64
ToPeerType string
ToPeerID int64
ChargeStars int64
BalanceAfter int64
CreatedAt int32
}
type StarGiftUpgradeCommand struct {
UserID int64
CommandKey string
SourceSavedGiftID int64
FormID int64
UniqueGiftID int64
BalanceAfter int64
CreatedAt pgtype.Timestamptz
ChargeStars int64
RequirePrepaid bool
KeepOriginalDetails bool
SourceEditPts int32
}
type StarGiftUserPurchase struct {
UserID int64
GiftID int64
PurchasedCount int32
UpdatedAt pgtype.Timestamptz
}
type StarGiftWithdrawalRequest struct {
ID int64
UniqueGiftID int64
OwnerUserID int64
Provider string
ProviderRequestID string
Url string
Status string
CreatedAt int32
ExpiresAt int32
CompletedAt int32
}
type StarsBalance struct {
UserID int64
Balance int64
@ -1564,6 +2017,66 @@ type ThemeUserInstall struct {
InstalledAt pgtype.Timestamptz
}
type TonBalance struct {
UserID int64
BalanceNanoton int64
Granted bool
UpdatedAt pgtype.Timestamptz
}
type TonTransaction struct {
ID int64
UserID int64
AmountNanoton int64
Reason string
PeerType *string
PeerID *int64
GiftID *int64
Date int32
}
type UniqueStarGift struct {
ID int64
GiftID int64
CollectibleRevisionID int64
SourceSavedGiftID int64
Title string
Slug string
Num int32
OwnerPeerType *string
OwnerPeerID *int64
ModelAttributeID int64
PatternAttributeID int64
BackdropAttributeID int64
KeepOriginalDetails bool
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
RequirePremium bool
ResaleTonOnly bool
ThemeAvailable bool
Burned bool
Crafted bool
OriginalOwnerPeerType string
OriginalOwnerPeerID int64
OwnerName string
OwnerAddress string
GiftAddress string
ReleasedByPeerType *string
ReleasedByPeerID *int64
ValueAmount int64
ValueCurrency string
ValueUsdAmount int64
ThemePeerType *string
ThemePeerID *int64
HostPeerType *string
HostPeerID *int64
OfferMinStars int32
CraftChancePermille int32
LastSaleDate int32
LastSaleCurrency string
LastSaleAmount int64
}
type UpdateState struct {
AuthKeyID int64
Pts int32
@ -1627,6 +2140,10 @@ type User struct {
BirthdayMonth int32
BirthdayYear int32
PersonalChannelID int64
DeletedAt pgtype.Timestamptz
DeletionSource string
DeletionReason string
AccountDeleteAt pgtype.Timestamptz
}
type UserBusinessProfile struct {

View file

@ -14,7 +14,7 @@ import (
const createUser = `-- name: CreateUser :one
INSERT INTO users (access_hash, phone, first_name, last_name, username, country_code, premium_expires_at)
VALUES ($1, $2, $3, $4, $5, $6, $7)
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
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, deleted_at, deletion_source, deletion_reason, account_delete_at
`
type CreateUserParams struct {
@ -68,12 +68,16 @@ func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, e
&i.BirthdayMonth,
&i.BirthdayYear,
&i.PersonalChannelID,
&i.DeletedAt,
&i.DeletionSource,
&i.DeletionReason,
&i.AccountDeleteAt,
)
return i, err
}
const getUserByID = `-- name: GetUserByID :one
SELECT 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 FROM users WHERE id = $1
SELECT 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, deleted_at, deletion_source, deletion_reason, account_delete_at FROM users WHERE id = $1
`
func (q *Queries) GetUserByID(ctx context.Context, id int64) (User, error) {
@ -109,12 +113,16 @@ func (q *Queries) GetUserByID(ctx context.Context, id int64) (User, error) {
&i.BirthdayMonth,
&i.BirthdayYear,
&i.PersonalChannelID,
&i.DeletedAt,
&i.DeletionSource,
&i.DeletionReason,
&i.AccountDeleteAt,
)
return i, err
}
const getUserByPhone = `-- name: GetUserByPhone :one
SELECT 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 FROM users WHERE phone = $1
SELECT 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, deleted_at, deletion_source, deletion_reason, account_delete_at FROM users WHERE phone = $1 AND deleted_at IS NULL
`
func (q *Queries) GetUserByPhone(ctx context.Context, phone string) (User, error) {
@ -150,12 +158,16 @@ func (q *Queries) GetUserByPhone(ctx context.Context, phone string) (User, error
&i.BirthdayMonth,
&i.BirthdayYear,
&i.PersonalChannelID,
&i.DeletedAt,
&i.DeletionSource,
&i.DeletionReason,
&i.AccountDeleteAt,
)
return i, err
}
const getUserByUsername = `-- name: GetUserByUsername :one
SELECT 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 FROM users WHERE lower(username) = lower($1) AND username <> ''
SELECT 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, deleted_at, deletion_source, deletion_reason, account_delete_at FROM users WHERE lower(username) = lower($1) AND username <> '' AND deleted_at IS NULL
`
func (q *Queries) GetUserByUsername(ctx context.Context, lower string) (User, error) {
@ -191,12 +203,16 @@ func (q *Queries) GetUserByUsername(ctx context.Context, lower string) (User, er
&i.BirthdayMonth,
&i.BirthdayYear,
&i.PersonalChannelID,
&i.DeletedAt,
&i.DeletionSource,
&i.DeletionReason,
&i.AccountDeleteAt,
)
return i, err
}
const getUsersByIDs = `-- name: GetUsersByIDs :many
SELECT 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
SELECT 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, deleted_at, deletion_source, deletion_reason, account_delete_at
FROM users
WHERE id = ANY($1::bigint[])
ORDER BY id
@ -241,6 +257,10 @@ func (q *Queries) GetUsersByIDs(ctx context.Context, ids []int64) ([]User, error
&i.BirthdayMonth,
&i.BirthdayYear,
&i.PersonalChannelID,
&i.DeletedAt,
&i.DeletionSource,
&i.DeletionReason,
&i.AccountDeleteAt,
); err != nil {
return nil, err
}
@ -253,9 +273,9 @@ func (q *Queries) GetUsersByIDs(ctx context.Context, ids []int64) ([]User, error
}
const getUsersByPhones = `-- name: GetUsersByPhones :many
SELECT 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
SELECT 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, deleted_at, deletion_source, deletion_reason, account_delete_at
FROM users
WHERE phone = ANY($1::text[])
WHERE phone = ANY($1::text[]) AND deleted_at IS NULL
ORDER BY id
`
@ -298,6 +318,10 @@ func (q *Queries) GetUsersByPhones(ctx context.Context, phones []string) ([]User
&i.BirthdayMonth,
&i.BirthdayYear,
&i.PersonalChannelID,
&i.DeletedAt,
&i.DeletionSource,
&i.DeletionReason,
&i.AccountDeleteAt,
); err != nil {
return nil, err
}
@ -347,6 +371,7 @@ WITH matched AS (
FROM users u
LEFT JOIN contacts c ON c.user_id = $4::bigint AND c.contact_user_id = u.id
WHERE u.id <> $4::bigint
AND u.deleted_at IS NULL
AND $3::text <> ''
AND (
($2::text <> '' AND u.phone LIKE $2::text || '%')
@ -479,8 +504,8 @@ const setUserPremiumUntil = `-- name: SetUserPremiumUntil :one
UPDATE users
SET premium_expires_at = $1::timestamptz,
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
WHERE id = $2::bigint AND deleted_at IS NULL
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, deleted_at, deletion_source, deletion_reason, account_delete_at
`
type SetUserPremiumUntilParams struct {
@ -521,6 +546,10 @@ func (q *Queries) SetUserPremiumUntil(ctx context.Context, arg SetUserPremiumUnt
&i.BirthdayMonth,
&i.BirthdayYear,
&i.PersonalChannelID,
&i.DeletedAt,
&i.DeletionSource,
&i.DeletionReason,
&i.AccountDeleteAt,
)
return i, err
}
@ -529,8 +558,8 @@ const setUserVerified = `-- name: SetUserVerified :one
UPDATE users
SET verified = $1::boolean,
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
WHERE id = $2::bigint AND deleted_at IS NULL
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, deleted_at, deletion_source, deletion_reason, account_delete_at
`
type SetUserVerifiedParams struct {
@ -571,6 +600,10 @@ func (q *Queries) SetUserVerified(ctx context.Context, arg SetUserVerifiedParams
&i.BirthdayMonth,
&i.BirthdayYear,
&i.PersonalChannelID,
&i.DeletedAt,
&i.DeletionSource,
&i.DeletionReason,
&i.AccountDeleteAt,
)
return i, err
}
@ -582,11 +615,12 @@ SET premium_expires_at = NULL,
WHERE id IN (
SELECT id FROM users
WHERE premium_expires_at IS NOT NULL
AND deleted_at IS NULL
AND premium_expires_at <= $1::timestamptz
ORDER BY premium_expires_at
LIMIT $2::int
)
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
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, deleted_at, deletion_source, deletion_reason, account_delete_at
`
type SweepExpiredPremiumParams struct {
@ -633,6 +667,10 @@ func (q *Queries) SweepExpiredPremium(ctx context.Context, arg SweepExpiredPremi
&i.BirthdayMonth,
&i.BirthdayYear,
&i.PersonalChannelID,
&i.DeletedAt,
&i.DeletionSource,
&i.DeletionReason,
&i.AccountDeleteAt,
); err != nil {
return nil, err
}
@ -650,8 +688,8 @@ SET birthday_day = $1::int,
birthday_month = $2::int,
birthday_year = $3::int,
updated_at = now()
WHERE id = $4::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
WHERE id = $4::bigint AND deleted_at IS NULL
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, deleted_at, deletion_source, deletion_reason, account_delete_at
`
type UpdateUserBirthdayParams struct {
@ -699,6 +737,10 @@ func (q *Queries) UpdateUserBirthday(ctx context.Context, arg UpdateUserBirthday
&i.BirthdayMonth,
&i.BirthdayYear,
&i.PersonalChannelID,
&i.DeletedAt,
&i.DeletionSource,
&i.DeletionReason,
&i.AccountDeleteAt,
)
return i, err
}
@ -709,8 +751,8 @@ SET color_set = $1::boolean,
color = $2::int,
color_background_emoji_id = $3::bigint,
updated_at = now()
WHERE id = $4::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
WHERE id = $4::bigint AND deleted_at IS NULL
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, deleted_at, deletion_source, deletion_reason, account_delete_at
`
type UpdateUserColorParams struct {
@ -758,6 +800,10 @@ func (q *Queries) UpdateUserColor(ctx context.Context, arg UpdateUserColorParams
&i.BirthdayMonth,
&i.BirthdayYear,
&i.PersonalChannelID,
&i.DeletedAt,
&i.DeletionSource,
&i.DeletionReason,
&i.AccountDeleteAt,
)
return i, err
}
@ -767,8 +813,8 @@ UPDATE users
SET emoji_status_document_id = $1::bigint,
emoji_status_until = $2::bigint,
updated_at = now()
WHERE id = $3::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
WHERE id = $3::bigint AND deleted_at IS NULL
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, deleted_at, deletion_source, deletion_reason, account_delete_at
`
type UpdateUserEmojiStatusParams struct {
@ -810,6 +856,10 @@ func (q *Queries) UpdateUserEmojiStatus(ctx context.Context, arg UpdateUserEmoji
&i.BirthdayMonth,
&i.BirthdayYear,
&i.PersonalChannelID,
&i.DeletedAt,
&i.DeletionSource,
&i.DeletionReason,
&i.AccountDeleteAt,
)
return i, err
}
@ -818,7 +868,7 @@ const updateUserLastSeen = `-- name: UpdateUserLastSeen :exec
UPDATE users
SET last_seen_at = GREATEST(last_seen_at, $1::bigint),
updated_at = now()
WHERE id = $2::bigint
WHERE id = $2::bigint AND deleted_at IS NULL
`
type UpdateUserLastSeenParams struct {
@ -835,8 +885,8 @@ const updateUserPersonalChannel = `-- name: UpdateUserPersonalChannel :one
UPDATE users
SET personal_channel_id = $1::bigint,
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
WHERE id = $2::bigint AND deleted_at IS NULL
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, deleted_at, deletion_source, deletion_reason, account_delete_at
`
type UpdateUserPersonalChannelParams struct {
@ -877,6 +927,10 @@ func (q *Queries) UpdateUserPersonalChannel(ctx context.Context, arg UpdateUserP
&i.BirthdayMonth,
&i.BirthdayYear,
&i.PersonalChannelID,
&i.DeletedAt,
&i.DeletionSource,
&i.DeletionReason,
&i.AccountDeleteAt,
)
return i, err
}
@ -885,8 +939,8 @@ 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
WHERE id = $2::bigint AND deleted_at IS NULL
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, deleted_at, deletion_source, deletion_reason, account_delete_at
`
type UpdateUserPhoneParams struct {
@ -927,6 +981,10 @@ func (q *Queries) UpdateUserPhone(ctx context.Context, arg UpdateUserPhoneParams
&i.BirthdayMonth,
&i.BirthdayYear,
&i.PersonalChannelID,
&i.DeletedAt,
&i.DeletionSource,
&i.DeletionReason,
&i.AccountDeleteAt,
)
return i, err
}
@ -937,8 +995,8 @@ SET first_name = $2,
last_name = $3,
about = $4,
updated_at = now()
WHERE id = $1
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
WHERE id = $1 AND deleted_at IS NULL
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, deleted_at, deletion_source, deletion_reason, account_delete_at
`
type UpdateUserProfileParams struct {
@ -986,6 +1044,10 @@ func (q *Queries) UpdateUserProfile(ctx context.Context, arg UpdateUserProfilePa
&i.BirthdayMonth,
&i.BirthdayYear,
&i.PersonalChannelID,
&i.DeletedAt,
&i.DeletionSource,
&i.DeletionReason,
&i.AccountDeleteAt,
)
return i, err
}
@ -996,8 +1058,8 @@ SET profile_color_set = $1::boolean,
profile_color = $2::int,
profile_color_background_emoji_id = $3::bigint,
updated_at = now()
WHERE id = $4::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
WHERE id = $4::bigint AND deleted_at IS NULL
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, deleted_at, deletion_source, deletion_reason, account_delete_at
`
type UpdateUserProfileColorParams struct {
@ -1045,6 +1107,10 @@ func (q *Queries) UpdateUserProfileColor(ctx context.Context, arg UpdateUserProf
&i.BirthdayMonth,
&i.BirthdayYear,
&i.PersonalChannelID,
&i.DeletedAt,
&i.DeletionSource,
&i.DeletionReason,
&i.AccountDeleteAt,
)
return i, err
}
@ -1053,8 +1119,8 @@ const updateUserUsername = `-- name: UpdateUserUsername :one
UPDATE users
SET username = $2,
updated_at = now()
WHERE id = $1
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
WHERE id = $1 AND deleted_at IS NULL
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, deleted_at, deletion_source, deletion_reason, account_delete_at
`
type UpdateUserUsernameParams struct {
@ -1095,6 +1161,10 @@ func (q *Queries) UpdateUserUsername(ctx context.Context, arg UpdateUserUsername
&i.BirthdayMonth,
&i.BirthdayYear,
&i.PersonalChannelID,
&i.DeletedAt,
&i.DeletionSource,
&i.DeletionReason,
&i.AccountDeleteAt,
)
return i, err
}