|
|
|
|
@ -3,9 +3,10 @@ package inventory
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"fmt"
|
|
|
|
|
"github.com/cloudreve/Cloudreve/v4/inventory/types"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/cloudreve/Cloudreve/v4/inventory/types"
|
|
|
|
|
|
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
|
|
|
"github.com/cloudreve/Cloudreve/v4/ent"
|
|
|
|
|
"github.com/cloudreve/Cloudreve/v4/ent/file"
|
|
|
|
|
@ -23,14 +24,6 @@ type (
|
|
|
|
|
LoadShareUser struct{}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// WithShareEagerLoad returns a context with share eager loading options enabled.
|
|
|
|
|
// This loads the share's associated user and file when querying.
|
|
|
|
|
func WithShareEagerLoad(ctx context.Context) context.Context {
|
|
|
|
|
ctx = context.WithValue(ctx, LoadShareUser{}, true)
|
|
|
|
|
ctx = context.WithValue(ctx, LoadShareFile{}, true)
|
|
|
|
|
return ctx
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
ErrShareLinkExpired = fmt.Errorf("share link expired")
|
|
|
|
|
ErrOwnerInactive = fmt.Errorf("owner is inactive")
|
|
|
|
|
|