rename func

This commit is contained in:
AustrianToast 2024-06-03 21:04:50 +02:00
parent f63932ddaf
commit a36fccfa1f
No known key found for this signature in database
GPG Key ID: 5CD422268E489EB4

View File

@ -20,7 +20,7 @@ var uploadFolder string
func main() {
var err error
dbpool, err = pgxpool.New(context.Background(), "postgresql://postgres:postgres@172.19.0.2:5432/postgres")
dbpool, err = pgxpool.New(context.Background(), "postgresql://postgres:postgres@172.19.0.3:5432/postgres")
if err != nil {
log.Fatal(err)
}
@ -60,7 +60,7 @@ func main() {
router.SetTrustedProxies(nil)
router.POST("/video/init", initUpload)
router.POST("/video/chunk", ReceiveChunk)
router.POST("/video/chunk", receiveChunk)
router.POST("/video/completed", finishUpload)
router.GET("/videos", listVideos)
router.GET("/videos/:id", getVideo)
@ -86,7 +86,6 @@ func initUpload(c *gin.Context) {
c.JSON(http.StatusInternalServerError, "")
log.Fatalf("initUpload: %v\n", err)
}
fmt.Println(filepath)
if filepath == fmt.Sprintf("%s/%s", uploadFolder, fileName) {
c.JSON(http.StatusForbidden, "File already exists")
return
@ -101,7 +100,7 @@ func initUpload(c *gin.Context) {
c.JSON(http.StatusOK, "Upload can proceed")
}
func ReceiveChunk(c *gin.Context) {
func receiveChunk(c *gin.Context) {
chunk, err := io.ReadAll(c.Request.Body)
if err != nil {
c.JSON(http.StatusBadRequest, "Couldn't read html request body")