This is an automated email from the ASF dual-hosted git repository.

zhangliang2022 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 9971cf9df fix: set created_at and updated_at (#4582)
9971cf9df is described below

commit 9971cf9dfcbfad5f0a7fc8529d73db6d5965d26d
Author: mindlesscloud <[email protected]>
AuthorDate: Fri Mar 3 23:18:06 2023 +0800

    fix: set created_at and updated_at (#4582)
---
 backend/plugins/customize/service/service.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/backend/plugins/customize/service/service.go 
b/backend/plugins/customize/service/service.go
index 50dc5a83a..ec2fe892a 100644
--- a/backend/plugins/customize/service/service.go
+++ b/backend/plugins/customize/service/service.go
@@ -22,6 +22,7 @@ import (
        "io"
        "regexp"
        "strings"
+       "time"
 
        "github.com/apache/incubator-devlake/core/dal"
        "github.com/apache/incubator-devlake/core/errors"
@@ -183,6 +184,7 @@ func (s *Service) importCSV(file io.ReadCloser, 
rawDataParams string, recordHand
                return err
        }
        var hasNext bool
+       now := time.Now()
        for {
                if hasNext, err = iterator.HasNextWithError(); !hasNext {
                        return err
@@ -194,6 +196,8 @@ func (s *Service) importCSV(file io.ReadCloser, 
rawDataParams string, recordHand
                                        record[k] = nil
                                }
                        }
+                       record["created_at"] = now
+                       record["updated_at"] = now
                        err = recordHandler(record)
                        if err != nil {
                                return err

Reply via email to