2024-07-23 00:08:04 +00:00
|
|
|
package events
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
2024-07-23 14:53:01 +00:00
|
|
|
server "grain/server/types"
|
2024-07-23 00:08:04 +00:00
|
|
|
|
|
|
|
"go.mongodb.org/mongo-driver/mongo"
|
|
|
|
)
|
|
|
|
|
2024-07-23 14:53:01 +00:00
|
|
|
func HandleUnknownKind(ctx context.Context, evt server.Event, collection *mongo.Collection) error {
|
2024-07-23 00:08:04 +00:00
|
|
|
_, err := collection.InsertOne(ctx, evt)
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("Error inserting unknown event into MongoDB: %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println("Inserted unknown event into MongoDB:", evt.ID)
|
|
|
|
return nil
|
|
|
|
}
|