diff --git a/internal/entities/audit_log.go b/internal/entities/audit_log.go deleted file mode 100644 index 3b770125..00000000 --- a/internal/entities/audit_log.go +++ /dev/null @@ -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"` -} diff --git a/internal/entities/stock_availabilites.go b/internal/entities/stock_availabilites.go deleted file mode 100644 index ec24d36b..00000000 --- a/internal/entities/stock_availabilites.go +++ /dev/null @@ -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"` -} diff --git a/internal/modules/production/chickins/module.go b/internal/modules/production/chickins/module.go index 116e2fbb..3ebf93c7 100644 --- a/internal/modules/production/chickins/module.go +++ b/internal/modules/production/chickins/module.go @@ -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) diff --git a/internal/modules/production/chickins/services/chickin.service.go b/internal/modules/production/chickins/services/chickin.service.go index 43105374..751e633c 100644 --- a/internal/modules/production/chickins/services/chickin.service.go +++ b/internal/modules/production/chickins/services/chickin.service.go @@ -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, } diff --git a/internal/modules/shared/repositories/audit-logs.repository.go b/internal/modules/shared/repositories/audit-logs.repository.go deleted file mode 100644 index b247f3f2..00000000 --- a/internal/modules/shared/repositories/audit-logs.repository.go +++ /dev/null @@ -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), - } -} diff --git a/internal/modules/shared/repositories/stock-availabilites.repository.go b/internal/modules/shared/repositories/stock-availabilites.repository.go deleted file mode 100644 index 9d3ae632..00000000 --- a/internal/modules/shared/repositories/stock-availabilites.repository.go +++ /dev/null @@ -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), - } -}