diff --git a/README.md b/README.md
index 4a96380..9b5309a 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,7 @@
Fast Telegram Drive
+
+[![Discord](https://img.shields.io/discord/1142377485737148479?label=discord&logo=discord&style=flat-square&logoColor=white)](https://discord.gg/hfTUKGU2C6)
+
Table of Contents
diff --git a/services/upload.service.go b/services/upload.service.go
index 931d9a6..38f8387 100644
--- a/services/upload.service.go
+++ b/services/upload.service.go
@@ -61,6 +61,14 @@ func (us *UploadService) UploadFile(c *gin.Context) (*schemas.UploadPartOut, *ty
uploadId := c.Param("id")
+ var uploadPart []models.Upload
+
+ us.Db.Model(&models.Upload{}).Where("upload_id = ?", uploadId).Where("part_no = ?", uploadQuery.PartNo).Find(&uploadPart)
+
+ if len(uploadPart) == 1 {
+ out := mapSchema(&uploadPart[0])
+ return out, nil
+ }
config := utils.GetConfig()
var tgClient *utils.Client
@@ -138,15 +146,20 @@ func (us *UploadService) UploadFile(c *gin.Context) (*schemas.UploadPartOut, *ty
return nil, &types.AppError{Error: errors.New("failed to upload part"), Code: http.StatusInternalServerError}
}
- out := &schemas.UploadPartOut{
- ID: partUpload.ID,
- Name: partUpload.Name,
- PartId: partUpload.PartId,
- ChannelID: partUpload.ChannelID,
- PartNo: partUpload.PartNo,
- TotalParts: partUpload.TotalParts,
- Size: partUpload.Size,
- }
+ out := mapSchema(partUpload)
return out, nil
}
+
+func mapSchema(in *models.Upload) *schemas.UploadPartOut {
+ out := &schemas.UploadPartOut{
+ ID: in.ID,
+ Name: in.Name,
+ PartId: in.PartId,
+ ChannelID: in.ChannelID,
+ PartNo: in.PartNo,
+ TotalParts: in.TotalParts,
+ Size: in.Size,
+ }
+ return out
+}