72 lines
1.1 KiB
Go
72 lines
1.1 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, "id", Int)
|
|
})
|
|
Result(Item)
|
|
Error("NotFound")
|
|
|
|
GRPC(func() {
|
|
Response(CodeOK)
|
|
})
|
|
})
|
|
|
|
// Method("listItems", func() {
|
|
// })
|
|
|
|
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, "id", Int)
|
|
})
|
|
Result(Empty)
|
|
Error("NotFound")
|
|
Error("BadRequest")
|
|
|
|
GRPC(func() {
|
|
Response(CodeOK)
|
|
Response("NotFound", CodeNotFound)
|
|
Response("BadRequest", CodeInvalidArgument)
|
|
})
|
|
})
|
|
})
|