54 lines
993 B
Go
54 lines
993 B
Go
package design
|
||
|
||
import (
|
||
"crossnokaye-interview-assignment/design"
|
||
. "goa.design/goa/v3/dsl"
|
||
)
|
||
|
||
var _ = API("inventory", func() {
|
||
Title("Inventory Service")
|
||
Server("inventory", func() {
|
||
Host("localhost", func() {
|
||
URI("grpc://localhost:8081")
|
||
})
|
||
})
|
||
})
|
||
|
||
var _ = Service("inventory", func() {
|
||
Description("A GRPC back service that handles CRUD operations for the characters’ inventories")
|
||
Method("listInventory", func() {
|
||
Payload(func() {
|
||
Field(1, "characterName", String)
|
||
})
|
||
Result(ArrayOf(String))
|
||
|
||
GRPC(func() {
|
||
Response(CodeOK)
|
||
})
|
||
})
|
||
|
||
Method("addItem", func() {
|
||
Payload(design.InventoryRecord)
|
||
Result(Empty)
|
||
Error("NotFound")
|
||
Error("BadRequest")
|
||
|
||
GRPC(func() {
|
||
Response(CodeOK)
|
||
})
|
||
})
|
||
|
||
Method("removeItem", func() {
|
||
Payload(design.InventoryRecord)
|
||
Result(Empty)
|
||
Error("NotFound")
|
||
Error("BadRequest")
|
||
|
||
GRPC(func() {
|
||
Response(CodeOK)
|
||
Response("NotFound", CodeNotFound)
|
||
Response("BadRequest", CodeInvalidArgument)
|
||
})
|
||
})
|
||
})
|