Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-CloudComputing-E
/
E_Team_KhuBox
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
서승완
2020-06-08 10:18:08 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
06379ad3eae09d14ec0709ab14f86f081ec06d54
06379ad3
1 parent
30ca9b16
feat: implement empty trash api
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletions
khubox-api/khubox/services/files.py
khubox-api/khubox/services/files.py
View file @
06379ad
...
...
@@ -70,7 +70,34 @@ def create(request):
# TODO: 휴지통 비우기
def
empty_trash
(
request
):
return
{
'result'
:
True
}
# TODO: Auth
request
.
user_id
=
1
# Query Files
files
=
File
.
objects
.
filter
(
owner_user_id
=
request
.
user_id
,
is_trahsed
=
1
,
deleted_at__isnull
=
True
)
# First Depth
del_list
=
[]
del_check
=
[]
for
del_file
in
files
:
del_check
.
append
(
del_file
.
id
)
# Child Depth
while
True
:
if
not
del_check
:
break
child_files
=
File
.
objects
.
filter
(
parent_id__in
=
del_check
)
del_list
.
extend
(
del_check
)
del_check
.
clear
()
for
del_file
in
child_files
:
del_check
.
append
(
del_file
.
id
)
# TODO: S3 Delete
# Update
File
.
objects
.
filter
(
id__in
=
del_list
)
.
update
(
is_trahsed
=
1
,
deleted_at
=
timezone
.
now
())
return
{
'result'
:
True
,
'affected'
:
del_list
}
# TODO: 폴더/파일 조회, 파일 다운로드
...
...
Please
register
or
login
to post a comment