Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
NACSOS Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MCC APSIS
NACSOS
NACSOS Core
Commits
76661e74
Commit
76661e74
authored
2 years ago
by
Tim Repke
Browse files
Options
Downloads
Patches
Plain Diff
update delete_import return value
parent
41bf27fd
No related branches found
No related tags found
2 merge requests
!21
Deploy deletion cascades & pipeline integration
,
!19
Delete import
Pipeline
#1060
failed
2 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/api/routes/imports.py
+11
-7
11 additions, 7 deletions
server/api/routes/imports.py
with
11 additions
and
7 deletions
server/api/routes/imports.py
+
11
−
7
View file @
76661e74
...
...
@@ -2,11 +2,11 @@ from fastapi import APIRouter, Depends
from
nacsos_data.models.imports
import
ImportModel
,
ImportType
from
nacsos_data.db.crud.imports
import
\
read_all_imports_for_project
,
\
read_import
,
\
upsert_import
,
\
read_item_count_for_import
,
\
delete_import
upsert_import
,
\
delete_import
,
\
read_all_imports_for_project
,
\
read_item_count_for_import
from
nacsos_data.util.pipelines.imports
import
submit_jsonl_import_task
,
submit_wos_import_task
from
server.data
import
db_engine
...
...
@@ -71,14 +71,18 @@ async def trigger_import(import_id: str,
engine
=
db_engine
)
else
:
raise
NotImplementedError
(
f
'
No import trigger for
"
{
import_details
.
type
}
"
implemented yet.
'
)
else
:
raise
InsufficientPermissions
(
'
You do not have permission to edit this data import.
'
)
raise
InsufficientPermissions
(
'
You do not have permission to edit this data import.
'
)
@router.delete
(
'
/import/delete/{import_id}
'
,
response_model
=
str
)
async
def
delete_import_details
(
import_id
:
str
,
permissions
:
UserPermissions
=
Depends
(
UserPermissionChecker
(
'
imports_edit
'
))):
import_details
=
await
read_import
(
import_id
=
import_id
,
engine
=
db_engine
)
# First, make sure the user trying to delete this import is actually authorised to delete this specific import
if
import_details
is
not
None
and
str
(
import_details
.
project_id
)
==
str
(
permissions
.
permissions
.
project_id
):
await
delete_import
(
import_id
=
import_id
,
engine
=
db_engine
)
return
f
'
Successfully deleted import with ID:
{
import_id
}
'
return
str
(
import_id
)
raise
InsufficientPermissions
(
'
You do not have permission to delete this data import.
'
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment