78 lines
1.2 KiB
Go
78 lines
1.2 KiB
Go
package design
|
|
|
|
import (
|
|
. "crossnokaye-interview-assignment/design"
|
|
|
|
. "goa.design/goa/v3/dsl"
|
|
)
|
|
|
|
var _ = API("item", func() {
|
|
Title("Item Service")
|
|
Server("item", func() {
|
|
Host("localhost", func() {
|
|
URI("grpc://localhost:8082")
|
|
})
|
|
})
|
|
})
|
|
|
|
var _ = Service("item", func() {
|
|
Description("A GRPC back service that handles CRUD operations for the items that exist and their attributes")
|
|
|
|
Method("getItem", func() {
|
|
Payload(func() {
|
|
Field(1, "name", String)
|
|
})
|
|
Result(Item)
|
|
Error("NotFound")
|
|
|
|
GRPC(func() {
|
|
Response(CodeOK)
|
|
})
|
|
})
|
|
|
|
Method("listItems", func() {
|
|
Payload(Empty)
|
|
Result(ArrayOf(Item))
|
|
|
|
GRPC(func() {
|
|
Response(CodeOK)
|
|
})
|
|
})
|
|
|
|
Method("createItem", func() {
|
|
Payload(Item)
|
|
Result(Item)
|
|
Error("BadRequest")
|
|
|
|
GRPC(func() {
|
|
Response(CodeOK)
|
|
})
|
|
})
|
|
|
|
Method("updateItem", func() {
|
|
Payload(Item)
|
|
Result(Item)
|
|
Error("NotFound")
|
|
Error("BadRequest")
|
|
|
|
GRPC(func() {
|
|
Response(CodeOK)
|
|
})
|
|
})
|
|
|
|
Method("deleteItem", func() {
|
|
Payload(func() {
|
|
Field(1, "name", String)
|
|
})
|
|
Result(Empty)
|
|
Error("NotFound")
|
|
Error("BadRequest")
|
|
|
|
GRPC(func() {
|
|
Response(CodeOK)
|
|
Response("NotFound", CodeNotFound)
|
|
Response("BadRequest", CodeInvalidArgument)
|
|
})
|
|
})
|
|
})
|