Files
zeekay 1943f1c093 Hanzo Commerce
Multi-tenant commerce and billing: orders, subscriptions, invoices, plans,
usage metering and a credit ledger. One Go binary. MIT OR Apache-2.0.

Claude-Session: https://claude.ai/code/session_01SAtaDFm8VDiWrhYHNNtxMw
2026-09-23 21:52:16 -07:00

45 lines
1.1 KiB
Go

package site
import (
"github.com/zap-proto/zip"
// "github.com/hanzoai/commerce/datastore"
// "github.com/hanzoai/commerce/models/site"
"github.com/hanzoai/commerce/config"
"github.com/hanzoai/commerce/log"
"github.com/hanzoai/commerce/middleware"
"github.com/hanzoai/commerce/thirdparty/netlify"
)
func listFiles(c *zip.Ctx) error {
return nil
}
func getFile(c *zip.Ctx) error {
return nil
}
func putFile(c *zip.Ctx) error {
// siteid := c.Param("siteid") // oursiteid
deployid := c.Param("deployid")
filepath := c.Param("filepath")
// db := datastore.New(c)
// ste := site.New(db)
// err := ste.GetById(siteid)
// if err != nil {
// msg := fmt.Sprintf("Site '%s' not found", siteid)
// http.Fail(c, 404, msg, nil)
// return
// }
ctx := c.Context()
org := middleware.GetOrganization(c)
accessToken := netlify.GetAccessToken(ctx, org.Name)
url := config.Netlify.BaseUrl + "/deploys/" + deployid + "/files" + filepath
url += "?access_token=" + accessToken
log.Debug("Returning redirect, upload file to: %s", url, c)
return c.Redirect(307, url)
}