From 81c4bd775a1a362ec82750487e7a72c8f13c480b Mon Sep 17 00:00:00 2001 From: divyam234 <47589864+divyam234@users.noreply.github.com> Date: Sat, 3 Aug 2024 19:14:03 +0530 Subject: [PATCH] fix: rename file bug --- pkg/schemas/file.go | 3 --- pkg/services/file.go | 7 +------ pkg/services/file_test.go | 1 - 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/pkg/schemas/file.go b/pkg/schemas/file.go index aa175e5..5d3e1eb 100644 --- a/pkg/schemas/file.go +++ b/pkg/schemas/file.go @@ -61,11 +61,8 @@ type FileOutFull struct { type FileUpdate struct { Name string `json:"name,omitempty"` - Type string `json:"type,omitempty"` Starred *bool `json:"starred,omitempty"` - ParentID string `json:"parentId,omitempty"` UpdatedAt time.Time `json:"updatedAt,omitempty"` - CreatedAt time.Time `json:"createdAt,omitempty"` Parts []Part `json:"parts,omitempty"` Size *int64 `json:"size,omitempty"` } diff --git a/pkg/services/file.go b/pkg/services/file.go index 35e07ea..5f0773b 100644 --- a/pkg/services/file.go +++ b/pkg/services/file.go @@ -159,14 +159,9 @@ func (fs *FileService) UpdateFile(id string, userId int64, update *schemas.FileU ) updateDb := models.File{ - Name: update.Name, - ParentID: sql.NullString{ - String: update.ParentID, - Valid: true, - }, + Name: update.Name, UpdatedAt: update.UpdatedAt, Size: update.Size, - CreatedAt: update.CreatedAt, } if update.Starred != nil { diff --git a/pkg/services/file_test.go b/pkg/services/file_test.go index 0b387dd..ba6ae74 100644 --- a/pkg/services/file_test.go +++ b/pkg/services/file_test.go @@ -76,7 +76,6 @@ func (s *FileServiceSuite) Test_Update() { s.NoError(err.Error) data := &schemas.FileUpdate{ Name: "file3.jpeg", - Type: "file", } r, err := s.srv.UpdateFile(res.Id, 123456, data) s.NoError(err.Error)