Skip to content

Commit ebd8086

Browse files
committed
fix(web): align PublicationApprovalRequested publisher and schema
Two independent defects: 1. sendEvent() never called address.setStreet(), even though Property.getStreet() is available and the address schema requires 'street'. Every published event had an incomplete address. 2. The registered schema required contract, currency, and a string-typed listprice, but the publisher never set any of them (RequestApproval had no populated contract/currency fields and listprice was always null). Removed the three fields from both the publisher's event model and the registered schema, matching the canonical PublicationApprovalRequested contract already validated end-to-end in the .NET track (PropertyId, Status, Description, Images, Address{Country, City, Street, Number}). Also renamed the unused Address.state field to street and wired it up. Verified: RequestApprovalFunctionTests and PublicationEvaluationEventHandlerTests (9/9) pass; sam validate --lint clean on the schema template.
1 parent 28f6859 commit ebd8086

2 files changed

Lines changed: 6 additions & 41 deletions

File tree

unicorn_web/PublicationManagerService/src/main/java/publicationmanager/RequestApprovalFunction.java

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,13 @@ private void sendEvent(Property property) throws JsonProcessingException {
197197
Address address = new Address();
198198
address.setCity(property.getCity());
199199
address.setCountry(property.getCountry());
200+
address.setStreet(property.getStreet());
200201
address.setNumber(property.getPropertyNumber());
201202
event.setAddress(address);
202203

203204
event.setStatus("PENDING");
204-
event.setListprice(property.getListprice());
205205
event.setImages(property.getImages());
206206
event.setDescription(property.getDescription());
207-
event.setCurrency(property.getCurrency());
208207

209208
String eventString = objectMapper.writeValueAsString(event);
210209
logger.info("Event payload created: {}", eventString);
@@ -242,18 +241,12 @@ class RequestApproval {
242241
@JsonProperty("status")
243242
String status;
244243

245-
@JsonProperty("listprice")
246-
Float listprice;
247-
248244
@JsonProperty("images")
249245
java.util.List<String> images;
250246

251247
@JsonProperty("description")
252248
String description;
253249

254-
@JsonProperty("currency")
255-
String currency;
256-
257250
public String getPropertyId() {
258251
return propertyId;
259252
}
@@ -278,14 +271,6 @@ public void setStatus(String status) {
278271
this.status = status;
279272
}
280273

281-
public Float getListprice() {
282-
return listprice;
283-
}
284-
285-
public void setListprice(Float listprice) {
286-
this.listprice = listprice;
287-
}
288-
289274
public java.util.List<String> getImages() {
290275
return images;
291276
}
@@ -301,20 +286,12 @@ public String getDescription() {
301286
public void setDescription(String description) {
302287
this.description = description;
303288
}
304-
305-
public String getCurrency() {
306-
return currency;
307-
}
308-
309-
public void setCurrency(String currency) {
310-
this.currency = currency;
311-
}
312289
}
313290

314291
class Address {
315292
String country;
316293
String city;
317-
String state;
294+
String street;
318295
String number;
319296

320297
public String getCountry() {
@@ -333,12 +310,12 @@ public void setCity(String city) {
333310
this.city = city;
334311
}
335312

336-
public String getState() {
337-
return state;
313+
public String getStreet() {
314+
return street;
338315
}
339316

340-
public void setState(String state) {
341-
this.state = state;
317+
public void setStreet(String street) {
318+
this.street = street;
342319
}
343320

344321
public String getNumber() {

unicorn_web/infrastructure/schema-registry/PublicationApprovalRequested-schema.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,23 +89,14 @@ Resources:
8989
"required": [
9090
"images",
9191
"address",
92-
"listprice",
93-
"contract",
9492
"description",
95-
"currency",
9693
"property_id",
9794
"status"
9895
],
9996
"properties": {
10097
"address": {
10198
"$ref": "#/components/schemas/address"
10299
},
103-
"contract": {
104-
"type": "string"
105-
},
106-
"currency": {
107-
"type": "string"
108-
},
109100
"description": {
110101
"type": "string"
111102
},
@@ -115,9 +106,6 @@ Resources:
115106
"type": "string"
116107
}
117108
},
118-
"listprice": {
119-
"type": "string"
120-
},
121109
"property_id": {
122110
"type": "string"
123111
},

0 commit comments

Comments
 (0)