Test: Share model

This commit is contained in:
HFO4
2020-02-01 13:14:50 +08:00
parent 437bdf46d4
commit b49202e7e1
9 changed files with 399 additions and 38 deletions

View File

@@ -240,7 +240,7 @@ func (fs *FileSystem) GetDownloadURL(ctx context.Context, path string, timeout s
return source, nil
}
// GetSource 获取可直接访问文件的外链地址
// Source 获取可直接访问文件的外链地址
func (fs *FileSystem) GetSource(ctx context.Context, fileID uint) (string, error) {
// 查找文件记录
err := fs.resetFileIDIfNotExist(ctx, fileID)

View File

@@ -34,7 +34,7 @@ type shareSource struct {
// BuildShareResponse 构建获取分享信息响应
func BuildShareResponse(share *model.Share, unlocked bool) Share {
creator := share.GetCreator()
creator := share.Creator()
resp := Share{
Key: hashid.HashID(share.ID, hashid.ShareID),
Locked: !unlocked,
@@ -62,13 +62,13 @@ func BuildShareResponse(share *model.Share, unlocked bool) Share {
}
if share.IsDir {
source := share.GetSourceFolder()
source := share.SourceFolder()
resp.Source = &shareSource{
Name: source.Name,
Size: 0,
}
} else {
source := share.GetSourceFile()
source := share.SourceFile()
resp.Source = &shareSource{
Name: source.Name,
Size: source.Size,