Files
crossnokaye-interview-assig…/services/item/design/design.go
2023-08-15 14:45:40 -05:00

80 lines
1.3 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)
Response("NotFound", CodeNotFound)
})
})
Method("listItems", func() {
Payload(func() {
Field(1, "nameFilter", ArrayOf(String))
})
Result(ArrayOf(Item))
GRPC(func() {
Response(CodeOK)
})
})
Method("createItem", func() {
Payload(Item)
Result(Item)
Error("AlreadyExists")
GRPC(func() {
Response(CodeOK)
Response("AlreadyExists", CodeAlreadyExists)
})
})
Method("updateItem", func() {
Payload(Item)
Result(Item)
Error("NotFound")
GRPC(func() {
Response(CodeOK)
Response("NotFound", CodeNotFound)
})
})
Method("deleteItem", func() {
Payload(func() {
Field(1, "name", String)
})
Result(Empty)
Error("NotFound")
GRPC(func() {
Response(CodeOK)
Response("NotFound", CodeNotFound)
})
})
})