This commit is contained in:
@@ -7,6 +7,7 @@ type User struct {
|
||||
Username string `gorm:"uniqueIndex;size:32;not null" json:"username"`
|
||||
PasswordHash string `json:"-"`
|
||||
CanManageUsers bool `json:"canManageUsers"`
|
||||
CanManageFiles bool `json:"canManageFiles"`
|
||||
CanUpload bool `json:"canUpload"`
|
||||
CanAdvancedUpload bool `json:"canAdvancedUpload"`
|
||||
MustChangePassword bool `json:"mustChangePassword"`
|
||||
@@ -41,22 +42,26 @@ type SharedFile struct {
|
||||
func (f SharedFile) HasPickupCode() bool { return f.PickupCodeHash != "" }
|
||||
|
||||
type fileResponse struct {
|
||||
ID uint `json:"id"`
|
||||
Hash string `json:"hash"`
|
||||
Name string `json:"name"`
|
||||
MimeType string `json:"mimeType"`
|
||||
Size int64 `json:"size"`
|
||||
ExpiresAt *time.Time `json:"expiresAt"`
|
||||
MaxDownloads *int `json:"maxDownloads"`
|
||||
DownloadCount int `json:"downloadCount"`
|
||||
HasPickupCode bool `json:"hasPickupCode"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
ID uint `json:"id"`
|
||||
Hash string `json:"hash"`
|
||||
Name string `json:"name"`
|
||||
MimeType string `json:"mimeType"`
|
||||
Size int64 `json:"size"`
|
||||
ExpiresAt *time.Time `json:"expiresAt"`
|
||||
MaxDownloads *int `json:"maxDownloads"`
|
||||
DownloadCount int `json:"downloadCount"`
|
||||
OwnerID uint `json:"ownerId"`
|
||||
OwnerUsername string `json:"ownerUsername,omitempty"`
|
||||
HasPickupCode bool `json:"hasPickupCode"`
|
||||
FailedCodeAttempts int `json:"failedCodeAttempts"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
func presentFile(f SharedFile) fileResponse {
|
||||
return fileResponse{
|
||||
ID: f.ID, Hash: f.Hash, Name: f.OriginalName, MimeType: f.MimeType,
|
||||
Size: f.Size, ExpiresAt: f.ExpiresAt, MaxDownloads: f.MaxDownloads,
|
||||
DownloadCount: f.DownloadCount, HasPickupCode: f.HasPickupCode(), CreatedAt: f.CreatedAt,
|
||||
DownloadCount: f.DownloadCount, OwnerID: f.OwnerID, HasPickupCode: f.HasPickupCode(),
|
||||
FailedCodeAttempts: f.FailedCodeAttempts, CreatedAt: f.CreatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user