Files
Gokapi/internal/models/UploadStatus.go
T
2024-05-24 11:01:56 +02:00

27 lines
790 B
Go

package models
import (
"encoding/json"
)
// UploadStatus contains information about the current status of a file upload
type UploadStatus struct {
// ChunkId is the identifier for the chunk
ChunkId string `json:"chunkid"`
// CurrentStatus indicates if the chunk is currently being processed (e.g. encrypting or
// hashing) or being moved/uploaded to the file storage
// See processingstatus for definition
CurrentStatus int `json:"currentstatus"`
// LastUpdate indicates the last status change
LastUpdate int64 `json:"lastupdate"`
// Type is the type of the message and is always "uploadstatus"
Type string `json:"type"`
}
// ToJson returns the struct as a Json byte array
func (u *UploadStatus) ToJson() ([]byte, error) {
u.Type = "uploadstatus"
return json.Marshal(u)
}