-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad655d4
commit 311b5b6
Showing
12 changed files
with
177 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package domain | ||
|
||
import ( | ||
gen "github.com/thangchung/go-coffeeshop/proto/gen" | ||
) | ||
|
||
type ( | ||
QueryOrderFulfillmentUseCase interface { | ||
GetListOrderFulfillment() ([]gen.OrderDto, error) | ||
} | ||
|
||
QueryOrderFulfillmentRepo interface { | ||
GetListOrderFulfillment() ([]gen.OrderDto, error) | ||
} | ||
|
||
ProductServiceClient interface { | ||
GetItemsByType(*gen.PlaceOrderRequest, bool) (*gen.GetItemsByTypeResponse, error) | ||
} | ||
) |
2 changes: 1 addition & 1 deletion
2
internal/counter/entity/line_item.go → internal/counter/domain/line_item.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package entity | ||
package domain | ||
|
||
import ( | ||
"github.com/google/uuid" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package grpc | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/samber/lo" | ||
gen "github.com/thangchung/go-coffeeshop/proto/gen" | ||
"google.golang.org/grpc" | ||
) | ||
|
||
type ProductServiceClient struct { | ||
ctx context.Context | ||
conn *grpc.ClientConn | ||
} | ||
|
||
func NewProductServiceClient(ctx context.Context, conn *grpc.ClientConn) *ProductServiceClient { | ||
return &ProductServiceClient{ | ||
ctx: ctx, | ||
conn: conn, | ||
} | ||
} | ||
|
||
func (p *ProductServiceClient) GetItemsByType(request *gen.PlaceOrderRequest, isBarista bool) (*gen.GetItemsByTypeResponse, error) { | ||
c := gen.NewProductServiceClient(p.conn) | ||
|
||
itemTypes := "" | ||
if isBarista { | ||
itemTypes = lo.Reduce(request.BaristaItems, func(agg string, item *gen.CommandItem, _ int) string { | ||
return fmt.Sprintf("%s,%s", agg, item.ItemType) | ||
}, "") | ||
} else { | ||
itemTypes = lo.Reduce(request.KitchenItems, func(agg string, item *gen.CommandItem, _ int) string { | ||
return fmt.Sprintf("%s,%s", agg, item.ItemType) | ||
}, "") | ||
} | ||
|
||
return c.GetItemsByType(p.ctx, &gen.GetItemsByTypeRequest{ItemTypes: strings.TrimLeft(itemTypes, ",")}) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.