diff --git a/smithy/model/brand/brand-apis.smithy b/smithy/model/brand/brand-apis.smithy new file mode 100644 index 0000000..749ad33 --- /dev/null +++ b/smithy/model/brand/brand-apis.smithy @@ -0,0 +1,76 @@ +$version: "2" + +namespace com.shopping.inandout.brand + +use com.shopping.inandout#DeleteRestrictedError +use com.shopping.inandout#ImageUrl +use com.shopping.inandout#InternalServerError +use com.shopping.inandout#InvalidInputError +use com.shopping.inandout#ResourceAlreadyExistsError +use com.shopping.inandout#ResourceName +use com.shopping.inandout#ResourceNotFoundError +use com.shopping.inandout#UUID + +resource Brand { + identifiers: { + brandId: UUID + } + properties: { + name: ResourceName + logoUrl: ImageUrl + createdAt: Timestamp + updatedAt: Timestamp + } + create: CreateBrand + read: GetBrand + update: UpdateBrand + delete: DeleteBrand +} + +@http(method: "POST", uri: "/brands") +operation CreateBrand { + input: CreateBrandInput + output: BrandSummary + errors: [ + InvalidInputError + ResourceAlreadyExistsError + InternalServerError + ] +} + +@readonly +@http(method: "GET", uri: "/brands/{brandId}") +operation GetBrand { + input: GetBrandInput + output: BrandSummary + errors: [ + InvalidInputError + ResourceNotFoundError + InternalServerError + ] +} + +@http(method: "PATCH", uri: "/brands/{brandId}") +operation UpdateBrand { + input: UpdateBrandInput + output: BrandSummary + errors: [ + InvalidInputError + ResourceNotFoundError + InternalServerError + ] +} + +@idempotent +@http(method: "DELETE", uri: "/brands/{brandId}") +@documentation("Restricted cascading operation, references for stores and articles should NOT exist") +operation DeleteBrand { + input: DeleteBrandInput + output: BrandSummary + errors: [ + InvalidInputError + ResourceNotFoundError + DeleteRestrictedError + InternalServerError + ] +} diff --git a/smithy/model/brand/brand-io.smithy b/smithy/model/brand/brand-io.smithy new file mode 100644 index 0000000..1e77ef9 --- /dev/null +++ b/smithy/model/brand/brand-io.smithy @@ -0,0 +1,36 @@ +$version: "2" + +namespace com.shopping.inandout.brand + +use com.shopping.inandout#ImageUrl +use com.shopping.inandout#ResourceName +use com.shopping.inandout#UUID + +structure CreateBrandInput { + @required + name: ResourceName + + logoUrl: ImageUrl +} + +structure GetBrandInput { + @required + @httpLabel + brandId: UUID +} + +structure UpdateBrandInput { + @required + @httpLabel + brandId: UUID + + name: ResourceName + + logoUrl: ImageUrl +} + +structure DeleteBrandInput { + @required + @httpLabel + brandId: UUID +} diff --git a/smithy/model/brand/brand-types.smithy b/smithy/model/brand/brand-types.smithy new file mode 100644 index 0000000..04f8cbc --- /dev/null +++ b/smithy/model/brand/brand-types.smithy @@ -0,0 +1,23 @@ +$version: "2" + +namespace com.shopping.inandout.brand + +use com.shopping.inandout#ImageUrl +use com.shopping.inandout#ResourceName +use com.shopping.inandout#UUID + +structure BrandSummary { + @required + brandId: UUID + + @required + name: ResourceName + + logoUrl: ImageUrl + + @required + createdAt: Timestamp + + @required + updatedAt: Timestamp +} diff --git a/smithy/model/common.smithy b/smithy/model/common.smithy index 90426d1..34d0b92 100644 --- a/smithy/model/common.smithy +++ b/smithy/model/common.smithy @@ -9,3 +9,11 @@ string UUID list UUIDList { member: UUID } + +@pattern("^[a-zA-Z0-9\\- ]+$") +@length(min: 3, max: 63) +string ResourceName + +@pattern("^https?://[a-zA-Z0-9\\-._~:/?#\\[\\]@!$&'()*+,;=%]+\\.(jpg|jpeg|png|gif)$") +@length(min: 8, max: 255) +string ImageUrl diff --git a/smithy/model/main.smithy b/smithy/model/main.smithy index adae545..4e67665 100644 --- a/smithy/model/main.smithy +++ b/smithy/model/main.smithy @@ -2,12 +2,16 @@ $version: "2" namespace com.shopping.inandout -use com.shopping.inandout.tsp#FindTspSolution use aws.protocols#restJson1 +use com.shopping.inandout.brand#Brand +use com.shopping.inandout.tsp#FindTspSolution @restJson1 service InAndOut { version: "2026-04-01" + resources: [ + Brand + ] operations: [ FindTspSolution ]