package activity

import (
	"context"
	"errors"

	"gorm.io/gorm"

	"bindbox-game/internal/repository/mysql/model"
)

// GetActivity 获取活动详情
// 参数: id 活动ID
// 返回: 活动记录与错误
func (s *service) GetActivity(ctx context.Context, id int64) (*model.Activities, error) {
	item, err := s.readDB.Activities.WithContext(ctx).Where(s.readDB.Activities.ID.Eq(id)).First()
	if err != nil {
		if errors.Is(err, gorm.ErrRecordNotFound) {
			return nil, err
		}
		return nil, err
	}
	return item, nil
}
