File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,12 +3,11 @@ package controllers
33import (
44 "encoding/json"
55 "net/http"
6- "time"
76
87 "github.com/CodeChefVIT/devsoc-backend-26/pkg/db"
8+ "github.com/CodeChefVIT/devsoc-backend-26/pkg/dto"
99 "github.com/CodeChefVIT/devsoc-backend-26/pkg/elastic"
1010 "github.com/CodeChefVIT/devsoc-backend-26/pkg/models"
11- "github.com/CodeChefVIT/devsoc-backend-26/pkg/dto"
1211 "github.com/labstack/echo/v4"
1312)
1413
@@ -35,17 +34,12 @@ func GetLogs(c echo.Context) error {
3534 createdBy = & s
3635 }
3736
38- createdAt := ""
39- if l .CreatedAt .Valid {
40- createdAt = l .CreatedAt .Time .Format (time .RFC3339 )
41- }
42-
4337 resp = append (resp , dto.Log {
4438 ID : l .ID .String (),
4539 Type : l .Type ,
4640 Body : body ,
4741 CreatedBy : createdBy ,
48- CreatedAt : createdAt ,
42+ CreatedAt : l . CreatedAt . Time ,
4943 })
5044 }
5145
Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ import "time"
55type Log struct {
66 ID string `json:"id"`
77 Type string `json:"type"`
8+ Method string `json:"method"`
9+ URL string `json:"url"`
10+ IPAddress string `json:"ip_address"`
11+ UserAgent string `json:"user_agent"`
812 Body interface {} `json:"body"`
913 CreatedBy * string `json:"created_by"`
1014 CreatedAt time.Time `json:"created_at"`
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ func RequestLogger(next echo.HandlerFunc) echo.HandlerFunc {
6262 }
6363
6464 if log .CreatedBy .Valid {
65- idstr := log .CreatedBy .String ()
65+ idstr := log .CreatedBy .String
6666 esLog .CreatedBy = & idstr
6767 }
6868
You can’t perform that action at this time.
0 commit comments