@@ -13,7 +13,6 @@ import (
13
13
"github.com/aws/aws-sdk-go-v2/aws"
14
14
"github.com/aws/aws-sdk-go-v2/service/s3"
15
15
"github.com/gin-gonic/gin"
16
- "github.com/google/uuid"
17
16
"github.com/slaveofcode/hansip/age_encryption"
18
17
"github.com/slaveofcode/hansip/repository"
19
18
"github.com/slaveofcode/hansip/repository/models"
@@ -26,11 +25,11 @@ import (
26
25
)
27
26
28
27
type 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"`
34
33
}
35
34
36
35
func 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
46
45
47
46
var bodyParams BundleFileGroupParam
48
47
if err := c .ShouldBindJSON (& bodyParams ); err != nil {
48
+ log .Println (err )
49
49
c .AbortWithStatusJSON (http .StatusBadRequest , gin.H {
50
50
"success" : false ,
51
51
"message" : "Invalid body request" ,
@@ -67,7 +67,7 @@ func BundleFileGroup(repo repository.Repository, s3Client *s3.Client) func(c *gi
67
67
var fileGroup models.FileGroup
68
68
res := db .Where (
69
69
`id = ? AND "userId" = ? AND "bundledAt" IS NULL` ,
70
- bodyParams .FileGroupId . String () ,
70
+ bodyParams .FileGroupId ,
71
71
userId ,
72
72
).First (& fileGroup )
73
73
0 commit comments