add SysUpdatedOn
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-03-26 13:19:34 +11:00
parent bb999afbb7
commit 6581164fc4
6 changed files with 40 additions and 19 deletions

View File

@@ -127,6 +127,7 @@ func (h *Handler) GetIncident(w http.ResponseWriter, r *http.Request) {
AssignedTo: inc.AssignedTo.String,
Category: inc.Category.String,
Subcategory: inc.SubCategory.String,
SysUpdatedOn: inc.UpdatedAt.Time.String(),
CommentsAndWorkNotes: strings.Join(wkn, "\n\n"),
// TODO
}
@@ -195,7 +196,7 @@ func (h *Handler) GetIncident(w http.ResponseWriter, r *http.Request) {
func (h *Handler) getSingleIncident(number string, ctx context.Context) ([]byte, error) {
var b []byte
var wkn []string
incResult, err := h.Database.Queries().GetIncident(ctx, nullStr(number))
inc, err := h.Database.Queries().GetIncident(ctx, nullStr(number))
if err != nil {
if errors.Is(err, sql.ErrNoRows) {
h.Logger.Debug("No incident record found", "number", number)
@@ -224,16 +225,17 @@ func (h *Handler) getSingleIncident(number string, ctx context.Context) ([]byte,
// convert from database resposne to expected json format
r := models.SingleIncidentResponse{
Number: incResult.IncidentNumber.String,
SysID: incResult.SysID.String,
IncidentState: strconv.FormatInt(incResult.State.Int64, 10),
State: strconv.FormatInt(incResult.State.Int64, 10),
Impact: strconv.FormatInt(incResult.Impact.Int64, 10),
Urgency: strconv.FormatInt(incResult.Urgency.Int64, 10),
ShortDescription: incResult.ShortDescription.String,
AssignedTo: incResult.AssignedTo.String,
Category: incResult.Category.String,
Subcategory: incResult.SubCategory.String,
Number: inc.IncidentNumber.String,
SysID: inc.SysID.String,
IncidentState: strconv.FormatInt(inc.State.Int64, 10),
State: strconv.FormatInt(inc.State.Int64, 10),
Impact: strconv.FormatInt(inc.Impact.Int64, 10),
Urgency: strconv.FormatInt(inc.Urgency.Int64, 10),
ShortDescription: inc.ShortDescription.String,
AssignedTo: inc.AssignedTo.String,
Category: inc.Category.String,
Subcategory: inc.SubCategory.String,
SysUpdatedOn: inc.UpdatedAt.Time.String(),
CommentsAndWorkNotes: strings.Join(wkn, "\n\n"),
// TODO
}

View File

@@ -30,6 +30,7 @@ type SingleIncidentResponse struct {
Category string `json:"category"`
Subcategory string `json:"subcategory"`
CommentsAndWorkNotes string `json:"comments_and_work_notes"`
SysUpdatedOn string `json:"sys_updated_on"`
// TODO - unvalidated from here on
// Associated DeviceID (UUID from CPDB)