pre commit

This commit is contained in:
mike cullerton 2022-09-28 14:50:49 -04:00
parent 9ffc6a5737
commit 88347a5384
3 changed files with 12 additions and 10 deletions

View File

@ -1089,7 +1089,7 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Secret"
$ref: "#/components/schemas/Secret"
/secrets/{key}:
parameters:

View File

@ -1,4 +1,6 @@
"""Secret_model."""
from dataclasses import dataclass
from flask_bpmn.models.db import db
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
from marshmallow import Schema
@ -6,7 +8,6 @@ from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship
from spiffworkflow_backend.models.user import UserModel
from dataclasses import dataclass
@dataclass()

View File

@ -43,7 +43,8 @@ from spiffworkflow_backend.models.process_instance_report import (
)
from spiffworkflow_backend.models.process_model import ProcessModelInfo
from spiffworkflow_backend.models.process_model import ProcessModelInfoSchema
from spiffworkflow_backend.models.secret_model import SecretAllowedProcessSchema, SecretModel
from spiffworkflow_backend.models.secret_model import SecretAllowedProcessSchema
from spiffworkflow_backend.models.secret_model import SecretModel
from spiffworkflow_backend.models.secret_model import SecretModelSchema
from spiffworkflow_backend.models.spiff_logging import SpiffLoggingModel
from spiffworkflow_backend.models.user import UserModel
@ -1124,13 +1125,15 @@ def secret_list(
page: int = 1,
per_page: int = 100,
) -> Response:
secrets = SecretModel.query\
.order_by(SecretModel.key)\
.join(UserModel)\
"""Secret_list."""
secrets = (
SecretModel.query.order_by(SecretModel.key)
.join(UserModel)
.add_columns(
UserModel.username,
)\
)
.paginate(page, per_page, False)
)
response_json = {
"results": secrets.items,
"pagination": {
@ -1144,9 +1147,7 @@ def secret_list(
def add_secret(body: Dict) -> Response:
"""Add secret."""
secret_model = SecretService().add_secret(
body["key"], body["value"], g.user.id
)
secret_model = SecretService().add_secret(body["key"], body["value"], g.user.id)
assert secret_model # noqa: S101
return Response(
json.dumps(SecretModelSchema().dump(secret_model)),