feat: add file visibility toggle for files

This commit is contained in:
2024-09-15 23:59:19 +07:00
parent dc330cc72f
commit b246d85fac
22 changed files with 738 additions and 144 deletions

View File

@ -18,6 +18,7 @@ type File struct {
TotalChunk uint64 `gorm:"not null"`
StartHash string `gorm:"type:text;not null"`
EndHash string `gorm:"type:text;not null"`
IsPrivate bool `gorm:"not null;default:true"`
Downloaded uint64 `gorm:"not null;default:0"`
Owner *User `gorm:"foreignKey:OwnerID;constraint:OnDelete:CASCADE;"`
}

View File

@ -30,6 +30,7 @@ type FileData struct {
ID string
Name string
Size string
IsPrivate bool
Downloaded string
}
@ -60,6 +61,7 @@ type Database interface {
GetUserFile(name string, ownerID string) (*models.File, error)
GetFiles(ownerID string) ([]*models.File, error)
IncrementDownloadCount(fileID string) error
ChangeFileVisibility(fileID string) error
InitializeTotp(email string, secret string) error
}