remove chunk

This commit is contained in:
celogeek 2022-05-14 17:48:13 +02:00
parent 44f0cf68be
commit 3e48bd14df
Signed by: celogeek
GPG Key ID: E6B7BDCFC446233A

View File

@ -32,16 +32,6 @@ type File struct {
Size uint64 `gorm:"not null"` Size uint64 `gorm:"not null"`
Author *Account `gorm:"constraint:OnDelete:SET NULL,OnUpdate:CASCADE" json:"author"` Author *Account `gorm:"constraint:OnDelete:SET NULL,OnUpdate:CASCADE" json:"author"`
AuthorId *uint32 `json:"-"` AuthorId *uint32 `json:"-"`
Chunks []*FileChunk `gorm:"constraint:OnDelete:CASCADE,OnUpdate:CASCADE"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type FileChunk struct {
FileId uint32
File *File `gorm:"constraint:OnDelete:CASCADE,OnUpdate:CASCADE"`
Part uint32
Checksum string `gorm:"unique;size:44;not null"`
CreatedAt time.Time `json:"created_at"` CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"` UpdatedAt time.Time `json:"updated_at"`
} }
@ -176,6 +166,7 @@ func (s *Service) UploadComplete(c *gin.Context) {
func (s *Service) UploadInit() { func (s *Service) UploadInit() {
upload := s.Gin.Group("/upload") upload := s.Gin.Group("/upload")
upload.Use(s.RequireSession)
// start // start
upload.POST("", s.UploadCreate) upload.POST("", s.UploadCreate)