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
895e8f36
Commit
895e8f36
authored
2 years ago
by
Tim Repke
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into 'production'
Master See merge request
!15
parents
962bed4d
d34a204c
No related branches found
Branches containing commit
No related tags found
1 merge request
!15
Master
Pipeline
#1019
passed
2 years ago
Stage: build
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/api/routes/annotations.py
+6
-2
6 additions, 2 deletions
server/api/routes/annotations.py
server/api/routes/projects.py
+19
-1
19 additions, 1 deletion
server/api/routes/projects.py
with
25 additions
and
3 deletions
server/api/routes/annotations.py
+
6
−
2
View file @
895e8f36
from
typing
import
TYPE_CHECKING
from
pydantic
import
BaseModel
from
sqlalchemy
import
select
from
sqlalchemy.orm
import
load_only
from
sqlalchemy.ext.asyncio
import
AsyncSession
# noqa: F401
from
fastapi
import
APIRouter
,
Depends
,
HTTPException
,
status
as
http_status
,
Query
from
nacsos_data.db.schemas
import
\
...
...
@@ -71,6 +72,9 @@ from server.api.errors import \
from
server.util.security
import
UserPermissionChecker
from
server.data
import
db_engine
if
TYPE_CHECKING
:
from
sqlalchemy.ext.asyncio
import
AsyncSession
# noqa F401
router
=
APIRouter
()
...
...
@@ -469,7 +473,7 @@ async def list_saved_resolved_annotations(permissions=Depends(UserPermissionChec
BotAnnotationMetaData
.
time_updated
,
BotAnnotationMetaData
.
time_created
))))
\
.
scalars
().
all
()
print
([
BotAnnotationMetaDataBaseModel
.
parse_obj
(
e
.
__dict__
)
for
e
in
exports
])
return
[
BotAnnotationMetaDataBaseModel
.
parse_obj
(
e
.
__dict__
)
for
e
in
exports
]
...
...
This diff is collapsed.
Click to expand it.
server/api/routes/projects.py
+
19
−
1
View file @
895e8f36
import
uuid
from
typing
import
TYPE_CHECKING
from
fastapi
import
APIRouter
,
Depends
from
nacsos_data.db.schemas
import
Project
from
nacsos_data.models.users
import
UserModel
from
nacsos_data.models.projects
import
ProjectModel
...
...
@@ -6,9 +10,12 @@ from nacsos_data.db.crud.projects import read_all_projects, read_all_projects_fo
from
server.api.errors
import
MissingInformationError
from
server.data
import
db_engine
from
server.util.security
import
get_current_active_user
from
server.util.security
import
get_current_active_user
,
get_current_active_superuser
from
server.util.logging
import
get_logger
if
TYPE_CHECKING
:
from
sqlalchemy.ext.asyncio
import
AsyncSession
# noqa F401
logger
=
get_logger
(
'
nacsos.api.route.projects
'
)
router
=
APIRouter
()
...
...
@@ -31,3 +38,14 @@ async def get_all_projects(current_user: UserModel = Depends(get_current_active_
raise
MissingInformationError
(
'
`current_user` has no `user_id`, which points to a serious issue in the system!
'
)
return
await
read_all_projects_for_user
(
current_user
.
user_id
,
engine
=
db_engine
)
@router.put
(
'
/create
'
,
response_model
=
str
)
async
def
create_project
(
project
:
ProjectModel
,
superuser
:
UserModel
=
Depends
(
get_current_active_superuser
))
->
str
:
async
with
db_engine
.
session
()
as
session
:
# type: AsyncSession
if
project
.
project_id
is
None
:
project
.
project_id
=
str
(
uuid
.
uuid4
())
session
.
add
(
Project
(
**
project
.
dict
()))
await
session
.
commit
()
return
str
(
project
.
project_id
)
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