remove chunk
This commit is contained in:
parent
44f0cf68be
commit
3e48bd14df
@ -26,22 +26,12 @@ var (
|
|||||||
|
|
||||||
// Model
|
// Model
|
||||||
type File struct {
|
type File struct {
|
||||||
ID uint32 `gorm:"primary_key" json:"id"`
|
ID uint32 `gorm:"primary_key" json:"id"`
|
||||||
Name string `gorm:"not null" json:"name"`
|
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
|
|
||||||
Checksum string `gorm:"unique;size:44;not null"`
|
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"`
|
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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user