-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.go
33 lines (25 loc) · 853 Bytes
/
service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package file
import (
"context"
"github.com/agreyfox/baas"
)
// Service is the implementation of the file service interface.
// It will handle the apps business logic concerning files.
type Service struct {
FileStorage baas.FileStorage
}
func (s *Service) Create(ctx context.Context, n *baas.NewFile) (*baas.File, error) {
return s.FileStorage.Store(ctx, n)
}
func (s *Service) File(ctx context.Context, id string) (*baas.File, error) {
return s.FileStorage.File(ctx, id)
}
func (s *Service) ApplicationFiles(ctx context.Context, applicationID, sinceID string, limit int) ([]*baas.File, error) {
if limit == 0 {
limit = baas.DefaultFilePaginationLimit
}
return s.FileStorage.ApplicationFiles(ctx, applicationID, sinceID, limit)
}
func (s *Service) Delete(ctx context.Context, id string) error {
return s.FileStorage.Delete(ctx, id)
}