Open
Conversation
- Update Contract model to use String type for contractCreated and contractLastModifiedOn fields - Remove Long::valueOf conversions in ResponseParser when parsing timestamp values from DynamoDB - Align timestamp handling with string-based storage in DynamoDB AttributeValue - Simplifies type conversion and maintains consistency with data source format
…lerFunction and add metrics - Rename class from ContractEventHandler to ContractEventHandlerFunction for consistency - Update all constructor references to use new class name - Update logger initialization to reference new class name - Add metrics tracking for ContractCreated and ContractUpdated events - Reorganize imports to follow alphabetical ordering - Change timestamp fields from Long (epoch millis) to String (ISO-8601 format) - Update DynamoDB attribute builders to use string type for timestamp fields - Clean up whitespace inconsistencies throughout the file
…entHandlerFunction - Update handler field type from ContractEventHandler to ContractEventHandlerFunction - Update handler instantiation in setUp() to use ContractEventHandlerFunction constructor - Align test class with recent refactoring that renamed ContractEventHandler to ContractEventHandlerFunction
- Import Powertools metrics classes (Metrics, MetricsFactory, MetricUnit) - Add validation for evaluation results (APPROVED/DECLINED) in PublicationEvaluationEventHandler - Track PropertiesApproved metric when property status is updated - Add SERVICE_NAMESPACE environment variable to RequestApprovalFunction - Expand RequestApproval event payload with status, listprice, images, description, and currency fields - Add corresponding getters and setters for new RequestApproval properties - Use SERVICE_NAMESPACE for EventBridge event source instead of hardcoded "Unicorn.Web" - Track ApprovalsRequested metric when events are sent to EventBridge - Improve code formatting and consistency
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue number: #52
Summary
Changes
Fixes to align the Java runtime with Python, TypeScript, and .NET for functional equivalence and cross-runtime consistency.
Contracts Service (
unicorn_contracts)ContractEventHandler→ContractEventHandlerFunctionContract.javatimestamp fieldscontractCreatedandcontractLastModifiedOnfromLongtoStringcreateContract: replacedInstant.now().toEpochMilli()+.n(...)withInstant.now().toString()+.s(...)for both timestamp attributesupdateContract: changed:modifiedDateexpression value from.n(epoch millis)to.s(Instant.now().toString())ResponseParser.java: removed.map(Long::valueOf)fromcontract_createdandcontract_last_modified_onparsing chainsContractCreatedmetric (Count, 1) tocreateContractsuccess pathContractUpdatedmetric (Count, 1) toupdateContractsuccess pathCreateContractTests.javato reference the renamedContractEventHandlerFunctionWeb Service / Publication Manager (
unicorn_web)RequestApprovalFunction: replaced hardcoded"Unicorn.Web"EventBridge source withSystem.getenv("SERVICE_NAMESPACE")RequestApprovalFunction: expandedRequestApprovalinner class with all required fields (status,listprice,images,description,currency) and populated them from thePropertyobject insendEventRequestApprovalFunction: addedApprovalsRequestedmetric (Count, 1) tosendEventsuccess pathPublicationEvaluationEventHandler: added guard to only processAPPROVEDorDECLINEDevaluation results; logs a warning and returns for any other valuePublicationEvaluationEventHandler: addedPropertiesApprovedmetric (Count, 1) to the update success pathUser experience
Before: Timestamps were stored as DynamoDB Number (epoch millis), mismatched with other runtimes that use ISO 8601 strings. The
RequestApprovalFunctionemitted a partial event payload and used a hardcoded event source. No custom metrics were emitted for contract lifecycle events or publication approvals.After: Timestamps are stored as ISO 8601 strings consistent with Python, TypeScript, and .NET. The
RequestApprovalFunctionemits a complete event payload with all required fields and usesSERVICE_NAMESPACEfrom the environment. Custom metrics (ContractCreated,ContractUpdated,ApprovalsRequested,PropertiesApproved) are emitted on each successful operation, matching all other runtimes.Checklist
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.