mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-15 12:34:44 +00:00
fix file timestamps
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/micro/micro/v3/service/errors"
|
||||
log "github.com/micro/micro/v3/service/logger"
|
||||
@@ -128,6 +129,13 @@ func (e *File) Save(ctx context.Context, req *file.SaveRequest, rsp *file.SaveRe
|
||||
req.File.Project = filepath.Join(tenantId, req.File.Project)
|
||||
req.File.Path = filepath.Join(req.File.Project, req.File.Path)
|
||||
|
||||
if len(req.File.Created) == 0 {
|
||||
req.File.Created = time.Now().Format(time.RFC3339Nano)
|
||||
}
|
||||
|
||||
// set updated time
|
||||
req.File.Updated = time.Now().Format(time.RFC3339Nano)
|
||||
|
||||
// create the file
|
||||
err := e.db.Create(req.File)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user