Added uuid middleware
This commit is contained in:
14
main.go
14
main.go
@@ -13,6 +13,7 @@ import (
|
||||
"gitlab.com/pactual1/backend/shared"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/google/uuid"
|
||||
"github.com/jinzhu/gorm"
|
||||
"github.com/qor/admin"
|
||||
)
|
||||
@@ -80,6 +81,19 @@ func main() {
|
||||
http.ListenAndServe(":"+port, mux)
|
||||
}()
|
||||
|
||||
// Temp fix to add UUID to existing contracts
|
||||
var contracts []models.Contract
|
||||
result := shared.GetDb().Where("uuid IS NULL").Find(&contracts)
|
||||
if result.Error != nil {
|
||||
log.Printf("Error fetching contracts: %v", result.Error)
|
||||
return
|
||||
}
|
||||
|
||||
for _, contract := range contracts {
|
||||
contract.UUID = uuid.New().String()
|
||||
shared.GetDb().Save(&contract)
|
||||
}
|
||||
|
||||
// Initialize channels
|
||||
// messagingChannel := make(chan string)
|
||||
erpChannel := make(chan string)
|
||||
|
||||
Reference in New Issue
Block a user