fix[BE] delete unused entity and repository

This commit is contained in:
aguhh18
2025-10-22 08:29:00 +07:00
parent 3ed2c9027a
commit e2818b11f0
6 changed files with 3 additions and 93 deletions
-18
View File
@@ -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"`
}
-26
View File
@@ -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"
rChickin "gitlab.com/mbugroup/lti-api.git/internal/modules/production/chickins/repositories"
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"
@@ -23,7 +22,7 @@ type ChickinModule struct{}
func (ChickinModule) RegisterRoutes(router fiber.Router, db *gorm.DB, validate *validator.Validate) {
chickinRepo := rChickin.NewChickinRepository(db)
kandangRepo := rKandang.NewKandangRepository(db)
auditlogrepo := rAuditLog.NewAuditLogRepository(db)
warehouseRepo := rWarehouse.NewWarehouseRepository(db)
projectflockkandangrepo := rProjectFlock.NewProjectFlockKandangRepository(db)
projectflockpopulationrepo := rProjectFlock.NewProjectFlockPopulationRepository(db)
@@ -32,7 +31,7 @@ func (ChickinModule) RegisterRoutes(router fiber.Router, db *gorm.DB, validate *
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)
ChickinRoutes(router, userService, chickinService)
@@ -12,7 +12,6 @@ import (
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"
AuditLogRepo "gitlab.com/mbugroup/lti-api.git/internal/modules/shared/repositories"
"gitlab.com/mbugroup/lti-api.git/internal/utils"
"github.com/go-playground/validator/v10"
@@ -38,12 +37,11 @@ type chickinService struct {
WarehouseRepo rWarehouse.WarehouseRepository
ProductWarehouseRepo rProductWarehouse.ProductWarehouseRepository
ProjectFlockRepo rProjectFlock.ProjectflockRepository
AuditLogRepo AuditLogRepo.AuditLogRepository
ProjectflockKandangRepo rProjectFlockKandang.ProjectFlockKandangRepository
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{
Log: utils.Log,
Validate: validate,
@@ -52,7 +50,6 @@ func NewChickinService(repo repository.ProjectChickinRepository, kandangRepo Kan
WarehouseRepo: warehouseRepo,
ProductWarehouseRepo: productWarehouseRepo,
ProjectFlockRepo: projectFlockRepo,
AuditLogRepo: auditLogRepo,
ProjectflockKandangRepo: projectflockkandangRepo,
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),
}
}