Categoriecontroller added

This commit is contained in:
2023-11-19 12:27:53 +01:00
parent 57b217793d
commit fa3132f61d
8 changed files with 79 additions and 5 deletions

View File

@@ -0,0 +1,33 @@
package fakers
import (
"github.com/google/uuid"
"gorm.io/gorm"
"moretcgshop/app/models"
"time"
)
func CategoryFaker(db *gorm.DB) []*models.Category {
sections, _ := models.GetSection(db)
var res []*models.Category
for _, section := range sections {
var categories []string = []string{"Einzelkarten", "Booster", "Booster Displays"}
var temp *models.Category
for _, cat := range categories {
temp = &models.Category{
ID: uuid.New().String(),
Name: cat,
Section: section,
CreatedAt: time.Time{},
UpdatedAt: time.Time{},
}
res = append(res, temp)
}
}
return res
}