From b0db352f6926721423a88038680290c775ae947c Mon Sep 17 00:00:00 2001 From: quobix Date: Tue, 20 Feb 2024 19:27:20 -0500 Subject: [PATCH] updated model Signed-off-by: quobix --- model/commit.go | 4 ++-- model/report.go | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/model/commit.go b/model/commit.go index e2db4b0..9d34c77 100644 --- a/model/commit.go +++ b/model/commit.go @@ -10,8 +10,8 @@ import ( ) type Commit struct { - CreatedAt time.Time - UpdatedAt time.Time + CreatedAt time.Time `json:"-"` + UpdatedAt time.Time `json:"-"` ID uint `gorm:"primaryKey" json:"-"` Hash string `json:"commitHash"` Message string `json:"message"` diff --git a/model/report.go b/model/report.go index 72aa241..ca0e2b6 100644 --- a/model/report.go +++ b/model/report.go @@ -4,6 +4,7 @@ package model import ( + "github.com/pb33f/libopenapi/what-changed/model" "github.com/pb33f/libopenapi/what-changed/reports" "time" ) @@ -11,9 +12,22 @@ import ( type Report struct { ID uint `gorm:"primaryKey" json:"-"` Summary map[string]*reports.Changed `gorm:"-" json:"reportSummary"` - CreatedAt time.Time - UpdatedAt time.Time - Commit *Commit `gorm:"foreignKey:ID" json:"commitDetails"` + CreatedAt time.Time `json:"-"` + UpdatedAt time.Time `json:"-"` + Commit *Commit `gorm:"foreignKey:ID" json:"commitDetails"` +} + +type FlatReport struct { + Summary map[string]*reports.Changed `json:"reportSummary"` + Changes []*model.Change `json:"changes"` +} + +type FlatHistoricalReport struct { + GitRepoPath string `json:"gitRepoPath"` + GitFilePath string `json:"gitFilePath"` + Filename string `json:"filename"` + DateGenerated string `json:"dateGenerated"` + Reports []*FlatReport `json:"reports" ` } type HistoricalReport struct {