// Copyright © 2023 OpenIM. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package database import ( "context" "time" "git.imall.cloud/openim/open-im-server-deploy/pkg/common/storage/model" "github.com/openimsdk/tools/db/pagination" ) // Meeting defines the operations for managing meetings in MongoDB. type Meeting interface { // Create creates a new meeting record. Create(ctx context.Context, meeting *model.Meeting) error // Take retrieves a meeting by meeting ID. Returns an error if not found. Take(ctx context.Context, meetingID string) (*model.Meeting, error) // Update updates meeting information. Update(ctx context.Context, meetingID string, data map[string]any) error // UpdateStatus updates the status of a meeting. UpdateStatus(ctx context.Context, meetingID string, status int32) error // Find finds meetings by meeting IDs. Find(ctx context.Context, meetingIDs []string) ([]*model.Meeting, error) // FindByCreator finds meetings created by a specific user. FindByCreator(ctx context.Context, creatorUserID string, pagination pagination.Pagination) (total int64, meetings []*model.Meeting, err error) // FindAll finds all meetings with pagination. FindAll(ctx context.Context, pagination pagination.Pagination) (total int64, meetings []*model.Meeting, err error) // Search searches meetings by keyword (subject, description). Search(ctx context.Context, keyword string, pagination pagination.Pagination) (total int64, meetings []*model.Meeting, err error) // FindByStatus finds meetings by status. FindByStatus(ctx context.Context, status int32, pagination pagination.Pagination) (total int64, meetings []*model.Meeting, err error) // FindByScheduledTimeRange finds meetings within a scheduled time range. FindByScheduledTimeRange(ctx context.Context, startTime, endTime int64, pagination pagination.Pagination) (total int64, meetings []*model.Meeting, err error) // FindFinishedMeetingsBefore finds finished meetings that ended before the specified time. // This is used for cleanup tasks like dismissing groups after meetings end. FindFinishedMeetingsBefore(ctx context.Context, beforeTime time.Time) ([]*model.Meeting, error) // Delete deletes a meeting by meeting ID. Delete(ctx context.Context, meetingID string) error }