Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
fix: minor fixes
Browse files Browse the repository at this point in the history
    * Correct delete response header for go example from 'Put' to 'Delete'
    * Correct Justfile reference to 'frontend/web' to 'web'
    * Add slices package to replace ftl package that is now internal
    * Correct json serialization of product pricing from 'priceUSD' to 'priceUsd'
  • Loading branch information
akhileshnayak committed Feb 29, 2024
1 parent 7a06df9 commit 34321cd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ type DeleteResponse struct{}
//ftl:ingress http DELETE /http/users/{userId}
func Delete(ctx context.Context, req builtin.HttpRequest[DeleteRequest]) (builtin.HttpResponse[DeleteResponse, ftl.Unit], error) {
return builtin.HttpResponse[DeleteResponse, ftl.Unit]{
Headers: map[string][]string{"Put": {"Header from FTL"}},
Headers: map[string][]string{"Delete": {"Header from FTL"}},
Body: ftl.Some(DeleteResponse{}),
}, nil
}
2 changes: 1 addition & 1 deletion online-boutique/Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ dev:

# Start the example web frontend for online-boutique
web:
cd frontend/web && npm install && npm run dev
cd web && npm install && npm run dev
3 changes: 2 additions & 1 deletion online-boutique/backend/services/checkout/checkout.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"context"
"fmt"

"github.com/TBD54566975/ftl/examples/online-boutique/slices"

"github.com/google/uuid"

"ftl/builtin"
Expand All @@ -14,7 +16,6 @@ import (
"ftl/productcatalog"
"ftl/shipping"

"github.com/TBD54566975/ftl/backend/common/slices"
"github.com/TBD54566975/ftl/examples/online-boutique/common/money"

"github.com/TBD54566975/ftl/go-runtime/ftl"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type Product struct {
Name string `json:"name"`
Description string `json:"description"`
Picture string `json:"picture"`
PriceUSD currency.Money `json:"priceUSD"`
PriceUSD currency.Money `json:"priceUsd"`

// Categories such as "clothing" or "kitchen" that can be used to look up
// other related products.
Expand Down
9 changes: 9 additions & 0 deletions online-boutique/backend/slices/slices.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package slices

func Map[T, U any](slice []T, fn func(T) U) []U {
result := make([]U, len(slice))
for i, v := range slice {
result[i] = fn(v)
}
return result
}

0 comments on commit 34321cd

Please sign in to comment.