mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-10 12:05:58 +08:00
feat: optimize tools up35 (#1552)
* upgrade package and rtc convert * upgrade package and rtc convert * upgrade package and rtc convert
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package table
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/OpenIMSDK/tools/pagination"
|
||||
"time"
|
||||
)
|
||||
|
||||
type MeetingInfo struct {
|
||||
RoomID string `bson:"room_id"`
|
||||
MeetingName string `bson:"meeting_name"`
|
||||
HostUserID string `bson:"host_user_id"`
|
||||
Status int64 `bson:"status"`
|
||||
StartTime time.Time `bson:"start_time"`
|
||||
EndTime time.Time `bson:"end_time"`
|
||||
CreateTime time.Time `bson:"create_time"`
|
||||
Ex string `bson:"ex"`
|
||||
}
|
||||
|
||||
type MeetingInterface interface {
|
||||
Find(ctx context.Context, roomIDs []string) ([]*MeetingInfo, error)
|
||||
CreateMeetingInfo(ctx context.Context, meetingInfo *MeetingInfo) error
|
||||
UpdateMeetingInfo(ctx context.Context, roomID string, update map[string]any) error
|
||||
GetUnCompleteMeetingIDList(ctx context.Context, roomIDs []string) ([]string, error)
|
||||
Delete(ctx context.Context, roomIDs []string) error
|
||||
GetMeetingRecords(ctx context.Context, hostUserID string, startTime, endTime time.Time, pagination pagination.Pagination) (int64, []*MeetingInfo, error)
|
||||
}
|
||||
|
||||
type MeetingInvitationInfo struct {
|
||||
RoomID string `bson:"room_id"`
|
||||
UserID string `bson:"user_id"`
|
||||
CreateTime time.Time `bson:"create_time"`
|
||||
}
|
||||
|
||||
type MeetingInvitationInterface interface {
|
||||
FindUserIDs(ctx context.Context, roomID string) ([]string, error)
|
||||
CreateMeetingInvitationInfo(ctx context.Context, roomID string, inviteeUserIDs []string) error
|
||||
GetUserInvitedMeetingIDs(ctx context.Context, userID string) (meetingIDs []string, err error)
|
||||
Delete(ctx context.Context, roomIDs []string) error
|
||||
GetMeetingRecords(ctx context.Context, joinedUserID string, startTime, endTime time.Time, pagination pagination.Pagination) (int64, []string, error)
|
||||
}
|
||||
|
||||
type MeetingVideoRecord struct {
|
||||
RoomID string `bson:"room_id"`
|
||||
FileURL string `bson:"file_url"`
|
||||
CreateTime time.Time `bson:"create_time"`
|
||||
}
|
||||
|
||||
type MeetingRecordInterface interface {
|
||||
CreateMeetingVideoRecord(ctx context.Context, meetingVideoRecord *MeetingVideoRecord) error
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package table
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/OpenIMSDK/tools/errs"
|
||||
"github.com/OpenIMSDK/tools/pagination"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"time"
|
||||
)
|
||||
|
||||
type SignalModel struct {
|
||||
SID string `bson:"sid"`
|
||||
InviterUserID string `bson:"inviter_user_id"`
|
||||
CustomData string `bson:"custom_data"`
|
||||
GroupID string `bson:"group_id"`
|
||||
RoomID string `bson:"room_id"`
|
||||
Timeout int32 `bson:"timeout"`
|
||||
MediaType string `bson:"media_type"`
|
||||
PlatformID int32 `bson:"platform_id"`
|
||||
SessionType int32 `bson:"session_type"`
|
||||
InitiateTime time.Time `bson:"initiate_time"`
|
||||
EndTime time.Time `bson:"end_time"`
|
||||
FileURL string `bson:"file_url"`
|
||||
|
||||
Title string `bson:"title"`
|
||||
Desc string `bson:"desc"`
|
||||
Ex string `bson:"ex"`
|
||||
IOSPushSound string `bson:"ios_push_sound"`
|
||||
IOSBadgeCount bool `bson:"ios_badge_count"`
|
||||
SignalInfo string `bson:"signal_info"`
|
||||
}
|
||||
|
||||
type SignalInterface interface {
|
||||
Find(ctx context.Context, sids []string) ([]*SignalModel, error)
|
||||
CreateSignal(ctx context.Context, signalModel *SignalModel) error
|
||||
Update(ctx context.Context, sid string, update map[string]any) error
|
||||
UpdateSignalFileURL(ctx context.Context, sID, fileURL string) error
|
||||
UpdateSignalEndTime(ctx context.Context, sID string, endTime time.Time) error
|
||||
Delete(ctx context.Context, sids []string) error
|
||||
PageSignal(ctx context.Context, sesstionType int32, sendID string, startTime, endTime time.Time, pagination pagination.Pagination) (int64, []*SignalModel, error)
|
||||
}
|
||||
|
||||
type SignalInvitationModel struct {
|
||||
SID string `bson:"sid"`
|
||||
UserID string `bson:"user_id"`
|
||||
Status int32 `bson:"status"`
|
||||
InitiateTime time.Time `bson:"initiate_time"`
|
||||
HandleTime time.Time `bson:"handle_time"`
|
||||
}
|
||||
|
||||
type SignalInvitationInterface interface {
|
||||
Find(ctx context.Context, sid string) ([]*SignalInvitationModel, error)
|
||||
CreateSignalInvitation(ctx context.Context, sid string, inviteeUserIDs []string) error
|
||||
HandleSignalInvitation(ctx context.Context, sID, InviteeUserID string, status int32) error
|
||||
PageSID(ctx context.Context, recvID string, startTime, endTime time.Time, pagination pagination.Pagination) (int64, []string, error)
|
||||
Delete(ctx context.Context, sids []string) error
|
||||
}
|
||||
|
||||
func IsNotFound(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
err = errs.Unwrap(err)
|
||||
return err == mongo.ErrNoDocuments || err == redis.Nil
|
||||
}
|
||||
|
||||
func IsDuplicate(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
return mongo.IsDuplicateKeyError(errs.Unwrap(err))
|
||||
}
|
||||
Reference in New Issue
Block a user