MCPcopy Create free account
hub / github.com/cloudreve/cloudreve / Downloaded

Method Downloaded

inventory/share.go:216–225  ·  view source on GitHub ↗

Downloaded increments the download count of the share.

(ctx context.Context, share *ent.Share)

Source from the content-addressed store, hash-verified

214
215// Downloaded increments the download count of the share.
216func (c *shareClient) Downloaded(ctx context.Context, share *ent.Share) error {
217 stm := c.client.Share.
218 UpdateOneID(share.ID).
219 AddDownloads(1)
220 if share.RemainDownloads != nil && *share.RemainDownloads >= 0 {
221 stm.AddRemainDownloads(-1)
222 }
223 _, err := stm.Save(ctx)
224 return err
225}
226
227func IsValidShare(share *ent.Share) error {
228 // Check if share is expired

Callers

nothing calls this directly

Calls 4

AddDownloadsMethod · 0.45
UpdateOneIDMethod · 0.45
AddRemainDownloadsMethod · 0.45
SaveMethod · 0.45

Tested by

no test coverage detected