light modification

This commit is contained in:
mr 2025-01-17 13:19:20 +01:00
parent d44fb976e4
commit ed787683f4

View File

@ -124,13 +124,15 @@ func genericLoadAll[T DBObject](res *mgb.Cursor, code int, err error, onlyDraft
if err = res.All(mongo.MngoCtx, &results); err != nil { if err = res.All(mongo.MngoCtx, &results); err != nil {
return nil, 404, err return nil, 404, err
} }
fmt.Println("results", results)
for _, r := range results { for _, r := range results {
fmt.Println(!r.VerifyAuth(a.GetRequest()), f(r), (onlyDraft && !r.IsDrafted()) || (!onlyDraft && r.IsDrafted()), onlyDraft && !r.IsDrafted(), !onlyDraft && r.IsDrafted())
if !r.VerifyAuth(a.GetRequest()) || f(r) == nil || (onlyDraft && !r.IsDrafted()) || (!onlyDraft && r.IsDrafted()) { if !r.VerifyAuth(a.GetRequest()) || f(r) == nil || (onlyDraft && !r.IsDrafted()) || (!onlyDraft && r.IsDrafted()) {
continue continue
} }
fmt.Println(!r.VerifyAuth(a.GetRequest()), f(r) == nil, (onlyDraft && !r.IsDrafted()) || (!onlyDraft && r.IsDrafted()), onlyDraft && !r.IsDrafted(), !onlyDraft && r.IsDrafted())
objs = append(objs, f(r)) objs = append(objs, f(r))
} }
fmt.Println("results 2", results, objs)
return objs, 200, nil return objs, 200, nil
} }