Implementing list endpoints
This commit is contained in:
@ -16,8 +16,16 @@ var _ = API("inventory", func() {
|
||||
|
||||
var _ = Service("inventory", func() {
|
||||
Description("A GRPC back service that handles CRUD operations for the characters’ inventories")
|
||||
// Method("listItems", func() {
|
||||
// })
|
||||
Method("listInventory", func() {
|
||||
Payload(func() {
|
||||
Field(1, "characterId", Int)
|
||||
})
|
||||
Result(ArrayOf(Int))
|
||||
|
||||
GRPC(func() {
|
||||
Response(CodeOK)
|
||||
})
|
||||
})
|
||||
|
||||
Method("addItem", func() {
|
||||
Payload(design.InventoryRecord)
|
||||
|
@ -56,6 +56,12 @@ func (s *inventorysrvc) RemoveItem(ctx context.Context, p *inventory.InventoryRe
|
||||
return
|
||||
}
|
||||
|
||||
func (s *inventorysrvc) ListInventory(ctx context.Context, payload *inventory.ListInventoryPayload) (res []int, err error) {
|
||||
res = *s.inventories[*payload.CharacterID]
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (s *inventorysrvc) initCharacterInventory(characterId *int) (itemList *[]int) {
|
||||
list := make([]int, 0)
|
||||
itemList = &list
|
||||
|
Reference in New Issue
Block a user