owpengram-server/internal/domain/contact.go
2026-09-01 12:06:31 +03:00

97 lines
2.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package domain
// Contact 是当前账号通讯录中的一个已注册联系人。
//
// FirstName/LastName/Phone/Note 是 owner 视角数据:同一个 target user 在不同
// owner 的通讯录里可以有不同备注,这些字段不回写 users 全局资料。
type Contact struct {
User User
FirstName string
LastName string
Phone string
Note string
NoteEntities []MessageEntity
Mutual bool
CloseFriend bool
}
// ContactList 是通讯录查询结果。
type ContactList struct {
Contacts []Contact
Hash int64
}
// ContactProjectionBatch is a viewer-owned contact read model for fan-out
// projection. Contacts[viewerID][targetUserID] is the same row GetMany(viewer)
// would return; PersonalPhotos carries that viewer's personal photo overrides
// for the same target set.
type ContactProjectionBatch struct {
Contacts map[int64]map[int64]Contact
PersonalPhotos map[int64]map[int64]ProfilePhotoRef
}
// CloseFriendsEditResult describes a full close-friends list replacement.
type CloseFriendsEditResult struct {
AddedUserIDs []int64
RemovedUserIDs []int64
}
// BlockedContact is one owner-visible blocked peer.
type BlockedContact struct {
User User
Date int
}
// BlockedContactList describes contacts.getBlocked output.
type BlockedContactList struct {
Blocked []BlockedContact
Count int
}
// ContactInput 描述一次 owner 视角联系人写入。
type ContactInput struct {
ContactUserID int64
ClientID int64
Phone string
FirstName string
LastName string
Note string
NoteEntities []MessageEntity
AddPhonePrivacyException bool
}
// ImportedContact 是 contacts.importContacts 成功导入项。
type ImportedContact struct {
UserID int64
ClientID int64
}
// ImportContactsResult 是 contacts.importContacts 的业务结果。
type ImportContactsResult struct {
Imported []ImportedContact
Contacts []Contact
RetryContacts []int64
}
// UserSearchResult 是 contacts.search 的业务结果。
// MyResults 放当前账号通讯录内命中的用户Results 放其他全局命中用户。
// ChannelResults 放未加入的公开 channel/supergroup 命中;已加入频道由 dialogs/resolve 路径呈现。
type UserSearchResult struct {
MyResults []User
Results []User
MyChannelResults []Channel
ChannelResults []Channel
}
// PeerSettings 是当前 owner 看某个 peer 的可操作状态。
type PeerSettings struct {
AddContact bool
BlockContact bool
ShareContact bool
NeedContactsException bool
HiddenPeerSettingsBar bool
BusinessBotID int64
BusinessBotManageURL string
BusinessBotPaused bool
BusinessBotCanReply bool
}