Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mfriesen committed Jun 16, 2024
1 parent 431af2b commit a9f6f12
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
public class S3PresignerService {

/** {@link S3ConnectionBuilder}. */
private S3PresignerConnectionBuilder builder;
private final S3PresignerConnectionBuilder builder;

/**
* Constructor.
Expand Down Expand Up @@ -79,9 +79,7 @@ public URL presignGetUrl(final String bucket, final String key, final Duration d
.signatureDuration(duration).getObjectRequest(getObjectRequest).build();

PresignedGetObjectRequest req = signer.presignGetObject(getRequest);
URL url = req.url();

return url;
return req.url();
}
}

Expand Down
2 changes: 2 additions & 0 deletions docs/openapi/openapi-iam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7185,6 +7185,7 @@
- KEY_ONLY
- NUMBER
- STRING
- PUBLICATION
FulltextAttribute:
type: object
properties:
Expand Down Expand Up @@ -8397,6 +8398,7 @@
- NUMBER
- BOOLEAN
- KEY_ONLY
- PUBLICATION
AddAttributeRequest:
required:
- attribute
Expand Down
2 changes: 2 additions & 0 deletions docs/openapi/openapi-jwt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7185,6 +7185,7 @@
- KEY_ONLY
- NUMBER
- STRING
- PUBLICATION
FulltextAttribute:
type: object
properties:
Expand Down Expand Up @@ -8397,6 +8398,7 @@
- NUMBER
- BOOLEAN
- KEY_ONLY
- PUBLICATION
AddAttributeRequest:
required:
- attribute
Expand Down
2 changes: 2 additions & 0 deletions docs/openapi/openapi-key.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7185,6 +7185,7 @@
- KEY_ONLY
- NUMBER
- STRING
- PUBLICATION
FulltextAttribute:
type: object
properties:
Expand Down Expand Up @@ -8397,6 +8398,7 @@
- NUMBER
- BOOLEAN
- KEY_ONLY
- PUBLICATION
AddAttributeRequest:
required:
- attribute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
import com.formkiq.aws.dynamodb.objects.DateUtil;
import com.formkiq.aws.dynamodb.objects.Objects;
import com.formkiq.aws.dynamodb.objects.Strings;
import com.formkiq.stacks.dynamodb.attributes.AttributeDataType;
import com.formkiq.stacks.dynamodb.attributes.AttributeKeyReserved;
import com.formkiq.stacks.dynamodb.attributes.AttributeRecord;
import com.formkiq.stacks.dynamodb.attributes.AttributeService;
Expand Down Expand Up @@ -1486,13 +1487,23 @@ private boolean isPathChanges(final Map<String, AttributeValue> previous,
@Override
public void publishDocument(final String siteId, final String documentId, final String s3version,
final String path, final String contentType, final String userId) {

DocumentAttributePublicationValue val = new DocumentAttributePublicationValue().setPath(path)
.setS3version(s3version).setContentType(contentType);

DocumentAttributeRecord r = new DocumentAttributeRecord().setDocumentId(documentId)
.setKey(AttributeKeyReserved.PUBLICATION.getKey()).setUserId(userId)
.setInsertedDate(new Date()).setPublicationValue(val);
r.updateValueType();

this.dbService.putItem(r.getAttributes(siteId));

AttributeRecord a = new AttributeRecord().documentId(AttributeKeyReserved.PUBLICATION.getKey())
.key(AttributeKeyReserved.PUBLICATION.getKey()).type(AttributeType.STANDARD)
.dataType(AttributeDataType.PUBLICATIONS);
if (!this.dbService.exists(a.fromS(a.pk(siteId)), a.fromS(a.sk()))) {
this.dbService.putItem(a.getAttributes(siteId));
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@ public enum AttributeDataType {
/** Number. */
NUMBER,
/** {@link String}. */
STRING;
STRING,
/** Publication. */
PUBLICATIONS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7220,6 +7220,7 @@ Resources:
- KEY_ONLY
- NUMBER
- STRING
- PUBLICATION
FulltextAttribute:
type: "object"
properties:
Expand Down Expand Up @@ -8477,6 +8478,7 @@ Resources:
- NUMBER
- BOOLEAN
- KEY_ONLY
- PUBLICATION

AddAttributeRequest:
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7220,6 +7220,7 @@ Resources:
- KEY_ONLY
- NUMBER
- STRING
- PUBLICATION
FulltextAttribute:
type: "object"
properties:
Expand Down Expand Up @@ -8477,6 +8478,7 @@ Resources:
- NUMBER
- BOOLEAN
- KEY_ONLY
- PUBLICATION

AddAttributeRequest:
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7220,6 +7220,7 @@ Resources:
- KEY_ONLY
- NUMBER
- STRING
- PUBLICATION
FulltextAttribute:
type: "object"
properties:
Expand Down Expand Up @@ -8477,6 +8478,7 @@ Resources:
- NUMBER
- BOOLEAN
- KEY_ONLY
- PUBLICATION

AddAttributeRequest:
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
import java.util.UUID;
import java.util.concurrent.TimeUnit;

import com.formkiq.stacks.dynamodb.attributes.AttributeKeyReserved;
import com.formkiq.stacks.dynamodb.attributes.AttributeRecord;
import com.formkiq.stacks.dynamodb.documents.DocumentAttributePublicationValue;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.AfterAll;
Expand Down Expand Up @@ -1814,6 +1816,10 @@ public void testPublishAction01() throws Exception {
assertEquals(documentId, pv.getPath());
assertEquals("joe", pd.getUserId());
assertNotNull(pv.getS3version());

AttributeRecord attribute =
attributeService.getAttribute(siteId, AttributeKeyReserved.PUBLICATION.getKey());
assertNotNull(attribute);
}
}
}

0 comments on commit a9f6f12

Please sign in to comment.