Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
netvs-middleware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
scc-net
netvs
netvs-middleware
Commits
eed02a99
Commit
eed02a99
authored
1 year ago
by
!! Julian Keck (old Account; do not use) !!
Browse files
Options
Downloads
Patches
Plain Diff
UPD use enum for patch request action types
parent
4fb0683e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/patch_request.py
+2
-2
2 additions, 2 deletions
api/patch_request.py
model/mail_requests.py
+8
-1
8 additions, 1 deletion
model/mail_requests.py
with
10 additions
and
3 deletions
api/patch_request.py
+
2
−
2
View file @
eed02a99
...
...
@@ -8,7 +8,7 @@ from starlette import status
from
api
import
db
,
get_conn
from
model.mail_requests
import
APIPatchRequestAction
,
PatchRequestFormRequest
,
InformalPatchRequestFormRequest
,
\
PatchRequestAction
PatchRequestAction
,
PatchActionType
from
model.settings
import
settings
from
model.wapi.cntl
import
APIToken
,
Mgr
from
model.wapi.nd
import
Port
,
Module
,
Room
,
Bldg
,
Site
...
...
@@ -131,7 +131,7 @@ def validate_patch_request_actions(conn, user, actions: list[APIPatchRequestActi
{
'
idx
'
:
'
bcd_list
'
,
'
name
'
:
'
nd.bcd.list
'
,
'
old
'
:
{
'
name
'
:
action
.
bcd_name
}},
],
user
=
user
.
login_name
)
internal_action
.
bcd
=
Port
(
**
bcd_result
[
'
bcd_list
'
][
0
])
elif
action
.
action
.
lower
()
==
'
p
atch
'
:
elif
action
.
action
==
P
atch
ActionType
.
PATCH
:
raise
HTTPException
(
status_code
=
status
.
HTTP_400_BAD_REQUEST
,
detail
=
'
BCD is required for patch action
'
...
...
This diff is collapsed.
Click to expand it.
model/mail_requests.py
+
8
−
1
View file @
eed02a99
from
typing
import
Optional
from
pydantic
import
BaseModel
,
Field
from
enum
import
Enum
from
model.wapi.nd
import
BCD
,
Bldg
,
Module
,
Room
,
Port
,
Site
class
PatchActionType
(
Enum
):
PATCH
=
'
patch
'
UNPATCH
=
'
unpatch
'
CHANGE_INSERT
=
'
change_insert
'
class
APIPatchRequestAction
(
BaseModel
):
action
:
str
=
Field
()
action
:
PatchActionType
=
Field
()
bcd_name
:
Optional
[
str
]
=
Field
(
default
=
None
)
bcd_tagged
:
Optional
[
bool
]
=
Field
(
default
=
False
)
building_gpk
:
str
=
Field
()
...
...
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