@@ -13,7 +13,6 @@ import (
1313 "github.com/aws/aws-sdk-go-v2/aws"
1414 "github.com/aws/aws-sdk-go-v2/service/s3"
1515 "github.com/gin-gonic/gin"
16- "github.com/google/uuid"
1716 "github.com/slaveofcode/hansip/age_encryption"
1817 "github.com/slaveofcode/hansip/repository"
1918 "github.com/slaveofcode/hansip/repository/models"
@@ -26,11 +25,11 @@ import (
2625)
2726
2827type BundleFileGroupParam struct {
29- FileGroupId uuid. UUID `json:"fileGroupId" binding:"required"`
30- ExpiredAt string `json:"expiredAt" binding:"required,datetime=2006-01-02T15:04:05Z07:00"` // format UTC: 2021-07-18T10:00:00.000Z
31- Passcode string `json:"passcode" binding:"required,gte=6,lte=100"`
32- DownloadPassword string `json:"downloadPassword" binding:"omitempty,gte=6,lte=100"`
33- UserIds []uint64 `json:"userIds" binding:"omitempty"`
28+ FileGroupId uint64 `json:"fileGroupId" binding:"required"`
29+ ExpiredAt string `json:"expiredAt" binding:"required,datetime=2006-01-02T15:04:05Z07:00"` // format UTC: 2021-07-18T10:00:00.000Z
30+ Passcode string `json:"passcode" binding:"required,gte=6,lte=100"`
31+ DownloadPassword string `json:"downloadPassword" binding:"omitempty,gte=6,lte=100"`
32+ UserIds []uint64 `json:"userIds" binding:"omitempty"`
3433}
3534
3635func BundleFileGroup (repo repository.Repository , s3Client * s3.Client ) func (c * gin.Context ) {
@@ -46,6 +45,7 @@ func BundleFileGroup(repo repository.Repository, s3Client *s3.Client) func(c *gi
4645
4746 var bodyParams BundleFileGroupParam
4847 if err := c .ShouldBindJSON (& bodyParams ); err != nil {
48+ log .Println (err )
4949 c .AbortWithStatusJSON (http .StatusBadRequest , gin.H {
5050 "success" : false ,
5151 "message" : "Invalid body request" ,
@@ -67,7 +67,7 @@ func BundleFileGroup(repo repository.Repository, s3Client *s3.Client) func(c *gi
6767 var fileGroup models.FileGroup
6868 res := db .Where (
6969 `id = ? AND "userId" = ? AND "bundledAt" IS NULL` ,
70- bodyParams .FileGroupId . String () ,
70+ bodyParams .FileGroupId ,
7171 userId ,
7272 ).First (& fileGroup )
7373
0 commit comments