mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-25 07:45:44 +00:00
fix[BE] delete unused entity and repository
This commit is contained in:
@@ -1,18 +0,0 @@
|
|||||||
package entities
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type AuditLog struct {
|
|
||||||
Id uint `gorm:"primaryKey"`
|
|
||||||
TableName string `gorm:"size:100;not null"`
|
|
||||||
RecordId uint `gorm:"not null"`
|
|
||||||
Action string `gorm:"size:30;not null"`
|
|
||||||
BeforeData string `gorm:"type:jsonb"`
|
|
||||||
AfterData string `gorm:"type:jsonb"`
|
|
||||||
ChangedBy uint `gorm:"not null"`
|
|
||||||
CreatedAt time.Time `gorm:"autoCreateTime"`
|
|
||||||
|
|
||||||
User *User `gorm:"foreignKey:ChangedBy;references:Id"`
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package entities
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
EntityTypeProjectFlockKandang = "PROJECT_FLOCK_KANDANG"
|
|
||||||
)
|
|
||||||
|
|
||||||
type StockAvailability struct {
|
|
||||||
Id uint `gorm:"primaryKey"`
|
|
||||||
EntityType string `gorm:"size:50;not null"`
|
|
||||||
EntityId uint `gorm:"not null"`
|
|
||||||
ProductId uint `gorm:"not null"`
|
|
||||||
Quantity float64 `gorm:"not null;default:0"`
|
|
||||||
ReservedQuantity float64 `gorm:"not null;default:0"`
|
|
||||||
Unit string `gorm:"size:20"`
|
|
||||||
LastUpdated time.Time `gorm:"autoUpdateTime"`
|
|
||||||
CreatedAt time.Time `gorm:"autoCreateTime"`
|
|
||||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
|
||||||
|
|
||||||
Product *Product `gorm:"foreignKey:ProductId;references:Id"`
|
|
||||||
}
|
|
||||||
@@ -10,7 +10,6 @@ import (
|
|||||||
rWarehouse "gitlab.com/mbugroup/lti-api.git/internal/modules/master/warehouses/repositories"
|
rWarehouse "gitlab.com/mbugroup/lti-api.git/internal/modules/master/warehouses/repositories"
|
||||||
rChickin "gitlab.com/mbugroup/lti-api.git/internal/modules/production/chickins/repositories"
|
rChickin "gitlab.com/mbugroup/lti-api.git/internal/modules/production/chickins/repositories"
|
||||||
sChickin "gitlab.com/mbugroup/lti-api.git/internal/modules/production/chickins/services"
|
sChickin "gitlab.com/mbugroup/lti-api.git/internal/modules/production/chickins/services"
|
||||||
rAuditLog "gitlab.com/mbugroup/lti-api.git/internal/modules/shared/repositories"
|
|
||||||
|
|
||||||
rProjectFlock "gitlab.com/mbugroup/lti-api.git/internal/modules/production/project_flocks/repositories"
|
rProjectFlock "gitlab.com/mbugroup/lti-api.git/internal/modules/production/project_flocks/repositories"
|
||||||
|
|
||||||
@@ -23,7 +22,7 @@ type ChickinModule struct{}
|
|||||||
func (ChickinModule) RegisterRoutes(router fiber.Router, db *gorm.DB, validate *validator.Validate) {
|
func (ChickinModule) RegisterRoutes(router fiber.Router, db *gorm.DB, validate *validator.Validate) {
|
||||||
chickinRepo := rChickin.NewChickinRepository(db)
|
chickinRepo := rChickin.NewChickinRepository(db)
|
||||||
kandangRepo := rKandang.NewKandangRepository(db)
|
kandangRepo := rKandang.NewKandangRepository(db)
|
||||||
auditlogrepo := rAuditLog.NewAuditLogRepository(db)
|
|
||||||
warehouseRepo := rWarehouse.NewWarehouseRepository(db)
|
warehouseRepo := rWarehouse.NewWarehouseRepository(db)
|
||||||
projectflockkandangrepo := rProjectFlock.NewProjectFlockKandangRepository(db)
|
projectflockkandangrepo := rProjectFlock.NewProjectFlockKandangRepository(db)
|
||||||
projectflockpopulationrepo := rProjectFlock.NewProjectFlockPopulationRepository(db)
|
projectflockpopulationrepo := rProjectFlock.NewProjectFlockPopulationRepository(db)
|
||||||
@@ -32,7 +31,7 @@ func (ChickinModule) RegisterRoutes(router fiber.Router, db *gorm.DB, validate *
|
|||||||
|
|
||||||
userRepo := rUser.NewUserRepository(db)
|
userRepo := rUser.NewUserRepository(db)
|
||||||
|
|
||||||
chickinService := sChickin.NewChickinService(chickinRepo, kandangRepo, warehouseRepo, productWarehouseRepo, projectFlockRepo, auditlogrepo, projectflockkandangrepo, projectflockpopulationrepo, validate)
|
chickinService := sChickin.NewChickinService(chickinRepo, kandangRepo, warehouseRepo, productWarehouseRepo, projectFlockRepo, projectflockkandangrepo, projectflockpopulationrepo, validate)
|
||||||
userService := sUser.NewUserService(userRepo, validate)
|
userService := sUser.NewUserService(userRepo, validate)
|
||||||
|
|
||||||
ChickinRoutes(router, userService, chickinService)
|
ChickinRoutes(router, userService, chickinService)
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import (
|
|||||||
|
|
||||||
validation "gitlab.com/mbugroup/lti-api.git/internal/modules/production/chickins/validations"
|
validation "gitlab.com/mbugroup/lti-api.git/internal/modules/production/chickins/validations"
|
||||||
rProjectFlock "gitlab.com/mbugroup/lti-api.git/internal/modules/production/project_flocks/repositories"
|
rProjectFlock "gitlab.com/mbugroup/lti-api.git/internal/modules/production/project_flocks/repositories"
|
||||||
AuditLogRepo "gitlab.com/mbugroup/lti-api.git/internal/modules/shared/repositories"
|
|
||||||
"gitlab.com/mbugroup/lti-api.git/internal/utils"
|
"gitlab.com/mbugroup/lti-api.git/internal/utils"
|
||||||
|
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
@@ -38,12 +37,11 @@ type chickinService struct {
|
|||||||
WarehouseRepo rWarehouse.WarehouseRepository
|
WarehouseRepo rWarehouse.WarehouseRepository
|
||||||
ProductWarehouseRepo rProductWarehouse.ProductWarehouseRepository
|
ProductWarehouseRepo rProductWarehouse.ProductWarehouseRepository
|
||||||
ProjectFlockRepo rProjectFlock.ProjectflockRepository
|
ProjectFlockRepo rProjectFlock.ProjectflockRepository
|
||||||
AuditLogRepo AuditLogRepo.AuditLogRepository
|
|
||||||
ProjectflockKandangRepo rProjectFlockKandang.ProjectFlockKandangRepository
|
ProjectflockKandangRepo rProjectFlockKandang.ProjectFlockKandangRepository
|
||||||
ProjectflockPopulationRepo rProjectFlock.ProjectFlockPopulationRepository
|
ProjectflockPopulationRepo rProjectFlock.ProjectFlockPopulationRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewChickinService(repo repository.ProjectChickinRepository, kandangRepo KandangRepo.KandangRepository, warehouseRepo rWarehouse.WarehouseRepository, productWarehouseRepo rProductWarehouse.ProductWarehouseRepository, projectFlockRepo rProjectFlock.ProjectflockRepository, auditLogRepo AuditLogRepo.AuditLogRepository, projectflockkandangRepo rProjectFlockKandang.ProjectFlockKandangRepository, projectflockpopulationRepo rProjectFlock.ProjectFlockPopulationRepository, validate *validator.Validate) ChickinService {
|
func NewChickinService(repo repository.ProjectChickinRepository, kandangRepo KandangRepo.KandangRepository, warehouseRepo rWarehouse.WarehouseRepository, productWarehouseRepo rProductWarehouse.ProductWarehouseRepository, projectFlockRepo rProjectFlock.ProjectflockRepository, projectflockkandangRepo rProjectFlockKandang.ProjectFlockKandangRepository, projectflockpopulationRepo rProjectFlock.ProjectFlockPopulationRepository, validate *validator.Validate) ChickinService {
|
||||||
return &chickinService{
|
return &chickinService{
|
||||||
Log: utils.Log,
|
Log: utils.Log,
|
||||||
Validate: validate,
|
Validate: validate,
|
||||||
@@ -52,7 +50,6 @@ func NewChickinService(repo repository.ProjectChickinRepository, kandangRepo Kan
|
|||||||
WarehouseRepo: warehouseRepo,
|
WarehouseRepo: warehouseRepo,
|
||||||
ProductWarehouseRepo: productWarehouseRepo,
|
ProductWarehouseRepo: productWarehouseRepo,
|
||||||
ProjectFlockRepo: projectFlockRepo,
|
ProjectFlockRepo: projectFlockRepo,
|
||||||
AuditLogRepo: auditLogRepo,
|
|
||||||
ProjectflockKandangRepo: projectflockkandangRepo,
|
ProjectflockKandangRepo: projectflockkandangRepo,
|
||||||
ProjectflockPopulationRepo: projectflockpopulationRepo,
|
ProjectflockPopulationRepo: projectflockpopulationRepo,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
package repository
|
|
||||||
|
|
||||||
import (
|
|
||||||
"gitlab.com/mbugroup/lti-api.git/internal/common/repository"
|
|
||||||
entity "gitlab.com/mbugroup/lti-api.git/internal/entities"
|
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
|
||||||
|
|
||||||
type AuditLogRepository interface {
|
|
||||||
repository.BaseRepository[entity.AuditLog]
|
|
||||||
}
|
|
||||||
|
|
||||||
type AuditLogRepositoryImpl struct {
|
|
||||||
*repository.BaseRepositoryImpl[entity.AuditLog]
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewAuditLogRepository(db *gorm.DB) AuditLogRepository {
|
|
||||||
return &AuditLogRepositoryImpl{
|
|
||||||
BaseRepositoryImpl: repository.NewBaseRepository[entity.AuditLog](db),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package repository
|
|
||||||
|
|
||||||
import (
|
|
||||||
"gitlab.com/mbugroup/lti-api.git/internal/common/repository"
|
|
||||||
entity "gitlab.com/mbugroup/lti-api.git/internal/entities"
|
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
|
||||||
|
|
||||||
type StockAvailabilityRepository interface {
|
|
||||||
repository.BaseRepository[entity.StockAvailability]
|
|
||||||
}
|
|
||||||
|
|
||||||
type StockAvailabilityRepositoryImpl struct {
|
|
||||||
*repository.BaseRepositoryImpl[entity.StockAvailability]
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewStockAvailabilityRepository(db *gorm.DB) StockAvailabilityRepository {
|
|
||||||
return &StockAvailabilityRepositoryImpl{
|
|
||||||
BaseRepositoryImpl: repository.NewBaseRepository[entity.StockAvailability](db),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user