added published at and telegram notify for missing url
parent
f6f9d9dc09
commit
5dd7070807
|
@ -13,6 +13,7 @@ type NewProduct struct {
|
|||
Url string
|
||||
Variant string
|
||||
Characteristics string
|
||||
PublishedAt string
|
||||
}
|
||||
|
||||
type InWorkProduct struct {
|
||||
|
|
|
@ -5,8 +5,10 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"jannex/admin-dashboard-backend/modules/cache"
|
||||
"jannex/admin-dashboard-backend/modules/config"
|
||||
"jannex/admin-dashboard-backend/modules/database"
|
||||
"jannex/admin-dashboard-backend/modules/logger"
|
||||
"jannex/admin-dashboard-backend/modules/notification"
|
||||
"jannex/admin-dashboard-backend/modules/structs"
|
||||
"strconv"
|
||||
|
||||
|
@ -171,9 +173,22 @@ func fetchProducts(srv *sheets.Service) error {
|
|||
})
|
||||
} else if state == 3 {
|
||||
var url string
|
||||
var publishedAt string
|
||||
|
||||
if len(row) > 8 && row[8] != "" {
|
||||
url = fmt.Sprintf("%v", row[8])
|
||||
} else {
|
||||
logger.AddSystemLog(rslogger.LogTypeWarning, "Url missing for product id: %s name: %s", productId, name)
|
||||
|
||||
notification.AddNotification(nil, structs.AddNotificationRequest{
|
||||
UserIds: config.Cfg.NotificationUserIds,
|
||||
Type: 3,
|
||||
Title: "Missing 'Shop Produkt Link' for product pipeline\n\nproduct id: " + productId + "\nname: " + name + "\n\nDie URL für das Produkt in dem Google Sheet 'Produkte' -> Worksheet: 'Pipeline' eintragen!",
|
||||
})
|
||||
}
|
||||
|
||||
if len(row) > 9 && row[9] != "" {
|
||||
publishedAt = fmt.Sprintf("%v", row[9])
|
||||
}
|
||||
|
||||
newProducts = append(newProducts, structs.NewProduct{
|
||||
|
@ -182,6 +197,7 @@ func fetchProducts(srv *sheets.Service) error {
|
|||
Url: url,
|
||||
Variant: productVariant,
|
||||
Characteristics: productCharacteristics,
|
||||
PublishedAt: publishedAt,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue