changed apigw configs, updated db tables
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
.DS_Store
|
||||
*.env
|
||||
610
apigw/qrcode-apigw-api-swagger-apigateway.json
Normal file
610
apigw/qrcode-apigw-api-swagger-apigateway.json
Normal file
@@ -0,0 +1,610 @@
|
||||
{
|
||||
"swagger" : "2.0",
|
||||
"info" : {
|
||||
"version" : "2024-07-13T15:48:52Z",
|
||||
"title" : "qrcode-apigw"
|
||||
},
|
||||
"host" : "bk5wiynzsi.execute-api.ap-southeast-1.amazonaws.com",
|
||||
"basePath" : "/api",
|
||||
"schemes" : [ "https" ],
|
||||
"paths" : {
|
||||
"/v1/gmail/getEmails" : {
|
||||
"get" : {
|
||||
"produces" : [ "application/json" ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"description" : "200 response",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/Empty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"Cognito" : [ ]
|
||||
} ],
|
||||
"x-amazon-apigateway-integration" : {
|
||||
"connectionId" : "h1icfc",
|
||||
"httpMethod" : "GET",
|
||||
"uri" : "https://safeqr-nlb-6bd79c7ba50f3cb5.elb.ap-southeast-1.amazonaws.com:8443/v1/gmail/getEmails",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"statusCode" : "200"
|
||||
}
|
||||
},
|
||||
"requestParameters" : {
|
||||
"integration.request.header.X-USER-ID" : "context.authorizer.claims.sub"
|
||||
},
|
||||
"passthroughBehavior" : "when_no_match",
|
||||
"connectionType" : "VPC_LINK",
|
||||
"tlsConfig" : {
|
||||
"insecureSkipVerification" : true
|
||||
},
|
||||
"type" : "http_proxy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/qrcodetypes/checkRedirects" : {
|
||||
"post" : {
|
||||
"produces" : [ "application/json" ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"description" : "200 response",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/Empty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"Cognito" : [ ]
|
||||
} ],
|
||||
"x-amazon-apigateway-integration" : {
|
||||
"connectionId" : "h1icfc",
|
||||
"httpMethod" : "POST",
|
||||
"uri" : "https://safeqr-nlb-6bd79c7ba50f3cb5.elb.ap-southeast-1.amazonaws.com:8443/v1/qrcodetypes/checkRedirects",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"statusCode" : "200"
|
||||
}
|
||||
},
|
||||
"requestParameters" : {
|
||||
"integration.request.header.X-USER-ID" : "context.authorizer.claims.sub"
|
||||
},
|
||||
"passthroughBehavior" : "when_no_match",
|
||||
"connectionType" : "VPC_LINK",
|
||||
"tlsConfig" : {
|
||||
"insecureSkipVerification" : true
|
||||
},
|
||||
"type" : "http_proxy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/qrcodetypes/detect" : {
|
||||
"post" : {
|
||||
"produces" : [ "application/json" ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"description" : "200 response",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/Empty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"Cognito" : [ ]
|
||||
} ],
|
||||
"x-amazon-apigateway-integration" : {
|
||||
"connectionId" : "h1icfc",
|
||||
"httpMethod" : "POST",
|
||||
"uri" : "https://safeqr-nlb-6bd79c7ba50f3cb5.elb.ap-southeast-1.amazonaws.com:8443/v1/qrcodetypes/detect",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"statusCode" : "200"
|
||||
}
|
||||
},
|
||||
"requestParameters" : {
|
||||
"integration.request.header.X-USER-ID" : "context.authorizer.claims.sub"
|
||||
},
|
||||
"passthroughBehavior" : "when_no_match",
|
||||
"connectionType" : "VPC_LINK",
|
||||
"tlsConfig" : {
|
||||
"insecureSkipVerification" : true
|
||||
},
|
||||
"type" : "http_proxy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/qrcodetypes/getQRDetails" : {
|
||||
"get" : {
|
||||
"produces" : [ "application/json" ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"description" : "200 response",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/Empty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"Cognito" : [ ]
|
||||
} ],
|
||||
"x-amazon-apigateway-integration" : {
|
||||
"connectionId" : "h1icfc",
|
||||
"httpMethod" : "GET",
|
||||
"uri" : "https://safeqr-nlb-6bd79c7ba50f3cb5.elb.ap-southeast-1.amazonaws.com:8443/v1/qrcodetypes/getQRDetails",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"statusCode" : "200"
|
||||
}
|
||||
},
|
||||
"requestParameters" : {
|
||||
"integration.request.header.X-USER-ID" : "context.authorizer.claims.sub"
|
||||
},
|
||||
"passthroughBehavior" : "when_no_match",
|
||||
"connectionType" : "VPC_LINK",
|
||||
"tlsConfig" : {
|
||||
"insecureSkipVerification" : true
|
||||
},
|
||||
"type" : "http_proxy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/qrcodetypes/scan" : {
|
||||
"post" : {
|
||||
"produces" : [ "application/json" ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"description" : "200 response",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/Empty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"Cognito" : [ ]
|
||||
} ],
|
||||
"x-amazon-apigateway-integration" : {
|
||||
"connectionId" : "h1icfc",
|
||||
"httpMethod" : "POST",
|
||||
"uri" : "https://safeqr-nlb-6bd79c7ba50f3cb5.elb.ap-southeast-1.amazonaws.com:8443/v1/qrcodetypes/scan",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"statusCode" : "200"
|
||||
}
|
||||
},
|
||||
"requestParameters" : {
|
||||
"integration.request.header.X-USER-ID" : "context.authorizer.claims.sub"
|
||||
},
|
||||
"passthroughBehavior" : "when_no_match",
|
||||
"connectionType" : "VPC_LINK",
|
||||
"tlsConfig" : {
|
||||
"insecureSkipVerification" : true
|
||||
},
|
||||
"type" : "http_proxy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/qrcodetypes/verifyURL" : {
|
||||
"post" : {
|
||||
"produces" : [ "application/json" ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"description" : "200 response",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/Empty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"Cognito" : [ ]
|
||||
} ],
|
||||
"x-amazon-apigateway-integration" : {
|
||||
"connectionId" : "h1icfc",
|
||||
"httpMethod" : "POST",
|
||||
"uri" : "https://safeqr-nlb-6bd79c7ba50f3cb5.elb.ap-southeast-1.amazonaws.com:8443/v1/qrcodetypes/verifyURL",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"statusCode" : "200"
|
||||
}
|
||||
},
|
||||
"requestParameters" : {
|
||||
"integration.request.header.X-USER-ID" : "context.authorizer.claims.sub"
|
||||
},
|
||||
"passthroughBehavior" : "when_no_match",
|
||||
"connectionType" : "VPC_LINK",
|
||||
"tlsConfig" : {
|
||||
"insecureSkipVerification" : true
|
||||
},
|
||||
"type" : "http_proxy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/qrcodetypes/virusTotalCheck" : {
|
||||
"post" : {
|
||||
"produces" : [ "application/json" ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"description" : "200 response",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/Empty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"Cognito" : [ ]
|
||||
} ],
|
||||
"x-amazon-apigateway-integration" : {
|
||||
"connectionId" : "h1icfc",
|
||||
"httpMethod" : "POST",
|
||||
"uri" : "https://safeqr-nlb-6bd79c7ba50f3cb5.elb.ap-southeast-1.amazonaws.com:8443/v1/qrcodetypes/virusTotalCheck",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"statusCode" : "200"
|
||||
}
|
||||
},
|
||||
"requestParameters" : {
|
||||
"integration.request.header.X-USER-ID" : "context.authorizer.claims.sub"
|
||||
},
|
||||
"passthroughBehavior" : "when_no_match",
|
||||
"connectionType" : "VPC_LINK",
|
||||
"tlsConfig" : {
|
||||
"insecureSkipVerification" : true
|
||||
},
|
||||
"type" : "http_proxy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/user/deleteAllBookmark" : {
|
||||
"put" : {
|
||||
"produces" : [ "application/json" ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"description" : "200 response",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/Empty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"Cognito" : [ ]
|
||||
} ],
|
||||
"x-amazon-apigateway-integration" : {
|
||||
"connectionId" : "h1icfc",
|
||||
"httpMethod" : "PUT",
|
||||
"uri" : "https://safeqr-nlb-6bd79c7ba50f3cb5.elb.ap-southeast-1.amazonaws.com:8443/v1/user/deleteAllBookmark",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"statusCode" : "200"
|
||||
}
|
||||
},
|
||||
"requestParameters" : {
|
||||
"integration.request.header.X-USER-ID" : "context.authorizer.claims.sub"
|
||||
},
|
||||
"passthroughBehavior" : "when_no_match",
|
||||
"connectionType" : "VPC_LINK",
|
||||
"tlsConfig" : {
|
||||
"insecureSkipVerification" : true
|
||||
},
|
||||
"type" : "http_proxy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/user/deleteAllScannedHistories" : {
|
||||
"put" : {
|
||||
"produces" : [ "application/json" ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"description" : "200 response",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/Empty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"Cognito" : [ ]
|
||||
} ],
|
||||
"x-amazon-apigateway-integration" : {
|
||||
"connectionId" : "h1icfc",
|
||||
"httpMethod" : "PUT",
|
||||
"uri" : "https://safeqr-nlb-6bd79c7ba50f3cb5.elb.ap-southeast-1.amazonaws.com:8443/v1/user/deleteAllScannedHistories",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"statusCode" : "200"
|
||||
}
|
||||
},
|
||||
"requestParameters" : {
|
||||
"integration.request.header.X-USER-ID" : "context.authorizer.claims.sub"
|
||||
},
|
||||
"passthroughBehavior" : "when_no_match",
|
||||
"connectionType" : "VPC_LINK",
|
||||
"tlsConfig" : {
|
||||
"insecureSkipVerification" : true
|
||||
},
|
||||
"type" : "http_proxy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/user/deleteBookmark" : {
|
||||
"put" : {
|
||||
"produces" : [ "application/json" ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"description" : "200 response",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/Empty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"Cognito" : [ ]
|
||||
} ],
|
||||
"x-amazon-apigateway-integration" : {
|
||||
"connectionId" : "h1icfc",
|
||||
"httpMethod" : "PUT",
|
||||
"uri" : "https://safeqr-nlb-6bd79c7ba50f3cb5.elb.ap-southeast-1.amazonaws.com:8443/v1/user/deleteBookmark",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"statusCode" : "200"
|
||||
}
|
||||
|
||||
},
|
||||
"requestParameters" : {
|
||||
"integration.request.header.X-USER-ID" : "context.authorizer.claims.sub"
|
||||
},
|
||||
"passthroughBehavior" : "when_no_match",
|
||||
"connectionType" : "VPC_LINK",
|
||||
"tlsConfig" : {
|
||||
"insecureSkipVerification" : true
|
||||
},
|
||||
"type" : "http_proxy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/user/deleteScannedHistories" : {
|
||||
"put" : {
|
||||
"produces" : [ "application/json" ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"description" : "200 response",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/Empty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"Cognito" : [ ]
|
||||
} ],
|
||||
"x-amazon-apigateway-integration" : {
|
||||
"connectionId" : "h1icfc",
|
||||
"httpMethod" : "PUT",
|
||||
"uri" : "https://safeqr-nlb-6bd79c7ba50f3cb5.elb.ap-southeast-1.amazonaws.com:8443/v1/user/deleteScannedHistories",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"statusCode" : "200"
|
||||
}
|
||||
},
|
||||
"requestParameters" : {
|
||||
"integration.request.header.X-USER-ID" : "context.authorizer.claims.sub"
|
||||
},
|
||||
"passthroughBehavior" : "when_no_match",
|
||||
"connectionType" : "VPC_LINK",
|
||||
"tlsConfig" : {
|
||||
"insecureSkipVerification" : true
|
||||
},
|
||||
"type" : "http_proxy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/user/getBookmarks" : {
|
||||
"get" : {
|
||||
"produces" : [ "application/json" ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"description" : "200 response",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/Empty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"Cognito" : [ ]
|
||||
} ],
|
||||
"x-amazon-apigateway-integration" : {
|
||||
"connectionId" : "h1icfc",
|
||||
"httpMethod" : "GET",
|
||||
"uri" : "https://safeqr-nlb-6bd79c7ba50f3cb5.elb.ap-southeast-1.amazonaws.com:8443/v1/user/getBookmarks",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"statusCode" : "200"
|
||||
}
|
||||
},
|
||||
"requestParameters" : {
|
||||
"integration.request.header.X-USER-ID" : "context.authorizer.claims.sub"
|
||||
},
|
||||
"passthroughBehavior" : "when_no_match",
|
||||
"connectionType" : "VPC_LINK",
|
||||
"tlsConfig" : {
|
||||
"insecureSkipVerification" : true
|
||||
},
|
||||
"type" : "http_proxy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/user/getScannedHistories" : {
|
||||
"get" : {
|
||||
"produces" : [ "application/json" ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"description" : "200 response",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/Empty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"Cognito" : [ ]
|
||||
} ],
|
||||
"x-amazon-apigateway-integration" : {
|
||||
"connectionId" : "h1icfc",
|
||||
"httpMethod" : "GET",
|
||||
"uri" : "https://safeqr-nlb-6bd79c7ba50f3cb5.elb.ap-southeast-1.amazonaws.com:8443/v1/user/getScannedHistories",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"statusCode" : "200"
|
||||
}
|
||||
},
|
||||
"requestParameters" : {
|
||||
"integration.request.header.X-USER-ID" : "context.authorizer.claims.sub"
|
||||
},
|
||||
"passthroughBehavior" : "when_no_match",
|
||||
"connectionType" : "VPC_LINK",
|
||||
"tlsConfig" : {
|
||||
"insecureSkipVerification" : true
|
||||
},
|
||||
"type" : "http_proxy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/user/getUser" : {
|
||||
"get" : {
|
||||
"produces" : [ "application/json" ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"description" : "200 response",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/Empty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"Cognito" : [ ]
|
||||
} ],
|
||||
"x-amazon-apigateway-integration" : {
|
||||
"connectionId" : "h1icfc",
|
||||
"httpMethod" : "GET",
|
||||
"uri" : "https://safeqr-nlb-6bd79c7ba50f3cb5.elb.ap-southeast-1.amazonaws.com:8443/v1/user/getUser",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"statusCode" : "200"
|
||||
}
|
||||
},
|
||||
"requestParameters" : {
|
||||
"integration.request.header.X-USER-ID" : "context.authorizer.claims.sub"
|
||||
},
|
||||
"passthroughBehavior" : "when_no_match",
|
||||
"connectionType" : "VPC_LINK",
|
||||
"tlsConfig" : {
|
||||
"insecureSkipVerification" : true
|
||||
},
|
||||
"type" : "http_proxy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/user/setBookmark" : {
|
||||
"post" : {
|
||||
"produces" : [ "application/json" ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"description" : "200 response",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/Empty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"security" : [ {
|
||||
"Cognito" : [ ]
|
||||
} ],
|
||||
"x-amazon-apigateway-integration" : {
|
||||
"connectionId" : "h1icfc",
|
||||
"httpMethod" : "POST",
|
||||
"uri" : "https://safeqr-nlb-6bd79c7ba50f3cb5.elb.ap-southeast-1.amazonaws.com:8443/v1/user/setBookmark",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"statusCode" : "200"
|
||||
}
|
||||
},
|
||||
"requestParameters" : {
|
||||
"integration.request.header.X-USER-ID" : "context.authorizer.claims.sub"
|
||||
},
|
||||
"passthroughBehavior" : "when_no_match",
|
||||
"connectionType" : "VPC_LINK",
|
||||
"tlsConfig" : {
|
||||
"insecureSkipVerification" : true
|
||||
},
|
||||
"type" : "http_proxy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/version" : {
|
||||
"get" : {
|
||||
"produces" : [ "application/json" ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"description" : "200 response",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/Empty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-amazon-apigateway-integration" : {
|
||||
"connectionId" : "h1icfc",
|
||||
"httpMethod" : "GET",
|
||||
"uri" : "https://safeqr-nlb-6bd79c7ba50f3cb5.elb.ap-southeast-1.amazonaws.com:8443/v1/version",
|
||||
"responses" : {
|
||||
"default" : {
|
||||
"statusCode" : "200"
|
||||
}
|
||||
},
|
||||
"passthroughBehavior" : "when_no_match",
|
||||
"connectionType" : "VPC_LINK",
|
||||
"tlsConfig" : {
|
||||
"insecureSkipVerification" : true
|
||||
},
|
||||
"type" : "http_proxy"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securityDefinitions" : {
|
||||
"Cognito" : {
|
||||
"type" : "apiKey",
|
||||
"name" : "Authorization",
|
||||
"in" : "header",
|
||||
"x-amazon-apigateway-authtype" : "cognito_user_pools",
|
||||
"x-amazon-apigateway-authorizer" : {
|
||||
"providerARNs" : [ "arn:aws:cognito-idp:ap-southeast-1:058264269465:userpool/ap-southeast-1_zkxA0NZYN" ],
|
||||
"type" : "cognito_user_pools"
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions" : {
|
||||
"Empty" : {
|
||||
"type" : "object",
|
||||
"title" : "Empty Schema"
|
||||
}
|
||||
},
|
||||
"x-amazon-apigateway-gateway-responses" : {
|
||||
"DEFAULT_4XX" : {
|
||||
"responseParameters" : {
|
||||
"gatewayresponse.header.Access-Control-Allow-Methods" : "'OPTIONS'",
|
||||
"gatewayresponse.header.Access-Control-Allow-Origin" : "'*'",
|
||||
"gatewayresponse.header.Access-Control-Allow-Headers" : "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'"
|
||||
}
|
||||
},
|
||||
"DEFAULT_5XX" : {
|
||||
"responseParameters" : {
|
||||
"gatewayresponse.header.Access-Control-Allow-Methods" : "'OPTIONS'",
|
||||
"gatewayresponse.header.Access-Control-Allow-Origin" : "'*'",
|
||||
"gatewayresponse.header.Access-Control-Allow-Headers" : "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-amazon-apigateway-policy" : {
|
||||
"Version" : "2012-10-17",
|
||||
"Statement" : [ {
|
||||
"Effect" : "Allow",
|
||||
"Principal" : "*",
|
||||
"Action" : "execute-api:Invoke",
|
||||
"Resource" : "arn:aws:execute-api:ap-southeast-1:058264269465:bk5wiynzsi/*/*/*"
|
||||
} ]
|
||||
}
|
||||
}
|
||||
134
gmail-json/test.json
Normal file
134
gmail-json/test.json
Normal file
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"emails": [
|
||||
{
|
||||
"snippet": "",
|
||||
"threadId": "190e95e29f2334d8",
|
||||
"labelIds": [
|
||||
"IMPORTANT",
|
||||
"SENT",
|
||||
"INBOX"
|
||||
],
|
||||
"payload": {
|
||||
"parts": [
|
||||
{
|
||||
"parts": [
|
||||
{
|
||||
"headers": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "text/plain; charset=\"UTF-8\""
|
||||
}
|
||||
],
|
||||
"filename": "",
|
||||
"mimeType": "text/plain",
|
||||
"body": {
|
||||
"data": "DQo=",
|
||||
"size": 2
|
||||
},
|
||||
"partId": "0.0"
|
||||
},
|
||||
{
|
||||
"headers": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "text/html; charset=\"UTF-8\""
|
||||
}
|
||||
],
|
||||
"filename": "",
|
||||
"mimeType": "text/html",
|
||||
"body": {
|
||||
"data": "PGRpdj48aW1nIHNyYz0iY2lkOjE5MGU5NWYzZDAwOTZmZjQ5YjQxIiBzdHlsZT0ibWF4LXdpZHRoOiAxMDAlOyI-PC9kaXY-DQo=",
|
||||
"size": 74
|
||||
},
|
||||
"partId": "0.1"
|
||||
}
|
||||
],
|
||||
"headers": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "multipart/alternative; boundary=\"0000000000006b7c83061e0f9c47\""
|
||||
}
|
||||
],
|
||||
"filename": "",
|
||||
"mimeType": "multipart/alternative",
|
||||
"body": {
|
||||
"size": 0
|
||||
},
|
||||
"partId": "0"
|
||||
},
|
||||
{
|
||||
"headers": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "image/png; name=\"6E0889F8-6DAD-417C-A1AF-756DBC1138AC.png\""
|
||||
},
|
||||
{
|
||||
"name": "Content-Disposition",
|
||||
"value": "attachment; filename=\"6E0889F8-6DAD-417C-A1AF-756DBC1138AC.png\""
|
||||
},
|
||||
{
|
||||
"name": "Content-Transfer-Encoding",
|
||||
"value": "base64"
|
||||
},
|
||||
{
|
||||
"name": "X-Attachment-Id",
|
||||
"value": "190e95f3d0096ff49b41"
|
||||
},
|
||||
{
|
||||
"name": "Content-ID",
|
||||
"value": "<190e95f3d0096ff49b41>"
|
||||
}
|
||||
],
|
||||
"filename": "6E0889F8-6DAD-417C-A1AF-756DBC1138AC.png",
|
||||
"mimeType": "image/png",
|
||||
"body": {
|
||||
"size": 579220,
|
||||
"attachmentId": "ANGjdJ-HCTgEgqdJXIljB63MrOfI7vChyoOoesaB3u3MGzB038Gv47OSpXQ8DB8l4IpQ8uowl7BUys7Q2dQDv46AylseBwXr4tKmqCJ9DSOFcQnYqOUqN-4t_tlQf7jpI5IoYgpRkqCk6Hr_lihjzfyxSqRGVIgVHJgUvCEJT6jgBEBDDEHqFI8y2JcXyYEuzE51_BCUWTQOUcu6PvVzJSCSvKoLc3zzwYfsMHXr4UX1lSIHAKxDTvfYj-m0KzfPucrcl0ywLD5CvgIJUGsE1X6tbgRRfoHfwL9wdSQHsedre0t_sXNlY592jcy9pUs"
|
||||
},
|
||||
"partId": "1"
|
||||
}
|
||||
],
|
||||
"headers": [
|
||||
{
|
||||
"name": "MIME-Version",
|
||||
"value": "1.0"
|
||||
},
|
||||
{
|
||||
"name": "Date",
|
||||
"value": "Thu, 25 Jul 2024 18:10:57 +0800"
|
||||
},
|
||||
{
|
||||
"name": "Message-ID",
|
||||
"value": "<CAOhDyE09kVfVpYTOwm6cwir9tLaYvs9JM-4ZJsNQpk57uOOd_w@mail.gmail.com>"
|
||||
},
|
||||
{
|
||||
"name": "Subject",
|
||||
"value": "Test Test"
|
||||
},
|
||||
{
|
||||
"name": "From",
|
||||
"value": "SafeQR <safeqr.fyp.24.s2.43p@gmail.com>"
|
||||
},
|
||||
{
|
||||
"name": "To",
|
||||
"value": "SafeQR <safeqr.fyp.24.s2.43p@gmail.com>"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "multipart/related; boundary=\"0000000000006b7c84061e0f9c48\""
|
||||
}
|
||||
],
|
||||
"filename": "",
|
||||
"mimeType": "multipart/related",
|
||||
"body": {
|
||||
"size": 0
|
||||
},
|
||||
"partId": ""
|
||||
},
|
||||
"historyId": 27133,
|
||||
"id": "190e95f5626b2a39",
|
||||
"sizeEstimate": 793666,
|
||||
"internalDate": 1721902257000
|
||||
}
|
||||
]
|
||||
}
|
||||
14257
gmail-json/test_all.json
Normal file
14257
gmail-json/test_all.json
Normal file
File diff suppressed because one or more lines are too long
11
gmail-json/test_tree.json
Normal file
11
gmail-json/test_tree.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"cartoon": {
|
||||
"0": {
|
||||
"more than 1 person": {
|
||||
"0": "no",
|
||||
"1": { "winter": { "0": "no", "1": "yes" } }
|
||||
}
|
||||
},
|
||||
"1": "no"
|
||||
}
|
||||
}
|
||||
2028
gmail-json/with_qr.json
Normal file
2028
gmail-json/with_qr.json
Normal file
File diff suppressed because one or more lines are too long
@@ -5,87 +5,156 @@ CREATE SCHEMA IF NOT EXISTS safeqr;
|
||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||
|
||||
-- Create Enum for scan_history status
|
||||
CREATE TYPE scan_status AS ENUM ('active', 'inactive');
|
||||
CREATE TYPE scan_status AS ENUM ('ACTIVE', 'INACTIVE');
|
||||
|
||||
-- safeqr."user" definition
|
||||
|
||||
-- Drop table
|
||||
|
||||
-- DROP TABLE safeqr."user";
|
||||
|
||||
-- user table, need "" because user is a reserved word is postgres
|
||||
CREATE TABLE safeqr."user" (
|
||||
id VARCHAR(255) PRIMARY KEY,
|
||||
name VARCHAR(255),
|
||||
email VARCHAR(255),
|
||||
source VARCHAR(255),
|
||||
date_created TIMESTAMPTZ DEFAULT now(),
|
||||
date_updated TIMESTAMPTZ DEFAULT now(),
|
||||
roles TEXT[],
|
||||
status VARCHAR(255) DEFAULT 'ACTIVE'
|
||||
);
|
||||
id varchar(255) NOT NULL,
|
||||
"name" varchar(255) NULL,
|
||||
email varchar(255) NULL,
|
||||
"source" varchar(255) NULL,
|
||||
date_created timestamptz DEFAULT now() NULL,
|
||||
date_updated timestamptz DEFAULT now() NULL,
|
||||
roles _text NULL,
|
||||
status varchar(255) DEFAULT 'ACTIVE'::character varying NULL,
|
||||
gm
|
||||
|
||||
-- safeqr.qr_code_types definition
|
||||
|
||||
-- Drop table
|
||||
|
||||
-- DROP TABLE safeqr.qr_code_types;
|
||||
|
||||
-- Create QR_Code_Types table
|
||||
CREATE TABLE safeqr.qr_code_types (
|
||||
id SERIAL PRIMARY KEY,
|
||||
type VARCHAR(100) NOT NULL,
|
||||
description VARCHAR(100),
|
||||
prefix VARCHAR(50),
|
||||
table_name VARCHAR(100)
|
||||
id bigserial NOT NULL,
|
||||
"type" varchar(255) NOT NULL,
|
||||
description varchar(255) NULL,
|
||||
prefix varchar(255) NULL,
|
||||
table_name varchar(255) NULL,
|
||||
CONSTRAINT qr_code_types_pkey PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
-- Create QR_Code table
|
||||
-- Allow for nullable user id for testing KIV
|
||||
-- safeqr.qr_code definition
|
||||
|
||||
-- Drop table
|
||||
|
||||
-- DROP TABLE safeqr.qr_code;
|
||||
|
||||
CREATE TABLE safeqr.qr_code (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
qr_code_type_id INT REFERENCES safeqr.qr_code_types(id),
|
||||
user_id VARCHAR(255) REFERENCES safeqr."user"(id) NULL,
|
||||
contents VARCHAR(4096),
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
id uuid DEFAULT safeqr.uuid_generate_v4() NOT NULL,
|
||||
qr_code_type_id int8 NULL,
|
||||
user_id varchar(255) NULL,
|
||||
contents text NULL,
|
||||
created_at timestamptz DEFAULT CURRENT_TIMESTAMP NULL,
|
||||
CONSTRAINT qr_code_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT qr_code_qr_code_type_id_fkey FOREIGN KEY (qr_code_type_id) REFERENCES safeqr.qr_code_types(id),
|
||||
CONSTRAINT qr_code_user_id_fkey FOREIGN KEY (user_id) REFERENCES safeqr."user"(id)
|
||||
);
|
||||
|
||||
-- Create Scan_History table
|
||||
-- safeqr.scan_history definition
|
||||
|
||||
-- Drop table
|
||||
|
||||
-- DROP TABLE safeqr.scan_history;
|
||||
|
||||
CREATE TABLE safeqr.scan_history (
|
||||
id SERIAL PRIMARY KEY,
|
||||
qr_code_id UUID REFERENCES safeqr.qr_code(id),
|
||||
user_id VARCHAR(255) REFERENCES safeqr."user"(id),
|
||||
status scan_status DEFAULT 'active'
|
||||
id bigserial NOT NULL,
|
||||
qr_code_id uuid NULL,
|
||||
user_id varchar(255) NULL,
|
||||
status varchar(255) DEFAULT 'ACTIVE'::safeqr.scan_status NULL,
|
||||
date_created timestamptz DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
date_updated timestamptz DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
bookmarked bool DEFAULT false NULL,
|
||||
CONSTRAINT scan_history_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT scan_history_fk FOREIGN KEY (qr_code_id) REFERENCES safeqr.qr_code(id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- Create Scan_Bookmark table
|
||||
-- safeqr.scan_bookmark definition
|
||||
|
||||
-- Drop table
|
||||
|
||||
-- DROP TABLE safeqr.scan_bookmark;
|
||||
|
||||
CREATE TABLE safeqr.scan_bookmark (
|
||||
id SERIAL PRIMARY KEY,
|
||||
qr_code_id UUID REFERENCES safeqr.qr_code(id),
|
||||
user_id VARCHAR(255) REFERENCES safeqr."user"(id),
|
||||
active VARCHAR(7) CHECK (active IN ('ACTIVE', 'DELETED'))
|
||||
id bigserial NOT NULL,
|
||||
qr_code_id uuid NULL,
|
||||
user_id varchar(255) NULL,
|
||||
status varchar(255) DEFAULT 'ACTIVE'::safeqr.bookmark_status NULL,
|
||||
date_created timestamptz DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
date_updated timestamptz DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
CONSTRAINT scan_bookmark_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT scan_bookmark_fk FOREIGN KEY (qr_code_id) REFERENCES safeqr.qr_code(id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- Create URL table
|
||||
-- safeqr.url definition
|
||||
|
||||
-- Drop table
|
||||
|
||||
-- DROP TABLE safeqr.url;
|
||||
|
||||
CREATE TABLE safeqr.url (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
qr_code_id UUID REFERENCES safeqr.qr_code(id),
|
||||
url VARCHAR(2048),
|
||||
query VARCHAR(2048),
|
||||
fragment VARCHAR(2048)
|
||||
id uuid DEFAULT safeqr.uuid_generate_v4() NOT NULL,
|
||||
qr_code_id uuid NULL,
|
||||
"domain" text NULL,
|
||||
subdomain text NULL,
|
||||
top_level_domain text NULL,
|
||||
query text NULL,
|
||||
fragment text NULL,
|
||||
redirect int4 DEFAULT 0 NULL,
|
||||
"path" text NULL,
|
||||
redirect_chain _text NULL,
|
||||
hsts_header _text NULL,
|
||||
ssl_stripping _bool NULL,
|
||||
CONSTRAINT url_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT url_qr_code_id_fkey FOREIGN KEY (qr_code_id) REFERENCES safeqr.qr_code(id)
|
||||
);
|
||||
|
||||
-- Create Text table
|
||||
CREATE TABLE safeqr.text (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
qr_code_id UUID REFERENCES safeqr.qr_code(id),
|
||||
text VARCHAR(2048)
|
||||
-- safeqr."text" definition
|
||||
|
||||
-- Drop table
|
||||
|
||||
-- DROP TABLE safeqr."text";
|
||||
|
||||
CREATE TABLE safeqr."text" (
|
||||
id uuid DEFAULT safeqr.uuid_generate_v4() NOT NULL,
|
||||
qr_code_id uuid NULL,
|
||||
"text" varchar(2048) NULL,
|
||||
CONSTRAINT text_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT text_fk FOREIGN KEY (qr_code_id) REFERENCES safeqr.qr_code(id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- Create Phone table
|
||||
-- safeqr.phone definition
|
||||
|
||||
-- Drop table
|
||||
|
||||
-- DROP TABLE safeqr.phone;
|
||||
|
||||
CREATE TABLE safeqr.phone (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
qr_code_id UUID REFERENCES safeqr.qr_code(id),
|
||||
phone VARCHAR(100)
|
||||
id uuid DEFAULT safeqr.uuid_generate_v4() NOT NULL,
|
||||
qr_code_id uuid NULL,
|
||||
phone text NULL,
|
||||
CONSTRAINT phone_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT phone_fk FOREIGN KEY (qr_code_id) REFERENCES safeqr.qr_code(id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- Create SMS table
|
||||
-- safeqr.sms definition
|
||||
|
||||
-- Drop table
|
||||
|
||||
-- DROP TABLE safeqr.sms;
|
||||
|
||||
CREATE TABLE safeqr.sms (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
qr_code_id UUID REFERENCES safeqr.qr_code(id),
|
||||
phone VARCHAR(100),
|
||||
message VARCHAR(160)
|
||||
id uuid DEFAULT safeqr.uuid_generate_v4() NOT NULL,
|
||||
qr_code_id uuid NULL,
|
||||
phone text NULL,
|
||||
message text NULL,
|
||||
CONSTRAINT sms_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT sms_fk FOREIGN KEY (qr_code_id) REFERENCES safeqr.qr_code(id)
|
||||
);
|
||||
|
||||
-- Create Email table
|
||||
|
||||
Reference in New Issue
Block a user