test(files): add move folder test and clean code

This commit is contained in:
hexxa 2022-03-05 11:03:51 +08:00 committed by Hexxa
parent 17b4544487
commit 652adba4ad
6 changed files with 74 additions and 80 deletions

View file

@ -160,7 +160,7 @@ func (bs *BoltStore) AddUploadInfos(userID uint64, tmpPath, filePath string, inf
}
if userInfo.UsedSpace+info.Size > int64(userInfo.Quota.SpaceLimit) {
return errors.New("space limit is reached")
return db.ErrQuota
}
// update used space
@ -370,7 +370,6 @@ func (bs *BoltStore) MoveInfos(userID uint64, oldPath, newPath string, isDir boo
return err
}
fmt.Println("\n\n\n4", err)
// add new info
return bs.setFileInfo(tx, userID, newPath, fileInfo)
})

View file

@ -21,6 +21,7 @@ var (
ErrBucketNotFound = errors.New("bucket not found")
ErrKeyNotFound = errors.New("key not found")
ErrCreateExisting = errors.New("create upload info which already exists")
ErrQuota = errors.New("quota limit reached")
)
type FileInfo struct {