Update MongoDB Driver and Configuration for Company Entities

- Updated the MongoDB driver from v1.17.4 to v2.3.0, ensuring compatibility with the latest features and improvements.
- Refactored company-related entity and repository files to utilize the new driver, replacing `primitive.ObjectID` with `bson.ObjectID` for ID handling.
- Adjusted the configuration in `.drone.yml` to include the `main` branch in the trigger settings, enhancing CI/CD pipeline flexibility.
This commit is contained in:
n.nakhostin
2025-09-09 18:53:39 +03:30
parent 57c29dc58f
commit 5d721705b7
24 changed files with 64 additions and 130 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
package mongo
import (
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/v2/bson"
)
// Logger defines the interface for logging operations
@@ -32,7 +32,7 @@ type IDSetter interface {
// Model provides a common base for MongoDB documents
type Model struct {
ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
ID bson.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
CreatedAt int64 `bson:"created_at" json:"created_at"`
UpdatedAt int64 `bson:"updated_at" json:"updated_at"`
}
@@ -44,7 +44,7 @@ func (b *Model) GetID() string {
// SetID sets the document ID
func (b *Model) SetID(id string) {
b.ID, _ = primitive.ObjectIDFromHex(id)
b.ID, _ = bson.ObjectIDFromHex(id)
}
// SetCreatedAt sets the creation timestamp