Skip to content

feat(client): upload images client flow with s3 presigned#67

Open
anmho wants to merge 9 commits into
anmho/fix-api-dev-serverfrom
anmho/upload-image-client
Open

feat(client): upload images client flow with s3 presigned#67
anmho wants to merge 9 commits into
anmho/fix-api-dev-serverfrom
anmho/upload-image-client

Conversation

@anmho

@anmho anmho commented Dec 9, 2024

Copy link
Copy Markdown
Collaborator

Implemented client using React-Query.
Used a Promise.all approach and displayed upload state to the user.
Updated http method to from GET to POST for /create-upload-url

@anmho anmho changed the base branch from main to anmho/fix-api-dev-server December 9, 2024 04:12
@anmho anmho requested a review from Jish2 December 9, 2024 04:12
Comment thread Makefile
gen:
@$(MAKE) -C api openapi
@orval --input ./api/openapi.yaml --output ./client-v2/gen/openapi.ts
@orval --input ./api/openapi.yaml --output ./client-v2/lib/api/happened.ts

@anmho anmho Dec 9, 2024

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add to a lib/api folder for to improve semantics.

Comment thread api/cmd/api/main.go
logger.Info("successfully pinged db")

cfg, err := awsConfig.LoadDefaultConfig(ctx)
cfg, err := awsConfig.LoadDefaultConfig(ctx, awsConfig.WithRegion("us-west-2"))

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Force us-west-2 but this should be an environment variable.

Comment thread api/pkg/server/routes.go
}, protectedGreetHandler())

huma.Get(api, "/create-upload-url", CreateUploadURLHandler(imageService))
huma.Post(api, "/create-upload-url", CreateUploadURLHandler(imageService))

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Post since we are created a presigned upload url resource.

if (completeSignIn.status === "complete") {
await setActive({ session: completeSignIn.createdSessionId });
router.replace("/(home)");
router.replace("/(tabs)");

@anmho anmho Dec 9, 2024

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Navigate to tabs layout as the home.

// Queries
const { isPending: isUploadPending, mutateAsync: uploadImagesMutation } =
useMutation({
mutationFn: uploadImages,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upload/create journey tab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant