Implementing list endpoints

This commit is contained in:
Brandon Watson
2023-08-14 20:21:33 -05:00
parent 6799b59f9c
commit bdb7a39a91
8 changed files with 135 additions and 12 deletions

View File

@ -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)

View File

@ -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