Splitting design into separate services
This commit is contained in:
67
services/item/design/design.go
Normal file
67
services/item/design/design.go
Normal file
@ -0,0 +1,67 @@
|
||||
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(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(Int)
|
||||
Result(Empty)
|
||||
Error("NotFound")
|
||||
Error("BadRequest")
|
||||
|
||||
GRPC(func() {
|
||||
Response(CodeOK)
|
||||
Response("NotFound", CodeNotFound)
|
||||
Response("BadRequest", CodeInvalidArgument)
|
||||
})
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user