mirror of
https://github.com/tgdrive/teldrive.git
synced 2025-01-03 05:47:36 +08:00
changes related to upload check
This commit is contained in:
parent
fb9985d6f0
commit
5f3552c8fe
4 changed files with 10 additions and 10 deletions
|
@ -1,8 +0,0 @@
|
|||
-- +goose Up
|
||||
-- +goose StatementBegin
|
||||
|
||||
ALTER TABLE teldrive.files DROP CONSTRAINT unique_file;
|
||||
|
||||
ALTER TABLE teldrive.files ADD CONSTRAINT unique_file UNIQUE (name, parent_id, user_id,status)
|
||||
|
||||
-- +goose StatementEnd
|
5
database/migrations/20230911113332_alter_table.sql
Normal file
5
database/migrations/20230911113332_alter_table.sql
Normal file
|
@ -0,0 +1,5 @@
|
|||
-- +goose Up
|
||||
|
||||
ALTER TABLE teldrive.files DROP CONSTRAINT IF EXISTS unique_file;
|
||||
|
||||
CREATE UNIQUE INDEX unique_file ON teldrive.files (name, parent_id, user_id) WHERE (status= 'active');
|
|
@ -195,7 +195,10 @@ func (fs *FileService) ListFiles(c *gin.Context) (*schemas.FileResponse, *types.
|
|||
delete(filterQuery, "updated_at")
|
||||
}
|
||||
|
||||
setOrderFilter(query, &pagingParams, &sortingParams)
|
||||
if filterQuery["path"] != "" && filterQuery["name"] != "" {
|
||||
query.Where("parent_id in (?)", fs.Db.Model(&models.File{}).Select("id").Where("path = ?", filterQuery["path"]))
|
||||
delete(filterQuery, "path")
|
||||
}
|
||||
|
||||
query.Order("type DESC").Order(getOrder(sortingParams)).Where(filterQuery)
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 06f9a8b4cac51b199d8fab8be781461d51d8b876
|
||||
Subproject commit a801ba0cbb6dc1d381594c6bfd190a69f52830c7
|
Loading…
Reference in a new issue