nhost / hasura-storage

Storage for Hasura built on top of S3
Apache License 2.0
213 stars 42 forks source link

feat: added metadata column to files #170

Closed dbarrosop closed 1 year ago

dbarrosop commented 1 year ago

Fixes #134 and #160

This basically introduces a new column metadata to the files table of type jsonb. The user can populate this with any data it wants by adding a metadata object to the metadata[] field in the multipart-form (metadata field when updating files). For instance:

curl http://localhost:8080/v1/files \
  -H "Content-Type: multipart/form-data" \
  -H "$AUTH" \
  -F "file[]=@client/testdata/alphabet.txt" \
  -F "metadata[]={\"metadata\":{\"num\":123,\"list\":[1,2,3]}};type=application/json"

In addition, we are moving away from the graphql client github.com/hasura/go-graphql-client to github.com/Yamashou/gqlgenc as I was running into some troubles dealing with jsonb objects. This has the side-effect the graphql code is much cleaner and easier to understand (this was long overdue to be honest).