Skip to content

Commit 7458c92

Browse files
authored
All Stand APIs (#14)
* feat: correct store-stand relationship * feat: stand APIs * fix: added storeId references in the create and list operations
1 parent 858d48b commit 7458c92

4 files changed

Lines changed: 195 additions & 0 deletions

File tree

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
$version: "2"
2+
3+
namespace com.shopping.inandout.stand
4+
5+
use com.shopping.inandout#InternalServerError
6+
use com.shopping.inandout#InvalidInputError
7+
use com.shopping.inandout#PositiveDouble
8+
use com.shopping.inandout#ResourceAlreadyExistsError
9+
use com.shopping.inandout#ResourceNotFoundError
10+
use com.shopping.inandout#UUID
11+
12+
resource Stand {
13+
identifiers: {
14+
storeId: UUID
15+
standId: UUID
16+
}
17+
properties: {
18+
articleId: UUID
19+
edgeId: UUID
20+
sourceNodeDistance: PositiveDouble
21+
createdAt: Timestamp
22+
updatedAt: Timestamp
23+
}
24+
create: CreateStand
25+
read: GetStand
26+
list: ListStands
27+
update: UpdateStand
28+
delete: DeleteStand
29+
}
30+
31+
@http(method: "POST", uri: "/stores/{storeId}/stands")
32+
operation CreateStand {
33+
input: CreateStandInput
34+
output: StandSummary
35+
errors: [
36+
InvalidInputError
37+
ResourceAlreadyExistsError
38+
InternalServerError
39+
]
40+
}
41+
42+
@readonly
43+
@http(method: "GET", uri: "/stores/{storeId}/stands/{standId}")
44+
operation GetStand {
45+
input: GetStandInput
46+
output: StandSummary
47+
errors: [
48+
InvalidInputError
49+
ResourceNotFoundError
50+
InternalServerError
51+
]
52+
}
53+
54+
@readonly
55+
@paginated
56+
@http(method: "GET", uri: "/stores/{storeId}/stands")
57+
operation ListStands {
58+
input: ListStandsInput
59+
output: StandSummaries
60+
errors: [
61+
InvalidInputError
62+
InternalServerError
63+
]
64+
}
65+
66+
@http(method: "PATCH", uri: "/stores/{storeId}/stands/{standId}")
67+
operation UpdateStand {
68+
input: UpdateStandInput
69+
output: StandSummary
70+
errors: [
71+
InvalidInputError
72+
ResourceNotFoundError
73+
InternalServerError
74+
]
75+
}
76+
77+
@idempotent
78+
@http(method: "DELETE", uri: "/stores/{storeId}/stands/{standId}")
79+
operation DeleteStand {
80+
input: DeleteStandInput
81+
output: StandSummary
82+
errors: [
83+
InvalidInputError
84+
ResourceNotFoundError
85+
InternalServerError
86+
]
87+
}

smithy/model/stand/stand-io.smithy

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
$version: "2"
2+
3+
namespace com.shopping.inandout.stand
4+
5+
use com.shopping.inandout#InputPagination
6+
use com.shopping.inandout#PositiveDouble
7+
use com.shopping.inandout#UUID
8+
9+
structure CreateStandInput {
10+
@required
11+
@httpLabel
12+
storeId: UUID
13+
14+
@required
15+
articleId: UUID
16+
17+
@required
18+
edgeId: UUID
19+
20+
sourceNodeDistance: PositiveDouble
21+
}
22+
23+
structure GetStandInput {
24+
@required
25+
@httpLabel
26+
storeId: UUID
27+
28+
@required
29+
@httpLabel
30+
standId: UUID
31+
}
32+
33+
structure ListStandsInput with [InputPagination] {
34+
@required
35+
@httpLabel
36+
storeId: UUID
37+
38+
@httpQuery("edgeId")
39+
edgeId: UUID
40+
41+
@httpQuery("articleId")
42+
articleId: UUID
43+
}
44+
45+
structure UpdateStandInput {
46+
@required
47+
@httpLabel
48+
storeId: UUID
49+
50+
@required
51+
@httpLabel
52+
standId: UUID
53+
54+
edgeId: UUID
55+
56+
sourceNodeDistance: PositiveDouble
57+
}
58+
59+
structure DeleteStandInput {
60+
@required
61+
@httpLabel
62+
storeId: UUID
63+
64+
@required
65+
@httpLabel
66+
standId: UUID
67+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
$version: "2"
2+
3+
namespace com.shopping.inandout.stand
4+
5+
use com.shopping.inandout#OutputPagination
6+
use com.shopping.inandout#PositiveDouble
7+
use com.shopping.inandout#UUID
8+
9+
structure StandSummary {
10+
@required
11+
storeId: UUID
12+
13+
@required
14+
standId: UUID
15+
16+
@required
17+
articleId: UUID
18+
19+
@required
20+
edgeId: UUID
21+
22+
sourceNodeDistance: PositiveDouble
23+
24+
@required
25+
createdAt: Timestamp
26+
27+
@required
28+
updatedAt: Timestamp
29+
}
30+
31+
list StandSummaryList {
32+
member: StandSummary
33+
}
34+
35+
structure StandSummaries with [OutputPagination] {
36+
tokens: StandSummaryList
37+
}

smithy/model/store/store-apis.smithy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use com.shopping.inandout#ResourceName
1212
use com.shopping.inandout#ResourceNotFoundError
1313
use com.shopping.inandout#Timezone
1414
use com.shopping.inandout#UUID
15+
use com.shopping.inandout.stand#Stand
1516

1617
resource Store {
1718
identifiers: {
@@ -28,6 +29,9 @@ resource Store {
2829
createdAt: Timestamp
2930
updatedAt: Timestamp
3031
}
32+
resources: [
33+
Stand
34+
]
3135
create: CreateStore
3236
read: GetStore
3337
list: ListStores

0 commit comments

Comments
 (0)