submissions: fix list requests
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
b238e4c21d
commit
e905d96917
@ -54,11 +54,18 @@ func (svc *Service) CreateScriptPolicy(ctx context.Context, req *api.ScriptPolic
|
|||||||
// GET /script-policy
|
// GET /script-policy
|
||||||
func (svc *Service) ListScriptPolicy(ctx context.Context, request *api.ListScriptPolicyReq) ([]api.ScriptPolicy, error) {
|
func (svc *Service) ListScriptPolicy(ctx context.Context, request *api.ListScriptPolicyReq) ([]api.ScriptPolicy, error) {
|
||||||
filter := datastore.Optional()
|
filter := datastore.Optional()
|
||||||
//fmt.Println(request)
|
|
||||||
if request.Filter.IsSet() {
|
if request.Filter.IsSet() {
|
||||||
filter.AddNotNil("from_script_hash", request.Filter.Value.FromScriptHash)
|
f := request.Filter.Value
|
||||||
filter.AddNotNil("to_script_id", request.Filter.Value.ToScriptID)
|
if f.FromScriptHash.IsSet(){
|
||||||
filter.AddNotNil("policy", request.Filter.Value.Policy)
|
filter.AddNotNil("from_script_hash", f.FromScriptHash.Value)
|
||||||
|
}
|
||||||
|
if f.ToScriptID.IsSet(){
|
||||||
|
filter.AddNotNil("to_script_id", f.ToScriptID.Value)
|
||||||
|
}
|
||||||
|
if f.Policy.IsSet(){
|
||||||
|
filter.AddNotNil("policy", f.Policy.Value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
items, err := svc.DB.ScriptPolicy().List(ctx, filter, model.Page{
|
items, err := svc.DB.ScriptPolicy().List(ctx, filter, model.Page{
|
||||||
|
@ -71,9 +71,16 @@ func (svc *Service) ListSubmissions(ctx context.Context, request *api.ListSubmis
|
|||||||
filter := datastore.Optional()
|
filter := datastore.Optional()
|
||||||
//fmt.Println(request)
|
//fmt.Println(request)
|
||||||
if request.Filter.IsSet() {
|
if request.Filter.IsSet() {
|
||||||
filter.AddNotNil("display_name", request.Filter.Value.DisplayName)
|
f := request.Filter.Value
|
||||||
filter.AddNotNil("creator", request.Filter.Value.Creator)
|
if f.DisplayName.IsSet(){
|
||||||
filter.AddNotNil("game_id", request.Filter.Value.GameID)
|
filter.Add("display_name", f.DisplayName.Value)
|
||||||
|
}
|
||||||
|
if f.Creator.IsSet(){
|
||||||
|
filter.Add("creator", f.Creator.Value)
|
||||||
|
}
|
||||||
|
if f.GameID.IsSet(){
|
||||||
|
filter.Add("game_id", f.GameID.Value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
items, err := svc.DB.Submissions().List(ctx, filter, model.Page{
|
items, err := svc.DB.Submissions().List(ctx, filter, model.Page{
|
||||||
|
Loading…
Reference in New Issue
Block a user