@@ -27,6 +27,7 @@ type schemaMetaData struct {
2727 UnlimitedDownloads int
2828 UnlimitedTime int
2929 UserId int
30+ UploadDate int64
3031}
3132
3233func (rowData schemaMetaData ) ToFileModel () (models.File , error ) {
@@ -48,6 +49,7 @@ func (rowData schemaMetaData) ToFileModel() (models.File, error) {
4849 UnlimitedDownloads : rowData .UnlimitedDownloads == 1 ,
4950 UnlimitedTime : rowData .UnlimitedTime == 1 ,
5051 UserId : rowData .UserId ,
52+ UploadDate : rowData .UploadDate ,
5153 }
5254
5355 buf := bytes .NewBuffer (rowData .Encryption )
@@ -67,7 +69,7 @@ func (p DatabaseProvider) GetAllMetadata() map[string]models.File {
6769 err = rows .Scan (& rowData .Id , & rowData .Name , & rowData .Size , & rowData .SHA1 , & rowData .ExpireAt , & rowData .SizeBytes ,
6870 & rowData .ExpireAtString , & rowData .DownloadsRemaining , & rowData .DownloadCount , & rowData .PasswordHash ,
6971 & rowData .HotlinkId , & rowData .ContentType , & rowData .AwsBucket , & rowData .Encryption ,
70- & rowData .UnlimitedDownloads , & rowData .UnlimitedTime , & rowData .UserId )
72+ & rowData .UnlimitedDownloads , & rowData .UnlimitedTime , & rowData .UserId , & rowData . UploadDate )
7173 helper .Check (err )
7274 var metaData models.File
7375 metaData , err = rowData .ToFileModel ()
@@ -101,7 +103,7 @@ func (p DatabaseProvider) GetMetaDataById(id string) (models.File, bool) {
101103 err := row .Scan (& rowData .Id , & rowData .Name , & rowData .Size , & rowData .SHA1 , & rowData .ExpireAt , & rowData .SizeBytes ,
102104 & rowData .ExpireAtString , & rowData .DownloadsRemaining , & rowData .DownloadCount , & rowData .PasswordHash ,
103105 & rowData .HotlinkId , & rowData .ContentType , & rowData .AwsBucket , & rowData .Encryption ,
104- & rowData .UnlimitedDownloads , & rowData .UnlimitedTime , & rowData .UserId )
106+ & rowData .UnlimitedDownloads , & rowData .UnlimitedTime , & rowData .UserId , & rowData . UploadDate )
105107 if err != nil {
106108 if errors .Is (err , sql .ErrNoRows ) {
107109 return result , false
@@ -131,6 +133,7 @@ func (p DatabaseProvider) SaveMetaData(file models.File) {
131133 ContentType : file .ContentType ,
132134 AwsBucket : file .AwsBucket ,
133135 UserId : file .UserId ,
136+ UploadDate : file .UploadDate ,
134137 }
135138
136139 if file .UnlimitedDownloads {
@@ -148,10 +151,10 @@ func (p DatabaseProvider) SaveMetaData(file models.File) {
148151
149152 _ , err = p .sqliteDb .Exec (`INSERT OR REPLACE INTO FileMetaData (Id, Name, Size, SHA1, ExpireAt, SizeBytes, ExpireAtString,
150153 DownloadsRemaining, DownloadCount, PasswordHash, HotlinkId, ContentType, AwsBucket, Encryption,
151- UnlimitedDownloads, UnlimitedTime, UserId) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` ,
154+ UnlimitedDownloads, UnlimitedTime, UserId, UploadDate ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` ,
152155 newData .Id , newData .Name , newData .Size , newData .SHA1 , newData .ExpireAt , newData .SizeBytes , newData .ExpireAtString ,
153156 newData .DownloadsRemaining , newData .DownloadCount , newData .PasswordHash , newData .HotlinkId , newData .ContentType ,
154- newData .AwsBucket , newData .Encryption , newData .UnlimitedDownloads , newData .UnlimitedTime , newData .UserId )
157+ newData .AwsBucket , newData .Encryption , newData .UnlimitedDownloads , newData .UnlimitedTime , newData .UserId , newData . UploadDate )
155158 helper .Check (err )
156159}
157160
0 commit comments