Commit 1d8d00f3 authored by Manuel's avatar Manuel

traceRetrieval: security definitions + handling of missing ApplicationType

parent 19cfc8fe
...@@ -11,10 +11,16 @@ produces: ...@@ -11,10 +11,16 @@ produces:
basePath: "/api" basePath: "/api"
# Import security definitions from seperate file
securityDefinitions:
$ref: '../security/security.yml#securityDefinitions'
# Paths supported by the server application # Paths supported by the server application
paths: paths:
/transactions: /transactions:
delete: delete:
security:
- JwtRegular: []
operationId: "routes.transactions.delete_all_transactions" operationId: "routes.transactions.delete_all_transactions"
tags: tags:
- "Transactions" - "Transactions"
...@@ -23,13 +29,31 @@ paths: ...@@ -23,13 +29,31 @@ paths:
responses: responses:
'200': '200':
description: "Successful Request" 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: get:
security:
- JwtRegular: []
operationId: "routes.transactions.all_failed_for_use_case" operationId: "routes.transactions.all_failed_for_use_case"
tags: tags:
- "Transactions" - "Transactions"
summary: "Retrieves all Transactions in the given Use-Case" summary: "Retrieves all failed Transactions in the given Use-Case"
description: "Retrieves all Transactions in the given Use-Case" description: "Retrieves all failed Transactions in the given Use-Case"
parameters: parameters:
- in: path - in: path
name: "use_case" name: "use_case"
...@@ -38,8 +62,10 @@ paths: ...@@ -38,8 +62,10 @@ paths:
responses: responses:
'200': '200':
description: "Successful Request" description: "Successful Request"
/transactions/use_case/{use_case}: /use_cases/{use_case}/transactions:
get: get:
security:
- JwtRegular: []
operationId: "routes.transactions.all_for_use_case" operationId: "routes.transactions.all_for_use_case"
tags: tags:
- "Transactions" - "Transactions"
...@@ -69,66 +95,4 @@ paths: ...@@ -69,66 +95,4 @@ paths:
type: object type: object
responses: responses:
'200': '200':
description: "Successful echo of request data" description: "Successful echo of request data"
\ No newline at end of file
/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
...@@ -150,6 +150,12 @@ class MessageHandler: ...@@ -150,6 +150,12 @@ class MessageHandler:
transaction_message - Required: data of the transaction. Has to contain the key 'ApplicationType' which stores the use-case. 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"] use_case = transaction_message["ApplicationType"]
try: 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