customer/internal/dto/get_histories.go
2023-09-14 10:07:28 +00:00

26 lines
592 B
Go

package dto
import (
"go.mongodb.org/mongo-driver/bson"
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/fields"
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/models"
"penahub.gitlab.yandexcloud.net/pena-services/customer/pkg/bsontools"
)
type GetHistories struct {
Pagination *models.Pagination
Type *string
}
func (receiver *GetHistories) BSON() bson.M {
query := bson.M{
fields.History.IsDeleted: false,
}
if receiver.Type != nil {
query[fields.History.Type] = bsontools.BuildCaseInsensitiveRegex(*receiver.Type)
}
return query
}