memos/api/resource.go
2022-02-03 15:32:03 +08:00

41 lines
985 B
Go

package api
type Resource struct {
Id int `jsonapi:"primary,resource"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
Filename string `jsonapi:"attr,filename"`
Blob []byte `jsonapi:"attr,blob"`
Type string `jsonapi:"attr,type"`
Size int64 `jsonapi:"attr,size"`
CreatorId int `jsonapi:"attr,creatorId"`
}
type ResourceCreate struct {
Filename string `jsonapi:"attr,filename"`
Blob []byte `jsonapi:"attr,blob"`
Type string `jsonapi:"attr,type"`
Size int64 `jsonapi:"attr,size"`
CreatorId int `jsonapi:"attr,creatorId"`
}
type ResourceFind struct {
Id *int
CreatorId *int
Filename *string
}
type ResourceDelete struct {
Id int
}
type ResourceService interface {
CreateResource(create *ResourceCreate) (*Resource, error)
FindResourceList(find *ResourceFind) ([]*Resource, error)
FindResource(find *ResourceFind) (*Resource, error)
DeleteResource(delete *ResourceDelete) error
}