mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
47 lines
1.0 KiB
Go
47 lines
1.0 KiB
Go
package repository
|
|
|
|
import (
|
|
"gitlab.com/mbugroup/lti-api.git/internal/common/repository"
|
|
entity "gitlab.com/mbugroup/lti-api.git/internal/entities"
|
|
utils "gitlab.com/mbugroup/lti-api.git/internal/utils"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type ConstantRepository interface {
|
|
GetConstants() map[string]interface{}
|
|
}
|
|
|
|
type ConstantRepositoryImpl struct {
|
|
*repository.BaseRepositoryImpl[entity.Constant]
|
|
}
|
|
|
|
func NewConstantRepository(db *gorm.DB) ConstantRepository {
|
|
return &ConstantRepositoryImpl{
|
|
BaseRepositoryImpl: repository.NewBaseRepository[entity.Constant](db),
|
|
}
|
|
}
|
|
|
|
func (r *ConstantRepositoryImpl) GetConstants() map[string]interface{} {
|
|
flagList := make([]string, 0)
|
|
for f := range utils.AllFlagTypes() {
|
|
flagList = append(flagList, string(f))
|
|
}
|
|
|
|
return map[string]interface{}{
|
|
"flags": flagList,
|
|
"warehouse_types": []string{
|
|
"AREA",
|
|
"LOKASI",
|
|
"KANDANG",
|
|
},
|
|
"supplier_categories": []string{
|
|
"BOP",
|
|
"SAPRONAK",
|
|
},
|
|
"customer_supplier_types": []string{
|
|
"BISNIS",
|
|
"INDIVIDUAL",
|
|
},
|
|
}
|
|
}
|