Skip to content

Commit

Permalink
add search key to deposit query
Browse files Browse the repository at this point in the history
  • Loading branch information
deinelieblings committed Sep 8, 2023
1 parent e93cb6b commit 4b341cb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions models/deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ type (
DepositQuery struct {
ID []string `query:"id"`
Name string `query:"deposit_unit_name"`
Search string `query:"search"`
ReasonForPayment string `query:"reason_for_payment"`
CrewID []string `query:"crew_id"`
Status []string `query:"deposit_status"`
Expand Down Expand Up @@ -228,6 +229,7 @@ func (i *DepositUpdate) DepositDatabase(current *Deposit) (r *DepositUpdate, cre
func (i *DepositQuery) PermittedFilter(token *vcapool.AccessToken) bson.D {
filter := vmdb.NewFilter()
filter.EqualStringList("_id", i.ID)
filter.SearchString([]string{"deposit_units.taking.name", "reason_for_payment"}, i.Search)
if !token.Roles.Validate("admin;employee") {
filter.EqualString("crew_id", token.CrewID)
} else {
Expand Down

0 comments on commit 4b341cb

Please sign in to comment.