mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
Feat(BE-36,37,38,39): finish master data management api
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
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",
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user