Commit 1d8d00f3 authored by Manuel's avatar Manuel

traceRetrieval: security definitions + handling of missing ApplicationType

parent 19cfc8fe
......@@ -11,10 +11,16 @@ produces:
basePath: "/api"
# Import security definitions from seperate file
securityDefinitions:
$ref: '../security/security.yml#securityDefinitions'
# Paths supported by the server application
paths:
/transactions:
delete:
security:
- JwtRegular: []
operationId: "routes.transactions.delete_all_transactions"
tags:
- "Transactions"
......@@ -23,13 +29,31 @@ paths:
responses:
'200':
description: "Successful Request"
/transactions-failed/use_case/{use_case}:
/use_cases/{use_case}/transactions-failed:
delete:
security:
- JwtRegular: []
operationId: "routes.transactions.delete_all_failed_for_use_case"
tags:
- "Transactions"
summary: "Deletes all failed Transactions in the given Use-Case"
description: "Deletes all failed Transactions in the given Use-Case"
parameters:
- in: path
name: "use_case"
required: true
type: "string"
responses:
'200':
description: "Successful Request"
get:
security:
- JwtRegular: []
operationId: "routes.transactions.all_failed_for_use_case"
tags:
- "Transactions"
summary: "Retrieves all Transactions in the given Use-Case"
description: "Retrieves all Transactions in the given Use-Case"
summary: "Retrieves all failed Transactions in the given Use-Case"
description: "Retrieves all failed Transactions in the given Use-Case"
parameters:
- in: path
name: "use_case"
......@@ -38,8 +62,10 @@ paths:
responses:
'200':
description: "Successful Request"
/transactions/use_case/{use_case}:
/use_cases/{use_case}/transactions:
get:
security:
- JwtRegular: []
operationId: "routes.transactions.all_for_use_case"
tags:
- "Transactions"
......@@ -69,66 +95,4 @@ paths:
type: object
responses:
'200':
description: "Successful echo of request data"
/trace:
post:
operationId: "routes.blockchain_trace.post"
tags:
- "Blockchain Trace"
summary: "Add a new blockchain trace to SMART"
description: "Receives a new blockchain trace to store in SMART."
parameters:
- in: body
name: "BlockchainTrace"
description: "The trace to be added"
required: true
schema:
$ref: "#/definitions/BlockchainTrace"
responses:
'201':
description: "Successful operation"
'400':
description: "Invalid input"
get:
operationId: "routes.blockchain_trace.get"
tags:
- "Blockchain Trace"
summary: "Get blockchain traces"
description: "Returns all blockchain traces in the database"
parameters: []
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/BlockchainTrace"
definitions:
BlockchainTrace:
type: "object"
properties:
TransactionId:
type: string
format: uuid
Timestamp:
type: "string"
format: "date-time"
ApplicationType:
type: "string"
TransactionFrom:
type: "string"
format: "uuid"
TransactionTo:
type: "string"
format: "uuid"
TransferredAsset:
type: "string"
ResourceIds:
type: "string"
ResourceMd5:
type: "string"
ResourceState:
type: "string"
Metadata:
type: "string"
\ No newline at end of file
description: "Successful echo of request data"
\ No newline at end of file
......@@ -150,6 +150,12 @@ class MessageHandler:
transaction_message - Required: data of the transaction. Has to contain the key 'ApplicationType' which stores the use-case.
'''
if "ApplicationType" not in transaction_message.keys():
LOGGER.error("Transaction has no ApplicationType, storing it under use-case 'unknown'.")
transaction_message["ApplicationType"] = "unknown"
MessageHandler._repository.add_failed_transaction(transaction_message)
return
use_case = transaction_message["ApplicationType"]
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment