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

@ -26,22 +26,12 @@ var (
// Model
type File struct {
ID uint32 `gorm:"primary_key" json:"id"`
Name string `gorm:"not null" json:"name"`
Checksum string `gorm:"unique;size:44;not null"`
Size uint64 `gorm:"not null"`
Author *Account `gorm:"constraint:OnDelete:SET NULL,OnUpdate:CASCADE" json:"author"`
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
ID uint32 `gorm:"primary_key" json:"id"`
Name string `gorm:"not null" json:"name"`
Checksum string `gorm:"unique;size:44;not null"`
Size uint64 `gorm:"not null"`
Author *Account `gorm:"constraint:OnDelete:SET NULL,OnUpdate:CASCADE" json:"author"`
AuthorId *uint32 `json:"-"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
@ -176,6 +166,7 @@ func (s *Service) UploadComplete(c *gin.Context) {
func (s *Service) UploadInit() {
upload := s.Gin.Group("/upload")
upload.Use(s.RequireSession)
// start
upload.POST("", s.UploadCreate)