quotation service fixed
This commit is contained in:
@@ -123,6 +123,7 @@ func (p *PlanTemplates) GetByID(ctx context.Context, id bson.ObjectID) (*model.P
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
entity.Normalize()
|
||||
return entity, nil
|
||||
}
|
||||
|
||||
@@ -133,11 +134,15 @@ func (p *PlanTemplates) List(ctx context.Context, filter *model.PaymentPlanTempl
|
||||
|
||||
query := repository.Query()
|
||||
|
||||
if from := strings.ToUpper(strings.TrimSpace(string(filter.FromRail))); from != "" {
|
||||
query = query.Filter(repository.Field("fromRail"), from)
|
||||
if from := normalizedRailFilterValues(filter.FromRail); len(from) == 1 {
|
||||
query = query.Filter(repository.Field("fromRail"), from[0])
|
||||
} else if len(from) > 1 {
|
||||
query = query.In(repository.Field("fromRail"), stringSliceToAny(from)...)
|
||||
}
|
||||
if to := strings.ToUpper(strings.TrimSpace(string(filter.ToRail))); to != "" {
|
||||
query = query.Filter(repository.Field("toRail"), to)
|
||||
if to := normalizedRailFilterValues(filter.ToRail); len(to) == 1 {
|
||||
query = query.Filter(repository.Field("toRail"), to[0])
|
||||
} else if len(to) > 1 {
|
||||
query = query.In(repository.Field("toRail"), stringSliceToAny(to)...)
|
||||
}
|
||||
if network := strings.ToUpper(strings.TrimSpace(filter.Network)); network != "" {
|
||||
query = query.Filter(repository.Field("network"), network)
|
||||
@@ -152,6 +157,7 @@ func (p *PlanTemplates) List(ctx context.Context, filter *model.PaymentPlanTempl
|
||||
if err := cur.Decode(item); err != nil {
|
||||
return err
|
||||
}
|
||||
item.Normalize()
|
||||
templates = append(templates, item)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user