Skip to content

Commit

Permalink
#226 - Add ability to publish document
Browse files Browse the repository at this point in the history
  • Loading branch information
mfriesen committed Jun 15, 2024
1 parent 1cf1f7b commit 67fab4e
Show file tree
Hide file tree
Showing 18 changed files with 1,069 additions and 164 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@ public enum ActionType {
/** Queue. */
QUEUE,
/** WebHook. */
WEBHOOK;
WEBHOOK,
/** Publish. */
PUBLISH
}
39 changes: 38 additions & 1 deletion docs/openapi/openapi-iam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5429,6 +5429,43 @@
- ApiAuthorization: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/ocrObjectsLambdaApi200'
/published/documents/{documentId}:
get:
operationId: GetPublishedDocumentContent
summary: Get published document's contents
description: Get a published document's contents. Certain content types, text/*, application/json, and application/x-www-form-urlencoded. return the "content" field, while all other content types return a 'contentUrl' for retrieving the content.
tags:
- Documents
parameters:
- $ref: '#/components/parameters/siteIdParam'
- $ref: '#/components/parameters/documentIdParam'
responses:
"307":
description: Temporary Redirect
headers:
Location:
schema:
type: string
security:
- ApiAuthorization: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/lambdaApi200'
delete:
operationId: DeletePublishedDocumentContent
summary: Delete published document's contents
description: Delete a published document's contents. Certain content types, text/*, application/json, and application/x-www-form-urlencoded. return the "content" field, while all other content types return a 'contentUrl' for retrieving the content.
tags:
- Documents
parameters:
- $ref: '#/components/parameters/siteIdParam'
- $ref: '#/components/parameters/documentIdParam'
responses:
"200":
$ref: '#/components/responses/200CorsDeleteResponse'
security:
- ApiAuthorization: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/lambdaApi200'
components:
headers:
AccessControlAllowOrigin:
Expand Down Expand Up @@ -8360,7 +8397,6 @@
- NUMBER
- BOOLEAN
- KEY_ONLY
- COMPOSITE_STRING
AddAttributeRequest:
required:
- attribute
Expand Down Expand Up @@ -8504,6 +8540,7 @@
- QUEUE
- WEBHOOK
- IDP
- PUBLISH
DocumentAction:
type: object
properties:
Expand Down
39 changes: 38 additions & 1 deletion docs/openapi/openapi-jwt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5429,6 +5429,43 @@
- ApiAuthorization: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/ocrObjectsLambdaApi200'
/published/documents/{documentId}:
get:
operationId: GetPublishedDocumentContent
summary: Get published document's contents
description: Get a published document's contents. Certain content types, text/*, application/json, and application/x-www-form-urlencoded. return the "content" field, while all other content types return a 'contentUrl' for retrieving the content.
tags:
- Documents
parameters:
- $ref: '#/components/parameters/siteIdParam'
- $ref: '#/components/parameters/documentIdParam'
responses:
"307":
description: Temporary Redirect
headers:
Location:
schema:
type: string
security:
- ApiAuthorization: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/lambdaApi200'
delete:
operationId: DeletePublishedDocumentContent
summary: Delete published document's contents
description: Delete a published document's contents. Certain content types, text/*, application/json, and application/x-www-form-urlencoded. return the "content" field, while all other content types return a 'contentUrl' for retrieving the content.
tags:
- Documents
parameters:
- $ref: '#/components/parameters/siteIdParam'
- $ref: '#/components/parameters/documentIdParam'
responses:
"200":
$ref: '#/components/responses/200CorsDeleteResponse'
security:
- ApiAuthorization: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/lambdaApi200'
components:
headers:
AccessControlAllowOrigin:
Expand Down Expand Up @@ -8360,7 +8397,6 @@
- NUMBER
- BOOLEAN
- KEY_ONLY
- COMPOSITE_STRING
AddAttributeRequest:
required:
- attribute
Expand Down Expand Up @@ -8504,6 +8540,7 @@
- QUEUE
- WEBHOOK
- IDP
- PUBLISH
DocumentAction:
type: object
properties:
Expand Down
39 changes: 38 additions & 1 deletion docs/openapi/openapi-key.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5429,6 +5429,43 @@
- ApiAuthorization: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/ocrObjectsLambdaApi200'
/published/documents/{documentId}:
get:
operationId: GetPublishedDocumentContent
summary: Get published document's contents
description: Get a published document's contents. Certain content types, text/*, application/json, and application/x-www-form-urlencoded. return the "content" field, while all other content types return a 'contentUrl' for retrieving the content.
tags:
- Documents
parameters:
- $ref: '#/components/parameters/siteIdParam'
- $ref: '#/components/parameters/documentIdParam'
responses:
"307":
description: Temporary Redirect
headers:
Location:
schema:
type: string
security:
- ApiAuthorization: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/lambdaApi200'
delete:
operationId: DeletePublishedDocumentContent
summary: Delete published document's contents
description: Delete a published document's contents. Certain content types, text/*, application/json, and application/x-www-form-urlencoded. return the "content" field, while all other content types return a 'contentUrl' for retrieving the content.
tags:
- Documents
parameters:
- $ref: '#/components/parameters/siteIdParam'
- $ref: '#/components/parameters/documentIdParam'
responses:
"200":
$ref: '#/components/responses/200CorsDeleteResponse'
security:
- ApiAuthorization: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/lambdaApi200'
components:
headers:
AccessControlAllowOrigin:
Expand Down Expand Up @@ -8360,7 +8397,6 @@
- NUMBER
- BOOLEAN
- KEY_ONLY
- COMPOSITE_STRING
AddAttributeRequest:
required:
- attribute
Expand Down Expand Up @@ -8504,6 +8540,7 @@
- QUEUE
- WEBHOOK
- IDP
- PUBLISH
DocumentAction:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import com.formkiq.stacks.dynamodb.attributes.AttributeValidation;
import com.formkiq.stacks.dynamodb.attributes.AttributeValidationAccess;
import com.formkiq.stacks.dynamodb.attributes.DocumentAttributeRecord;
import com.formkiq.stacks.dynamodb.documents.DocumentPublishRecord;
import com.formkiq.validation.ValidationException;
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;

Expand Down Expand Up @@ -528,4 +529,34 @@ DocumentItem saveDocumentItemWithTag(String siteId, DynamicDocumentItem doc)
void updateDocument(String siteId, String documentId, Map<String, AttributeValue> attributes,
boolean updateVersioning);

/**
* Publish Document.
*
* @param siteId {@link String}
* @param documentId {@link String}
* @param s3version {@link String}
* @param path {@link String}
* @param contentType {@link String}
* @param userId {@link String}
*/
void publishDocument(String siteId, String documentId, String s3version, String path,
String contentType, String userId);

/**
* Get Publish Document.
*
* @param siteId {@link String}
* @param documentId {@link String}
* @return DocumentPublishRecord
*/
DocumentPublishRecord findPublishDocument(String siteId, String documentId);

/**
* Delete Publish Document.
*
* @param siteId {@link String}
* @param documentId {@link String}
* @return boolean
*/
boolean deletePublishDocument(String siteId, String documentId);
}
Loading

0 comments on commit 67fab4e

Please sign in to comment.