From 64fd87f91a4b66ca60d917596351b84cda179ea8 Mon Sep 17 00:00:00 2001 From: Petru Braha Date: Sun, 8 Mar 2026 00:00:06 +0200 Subject: [PATCH 1/5] feat: correct store-stand relationship --- smithy/model/stand/stand-apis.smithy | 13 +++++ smithy/model/store/store-apis.smithy | 4 ++ stand-io.smithy | 85 ++++++++++++++++++++++++++++ stand-types.smithy | 29 ++++++++++ 4 files changed, 131 insertions(+) create mode 100644 smithy/model/stand/stand-apis.smithy create mode 100644 stand-io.smithy create mode 100644 stand-types.smithy diff --git a/smithy/model/stand/stand-apis.smithy b/smithy/model/stand/stand-apis.smithy new file mode 100644 index 0000000..bd85b26 --- /dev/null +++ b/smithy/model/stand/stand-apis.smithy @@ -0,0 +1,13 @@ +$version: "2" + +namespace com.shopping.inandout.stand + +use com.shopping.inandout#UUID + +resource Stand { + identifiers: { + storeId: UUID + standId: UUID + } + properties: {} +} diff --git a/smithy/model/store/store-apis.smithy b/smithy/model/store/store-apis.smithy index 9f25ceb..a628b8b 100644 --- a/smithy/model/store/store-apis.smithy +++ b/smithy/model/store/store-apis.smithy @@ -12,6 +12,7 @@ use com.shopping.inandout#ResourceName use com.shopping.inandout#ResourceNotFoundError use com.shopping.inandout#Timezone use com.shopping.inandout#UUID +use com.shopping.inandout.stand#Stand resource Store { identifiers: { @@ -28,6 +29,9 @@ resource Store { createdAt: Timestamp updatedAt: Timestamp } + resources: [ + Stand + ] create: CreateStore read: GetStore list: ListStores diff --git a/stand-io.smithy b/stand-io.smithy new file mode 100644 index 0000000..e5a3ca3 --- /dev/null +++ b/stand-io.smithy @@ -0,0 +1,85 @@ +$version: "2" + +namespace com.shopping.inandout.stand + +use com.shopping.inandout#InputPagination +use com.shopping.inandout#OutputPagination +use com.shopping.inandout#PositiveDouble +use com.shopping.inandout#StoreIdMixin +use com.shopping.inandout#UUID +use com.shopping.inandout.article#Article +use com.shopping.inandout.article#CreateArticleInput + +@references([ + { + resource: Article + } +]) +structure CreateStandInput with [StoreIdMixin] { + @required + edgeId: UUID + + @required + sourceNodeDistance: PositiveDouble + + // Clients must choose between providing an article id/details. + // Not none, not both, one field must be filled. + @notProperty + @documentation("Existing article referenced in a new stand") + articleId: UUID + + @notProperty + @documentation("Creates a new article") + createArticleInput: CreateArticleInput +} + +structure CreateStandOutput { + @required + standId: UUID +} + +structure GetStandInput with [StoreIdMixin] { + @required + @httpLabel + standId: UUID +} + +structure GetStandOutput with [StandOutputMixin] {} + +@references([ + { + resource: Article + } +]) +structure ListStandsInput with [StoreIdMixin, InputPagination] { + @httpQuery("edgeId") + edgeId: UUID + + @httpQuery("articleId") + articleId: UUID +} + +structure ListStandsOutput with [OutputPagination] { + @required + tokens: StandSummaryList +} + +structure UpdateStandInput with [StoreIdMixin] { + @required + @httpLabel + standId: UUID + + edgeId: UUID + + sourceNodeDistance: PositiveDouble +} + +structure UpdateStandOutput with [StandOutputMixin] {} + +structure DeleteStandInput with [StoreIdMixin] { + @required + @httpLabel + standId: UUID +} + +structure DeleteStandOutput {} diff --git a/stand-types.smithy b/stand-types.smithy new file mode 100644 index 0000000..b7a319f --- /dev/null +++ b/stand-types.smithy @@ -0,0 +1,29 @@ +$version: "2" + +namespace com.shopping.inandout.stand + +use com.shopping.inandout#AuditMetadata +use com.shopping.inandout#PositiveDouble +use com.shopping.inandout#UUID +use com.shopping.inandout.article#ArticleSummary + +@mixin +structure StandOutputMixin with [AuditMetadata] { + @required + standId: UUID + + @required + edgeId: UUID + + @required + sourceNodeDistance: PositiveDouble + + @required + articleSummary: ArticleSummary +} + +structure StandSummary with [StandOutputMixin] {} + +list StandSummaryList { + member: StandSummary +} From 0e4f95bbab76d33b07ce20ef4792c22e91761b11 Mon Sep 17 00:00:00 2001 From: Petru Braha Date: Sun, 8 Mar 2026 00:01:08 +0200 Subject: [PATCH 2/5] removed bad files --- stand-io.smithy | 85 ---------------------------------------------- stand-types.smithy | 29 ---------------- 2 files changed, 114 deletions(-) delete mode 100644 stand-io.smithy delete mode 100644 stand-types.smithy diff --git a/stand-io.smithy b/stand-io.smithy deleted file mode 100644 index e5a3ca3..0000000 --- a/stand-io.smithy +++ /dev/null @@ -1,85 +0,0 @@ -$version: "2" - -namespace com.shopping.inandout.stand - -use com.shopping.inandout#InputPagination -use com.shopping.inandout#OutputPagination -use com.shopping.inandout#PositiveDouble -use com.shopping.inandout#StoreIdMixin -use com.shopping.inandout#UUID -use com.shopping.inandout.article#Article -use com.shopping.inandout.article#CreateArticleInput - -@references([ - { - resource: Article - } -]) -structure CreateStandInput with [StoreIdMixin] { - @required - edgeId: UUID - - @required - sourceNodeDistance: PositiveDouble - - // Clients must choose between providing an article id/details. - // Not none, not both, one field must be filled. - @notProperty - @documentation("Existing article referenced in a new stand") - articleId: UUID - - @notProperty - @documentation("Creates a new article") - createArticleInput: CreateArticleInput -} - -structure CreateStandOutput { - @required - standId: UUID -} - -structure GetStandInput with [StoreIdMixin] { - @required - @httpLabel - standId: UUID -} - -structure GetStandOutput with [StandOutputMixin] {} - -@references([ - { - resource: Article - } -]) -structure ListStandsInput with [StoreIdMixin, InputPagination] { - @httpQuery("edgeId") - edgeId: UUID - - @httpQuery("articleId") - articleId: UUID -} - -structure ListStandsOutput with [OutputPagination] { - @required - tokens: StandSummaryList -} - -structure UpdateStandInput with [StoreIdMixin] { - @required - @httpLabel - standId: UUID - - edgeId: UUID - - sourceNodeDistance: PositiveDouble -} - -structure UpdateStandOutput with [StandOutputMixin] {} - -structure DeleteStandInput with [StoreIdMixin] { - @required - @httpLabel - standId: UUID -} - -structure DeleteStandOutput {} diff --git a/stand-types.smithy b/stand-types.smithy deleted file mode 100644 index b7a319f..0000000 --- a/stand-types.smithy +++ /dev/null @@ -1,29 +0,0 @@ -$version: "2" - -namespace com.shopping.inandout.stand - -use com.shopping.inandout#AuditMetadata -use com.shopping.inandout#PositiveDouble -use com.shopping.inandout#UUID -use com.shopping.inandout.article#ArticleSummary - -@mixin -structure StandOutputMixin with [AuditMetadata] { - @required - standId: UUID - - @required - edgeId: UUID - - @required - sourceNodeDistance: PositiveDouble - - @required - articleSummary: ArticleSummary -} - -structure StandSummary with [StandOutputMixin] {} - -list StandSummaryList { - member: StandSummary -} From ffc2b7af9045746fcbfb954bf97fda73579c73b1 Mon Sep 17 00:00:00 2001 From: Petru Braha Date: Sun, 8 Mar 2026 00:04:51 +0200 Subject: [PATCH 3/5] feat: added resource to the service --- smithy/model/main.smithy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/smithy/model/main.smithy b/smithy/model/main.smithy index d3bc69a..65deb33 100644 --- a/smithy/model/main.smithy +++ b/smithy/model/main.smithy @@ -4,6 +4,7 @@ namespace com.shopping.inandout use aws.protocols#restJson1 use com.shopping.inandout.brand#Brand +use com.shopping.inandout.stand#Stand use com.shopping.inandout.store#Store use com.shopping.inandout.tsp#FindTspSolution @@ -14,6 +15,7 @@ service InAndOut { resources: [ Brand Store + Stand ] operations: [ FindTspSolution From 3ff883bbe693e20b4733163599ff346770225206 Mon Sep 17 00:00:00 2001 From: Petru Braha Date: Mon, 9 Mar 2026 00:33:23 +0200 Subject: [PATCH 4/5] feat: stand APIs --- smithy/model/main.smithy | 2 - smithy/model/stand/stand-apis.smithy | 76 ++++++++++++++++++++++++++- smithy/model/stand/stand-io.smithy | 59 +++++++++++++++++++++ smithy/model/stand/stand-types.smithy | 37 +++++++++++++ 4 files changed, 171 insertions(+), 3 deletions(-) create mode 100644 smithy/model/stand/stand-io.smithy create mode 100644 smithy/model/stand/stand-types.smithy diff --git a/smithy/model/main.smithy b/smithy/model/main.smithy index 65deb33..d3bc69a 100644 --- a/smithy/model/main.smithy +++ b/smithy/model/main.smithy @@ -4,7 +4,6 @@ namespace com.shopping.inandout use aws.protocols#restJson1 use com.shopping.inandout.brand#Brand -use com.shopping.inandout.stand#Stand use com.shopping.inandout.store#Store use com.shopping.inandout.tsp#FindTspSolution @@ -15,7 +14,6 @@ service InAndOut { resources: [ Brand Store - Stand ] operations: [ FindTspSolution diff --git a/smithy/model/stand/stand-apis.smithy b/smithy/model/stand/stand-apis.smithy index bd85b26..fe15f42 100644 --- a/smithy/model/stand/stand-apis.smithy +++ b/smithy/model/stand/stand-apis.smithy @@ -2,6 +2,11 @@ $version: "2" namespace com.shopping.inandout.stand +use com.shopping.inandout#InternalServerError +use com.shopping.inandout#InvalidInputError +use com.shopping.inandout#PositiveDouble +use com.shopping.inandout#ResourceAlreadyExistsError +use com.shopping.inandout#ResourceNotFoundError use com.shopping.inandout#UUID resource Stand { @@ -9,5 +14,74 @@ resource Stand { storeId: UUID standId: UUID } - properties: {} + properties: { + articleId: UUID + edgeId: UUID + sourceNodeDistance: PositiveDouble + createdAt: Timestamp + updatedAt: Timestamp + } + create: CreateStand + read: GetStand + list: ListStands + update: UpdateStand + delete: DeleteStand +} + +@http(method: "POST", uri: "/stores/{storeId}/stands") +operation CreateStand { + input: CreateStandInput + output: StandSummary + errors: [ + InvalidInputError + ResourceAlreadyExistsError + InternalServerError + ] +} + +@readonly +@http(method: "GET", uri: "/stores/{storeId}/stands/{standId}") +operation GetStand { + input: GetStandInput + output: StandSummary + errors: [ + InvalidInputError + ResourceNotFoundError + InternalServerError + ] +} + +@readonly +@paginated +@http(method: "GET", uri: "/stores/{storeId}/stands") +operation ListStands { + input: ListStandsInput + output: StandSummaries + errors: [ + InvalidInputError + InternalServerError + ] +} + +@http(method: "PATCH", uri: "/stores/{storeId}/stands/{standId}") +operation UpdateStand { + input: UpdateStandInput + output: StandSummary + errors: [ + InvalidInputError + ResourceNotFoundError + InternalServerError + ] +} + +@idempotent +@http(method: "DELETE", uri: "/stores/{storeId}/stands/{standId}") +operation DeleteStand { + input: DeleteStandInput + output: StandSummary + errors: [ + InvalidInputError + ResourceNotFoundError + InternalServerError + ] } diff --git a/smithy/model/stand/stand-io.smithy b/smithy/model/stand/stand-io.smithy new file mode 100644 index 0000000..1bede6b --- /dev/null +++ b/smithy/model/stand/stand-io.smithy @@ -0,0 +1,59 @@ +$version: "2" + +namespace com.shopping.inandout.stand + +use com.shopping.inandout#InputPagination +use com.shopping.inandout#PositiveDouble +use com.shopping.inandout#UUID + +structure CreateStandInput { + @required + articleId: UUID + + @required + edgeId: UUID + + sourceNodeDistance: PositiveDouble +} + +structure GetStandInput { + @required + @httpLabel + storeId: UUID + + @required + @httpLabel + standId: UUID +} + +structure ListStandsInput with [InputPagination] { + @httpQuery("edgeId") + edgeId: UUID + + @httpQuery("articleId") + articleId: UUID +} + +structure UpdateStandInput { + @required + @httpLabel + storeId: UUID + + @required + @httpLabel + standId: UUID + + edgeId: UUID + + sourceNodeDistance: PositiveDouble +} + +structure DeleteStandInput { + @required + @httpLabel + storeId: UUID + + @required + @httpLabel + standId: UUID +} diff --git a/smithy/model/stand/stand-types.smithy b/smithy/model/stand/stand-types.smithy new file mode 100644 index 0000000..99d841c --- /dev/null +++ b/smithy/model/stand/stand-types.smithy @@ -0,0 +1,37 @@ +$version: "2" + +namespace com.shopping.inandout.stand + +use com.shopping.inandout#OutputPagination +use com.shopping.inandout#PositiveDouble +use com.shopping.inandout#UUID + +structure StandSummary { + @required + storeId: UUID + + @required + standId: UUID + + @required + articleId: UUID + + @required + edgeId: UUID + + sourceNodeDistance: PositiveDouble + + @required + createdAt: Timestamp + + @required + updatedAt: Timestamp +} + +list StandSummaryList { + member: StandSummary +} + +structure StandSummaries with [OutputPagination] { + tokens: StandSummaryList +} From 4ec94ccfaa31b9c747fd635410577e2583d75d02 Mon Sep 17 00:00:00 2001 From: Petru Braha Date: Mon, 9 Mar 2026 00:38:11 +0200 Subject: [PATCH 5/5] fix: added storeId references in the create and list operations --- smithy/model/stand/stand-io.smithy | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/smithy/model/stand/stand-io.smithy b/smithy/model/stand/stand-io.smithy index 1bede6b..4c07e1d 100644 --- a/smithy/model/stand/stand-io.smithy +++ b/smithy/model/stand/stand-io.smithy @@ -7,6 +7,10 @@ use com.shopping.inandout#PositiveDouble use com.shopping.inandout#UUID structure CreateStandInput { + @required + @httpLabel + storeId: UUID + @required articleId: UUID @@ -27,6 +31,10 @@ structure GetStandInput { } structure ListStandsInput with [InputPagination] { + @required + @httpLabel + storeId: UUID + @httpQuery("edgeId") edgeId: UUID