mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
FIX[BE]: name duplicate flock,projectflock category change,menerapkan dto seperti warehouse di projectflock
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
|||||||
|
BEGIN;
|
||||||
|
|
||||||
|
-- Recreate legacy columns on project_flock_kandangs
|
||||||
|
DROP INDEX IF EXISTS idx_project_flock_kandangs_unique;
|
||||||
|
|
||||||
|
ALTER TABLE project_flock_kandangs
|
||||||
|
ADD COLUMN IF NOT EXISTS created_by BIGINT REFERENCES users (id) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||||
|
ADD COLUMN IF NOT EXISTS assigned_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||||
|
ADD COLUMN IF NOT EXISTS detached_at TIMESTAMPTZ,
|
||||||
|
ADD COLUMN IF NOT EXISTS updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW();
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_project_flock_kandangs_active
|
||||||
|
ON project_flock_kandangs (project_flock_id, kandang_id)
|
||||||
|
WHERE detached_at IS NULL;
|
||||||
|
|
||||||
|
-- Restore product_category_id reference and drop category column
|
||||||
|
ALTER TABLE project_flocks
|
||||||
|
ADD COLUMN IF NOT EXISTS product_category_id BIGINT REFERENCES product_categories (id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
ALTER TABLE project_flocks
|
||||||
|
DROP COLUMN IF EXISTS category;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
DROP INDEX IF EXISTS project_flocks_flock_period_unique;
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
BEGIN;
|
||||||
|
|
||||||
|
-- Add category column to project_flocks and backfill existing rows
|
||||||
|
ALTER TABLE project_flocks
|
||||||
|
ADD COLUMN IF NOT EXISTS category VARCHAR(20);
|
||||||
|
|
||||||
|
UPDATE project_flocks
|
||||||
|
SET category = 'GROWING'
|
||||||
|
WHERE category IS NULL;
|
||||||
|
|
||||||
|
ALTER TABLE project_flocks
|
||||||
|
ALTER COLUMN category SET NOT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE project_flocks
|
||||||
|
ALTER COLUMN category SET DEFAULT 'GROWING';
|
||||||
|
|
||||||
|
-- Drop legacy foreign key reference and column
|
||||||
|
ALTER TABLE project_flocks
|
||||||
|
DROP CONSTRAINT IF EXISTS project_flocks_product_category_id_fkey;
|
||||||
|
|
||||||
|
ALTER TABLE project_flocks
|
||||||
|
DROP COLUMN IF EXISTS product_category_id;
|
||||||
|
|
||||||
|
-- Simplify project_flock_kandangs structure
|
||||||
|
DROP INDEX IF EXISTS idx_project_flock_kandangs_active;
|
||||||
|
|
||||||
|
ALTER TABLE project_flock_kandangs
|
||||||
|
DROP COLUMN IF EXISTS created_by,
|
||||||
|
DROP COLUMN IF EXISTS assigned_at,
|
||||||
|
DROP COLUMN IF EXISTS detached_at,
|
||||||
|
DROP COLUMN IF EXISTS updated_at;
|
||||||
|
|
||||||
|
ALTER TABLE project_flock_kandangs
|
||||||
|
ALTER COLUMN created_at SET DEFAULT NOW();
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_project_flock_kandangs_unique
|
||||||
|
ON project_flock_kandangs (project_flock_id, kandang_id);
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX project_flocks_flock_period_unique
|
||||||
|
ON project_flocks (flock_id, period)
|
||||||
|
WHERE deleted_at IS NULL;
|
||||||
@@ -1 +0,0 @@
|
|||||||
DROP INDEX IF EXISTS project_flocks_flock_period_unique;
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
CREATE UNIQUE INDEX project_flocks_flock_period_unique
|
|
||||||
ON project_flocks (flock_id, period)
|
|
||||||
WHERE deleted_at IS NULL;
|
|
||||||
@@ -374,7 +374,7 @@ func seedKandangs(tx *gorm.DB, createdBy uint, locations map[string]uint, users
|
|||||||
if err := tx.Create(&kandang).Error; err != nil {
|
if err := tx.Create(&kandang).Error; err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if err := syncPivotRelation(tx, projectFlockID, kandang.Id, createdBy); err != nil {
|
if err := syncPivotRelation(tx, projectFlockID, kandang.Id); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
@@ -393,7 +393,7 @@ func seedKandangs(tx *gorm.DB, createdBy uint, locations map[string]uint, users
|
|||||||
if err := tx.Model(&entity.Kandang{}).Where("id = ?", kandang.Id).Updates(updates).Error; err != nil {
|
if err := tx.Model(&entity.Kandang{}).Where("id = ?", kandang.Id).Updates(updates).Error; err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if err := syncPivotRelation(tx, projectFlockID, kandang.Id, createdBy); err != nil {
|
if err := syncPivotRelation(tx, projectFlockID, kandang.Id); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -403,25 +403,24 @@ func seedKandangs(tx *gorm.DB, createdBy uint, locations map[string]uint, users
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func syncPivotRelation(tx *gorm.DB, projectFlockID *uint, kandangID uint, createdBy uint) error {
|
func syncPivotRelation(tx *gorm.DB, projectFlockID *uint, kandangID uint) error {
|
||||||
if err := detachActivePivot(tx, kandangID); err != nil {
|
if err := detachActivePivot(tx, kandangID); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if projectFlockID == nil {
|
if projectFlockID == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return ensureActivePivot(tx, *projectFlockID, kandangID, createdBy)
|
return ensureActivePivot(tx, *projectFlockID, kandangID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func detachActivePivot(tx *gorm.DB, kandangID uint) error {
|
func detachActivePivot(tx *gorm.DB, kandangID uint) error {
|
||||||
return tx.Model(&entity.ProjectFlockKandang{}).
|
return tx.Where("kandang_id = ?", kandangID).
|
||||||
Where("kandang_id = ? AND detached_at IS NULL", kandangID).
|
Delete(&entity.ProjectFlockKandang{}).Error
|
||||||
Updates(map[string]any{"detached_at": time.Now()}).Error
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func ensureActivePivot(tx *gorm.DB, projectFlockID, kandangID, createdBy uint) error {
|
func ensureActivePivot(tx *gorm.DB, projectFlockID, kandangID uint) error {
|
||||||
var pivot entity.ProjectFlockKandang
|
var pivot entity.ProjectFlockKandang
|
||||||
err := tx.Where("project_flock_id = ? AND kandang_id = ? AND detached_at IS NULL", projectFlockID, kandangID).
|
err := tx.Where("project_flock_id = ? AND kandang_id = ?", projectFlockID, kandangID).
|
||||||
First(&pivot).Error
|
First(&pivot).Error
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -432,7 +431,6 @@ func ensureActivePivot(tx *gorm.DB, projectFlockID, kandangID, createdBy uint) e
|
|||||||
newRecord := entity.ProjectFlockKandang{
|
newRecord := entity.ProjectFlockKandang{
|
||||||
ProjectFlockId: projectFlockID,
|
ProjectFlockId: projectFlockID,
|
||||||
KandangId: kandangID,
|
KandangId: kandangID,
|
||||||
CreatedBy: createdBy,
|
|
||||||
}
|
}
|
||||||
return tx.Create(&newRecord).Error
|
return tx.Create(&newRecord).Error
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,14 +4,9 @@ import "time"
|
|||||||
|
|
||||||
type ProjectFlockKandang struct {
|
type ProjectFlockKandang struct {
|
||||||
Id uint `gorm:"primaryKey"`
|
Id uint `gorm:"primaryKey"`
|
||||||
ProjectFlockId uint `gorm:"not null;index:idx_project_flock_kandangs_project;uniqueIndex:idx_project_flock_kandangs_active,priority:1,where:detached_at IS NULL"`
|
ProjectFlockId uint `gorm:"not null;index:idx_project_flock_kandangs_project;uniqueIndex:idx_project_flock_kandangs_unique"`
|
||||||
KandangId uint `gorm:"not null;index:idx_project_flock_kandangs_kandang;uniqueIndex:idx_project_flock_kandangs_active,priority:2,where:detached_at IS NULL"`
|
KandangId uint `gorm:"not null;index:idx_project_flock_kandangs_kandang;uniqueIndex:idx_project_flock_kandangs_unique"`
|
||||||
CreatedBy uint `gorm:"not null"`
|
|
||||||
AssignedAt time.Time `gorm:"autoCreateTime"`
|
|
||||||
DetachedAt *time.Time `gorm:"index"`
|
|
||||||
CreatedAt time.Time `gorm:"autoCreateTime"`
|
CreatedAt time.Time `gorm:"autoCreateTime"`
|
||||||
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
|
||||||
ProjectFlock ProjectFlock `gorm:"foreignKey:ProjectFlockId;references:Id"`
|
ProjectFlock ProjectFlock `gorm:"foreignKey:ProjectFlockId;references:Id"`
|
||||||
Kandang Kandang `gorm:"foreignKey:KandangId;references:Id"`
|
Kandang Kandang `gorm:"foreignKey:KandangId;references:Id"`
|
||||||
CreatedUser User `gorm:"foreignKey:CreatedBy;references:Id"`
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-8
@@ -2,7 +2,6 @@ package repository
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"time"
|
|
||||||
|
|
||||||
entity "gitlab.com/mbugroup/lti-api.git/internal/entities"
|
entity "gitlab.com/mbugroup/lti-api.git/internal/entities"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
@@ -10,7 +9,7 @@ import (
|
|||||||
|
|
||||||
type ProjectFlockKandangRepository interface {
|
type ProjectFlockKandangRepository interface {
|
||||||
CreateMany(ctx context.Context, records []*entity.ProjectFlockKandang) error
|
CreateMany(ctx context.Context, records []*entity.ProjectFlockKandang) error
|
||||||
MarkDetached(ctx context.Context, projectFlockID uint, kandangIDs []uint, detachedAt time.Time) error
|
DeleteMany(ctx context.Context, projectFlockID uint, kandangIDs []uint) error
|
||||||
GetAll(ctx context.Context) ([]entity.ProjectFlockKandang, error)
|
GetAll(ctx context.Context) ([]entity.ProjectFlockKandang, error)
|
||||||
WithTx(tx *gorm.DB) ProjectFlockKandangRepository
|
WithTx(tx *gorm.DB) ProjectFlockKandangRepository
|
||||||
DB() *gorm.DB
|
DB() *gorm.DB
|
||||||
@@ -31,14 +30,13 @@ func (r *projectFlockKandangRepositoryImpl) CreateMany(ctx context.Context, reco
|
|||||||
return r.db.WithContext(ctx).Create(&records).Error
|
return r.db.WithContext(ctx).Create(&records).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *projectFlockKandangRepositoryImpl) MarkDetached(ctx context.Context, projectFlockID uint, kandangIDs []uint, detachedAt time.Time) error {
|
func (r *projectFlockKandangRepositoryImpl) DeleteMany(ctx context.Context, projectFlockID uint, kandangIDs []uint) error {
|
||||||
if len(kandangIDs) == 0 {
|
if len(kandangIDs) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return r.db.WithContext(ctx).
|
return r.db.WithContext(ctx).
|
||||||
Model(&entity.ProjectFlockKandang{}).
|
Where("project_flock_id = ? AND kandang_id IN ?", projectFlockID, kandangIDs).
|
||||||
Where("project_flock_id = ? AND kandang_id IN ? AND detached_at IS NULL", projectFlockID, kandangIDs).
|
Delete(&entity.ProjectFlockKandang{}).Error
|
||||||
Updates(map[string]any{"detached_at": detachedAt}).Error
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *projectFlockKandangRepositoryImpl) GetAll(ctx context.Context) ([]entity.ProjectFlockKandang, error) {
|
func (r *projectFlockKandangRepositoryImpl) GetAll(ctx context.Context) ([]entity.ProjectFlockKandang, error) {
|
||||||
@@ -47,8 +45,7 @@ func (r *projectFlockKandangRepositoryImpl) GetAll(ctx context.Context) ([]entit
|
|||||||
Preload("ProjectFlock").
|
Preload("ProjectFlock").
|
||||||
Preload("ProjectFlock.Flock").
|
Preload("ProjectFlock.Flock").
|
||||||
Preload("Kandang").
|
Preload("Kandang").
|
||||||
Preload("CreatedUser").
|
Order("project_flock_id ASC, created_at ASC").
|
||||||
Order("project_flock_id ASC, assigned_at ASC").
|
|
||||||
Find(&records).Error; err != nil {
|
Find(&records).Error; err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
commonRepo "gitlab.com/mbugroup/lti-api.git/internal/common/repository"
|
commonRepo "gitlab.com/mbugroup/lti-api.git/internal/common/repository"
|
||||||
common "gitlab.com/mbugroup/lti-api.git/internal/common/service"
|
common "gitlab.com/mbugroup/lti-api.git/internal/common/service"
|
||||||
@@ -242,7 +241,7 @@ func (s *projectflockService) CreateOne(c *fiber.Ctx, req *validation.Create) (*
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.attachKandangs(c.Context(), tx, createBody.Id, kandangIDs, createBody.CreatedBy); err != nil {
|
if err := s.attachKandangs(c.Context(), tx, createBody.Id, kandangIDs); err != nil {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
s.Log.Errorf("Failed to attach kandangs to projectflock %d: %+v", createBody.Id, err)
|
s.Log.Errorf("Failed to attach kandangs to projectflock %d: %+v", createBody.Id, err)
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -395,7 +394,7 @@ func (s projectflockService) UpdateOne(c *fiber.Ctx, req *validation.Update, id
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(toAttach) > 0 {
|
if len(toAttach) > 0 {
|
||||||
if err := s.attachKandangs(c.Context(), tx, id, toAttach, existing.CreatedBy); err != nil {
|
if err := s.attachKandangs(c.Context(), tx, id, toAttach); err != nil {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
s.Log.Errorf("Failed to attach kandangs to projectflock %d: %+v", id, err)
|
s.Log.Errorf("Failed to attach kandangs to projectflock %d: %+v", id, err)
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -533,7 +532,7 @@ func (s projectflockService) buildOrderExpressions(sortBy, sortOrder string) []s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s projectflockService) attachKandangs(ctx context.Context, tx *gorm.DB, projectFlockID uint, kandangIDs []uint, createdBy uint) error {
|
func (s projectflockService) attachKandangs(ctx context.Context, tx *gorm.DB, projectFlockID uint, kandangIDs []uint) error {
|
||||||
if len(kandangIDs) == 0 {
|
if len(kandangIDs) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -553,7 +552,6 @@ func (s projectflockService) attachKandangs(ctx context.Context, tx *gorm.DB, pr
|
|||||||
records[i] = &entity.ProjectFlockKandang{
|
records[i] = &entity.ProjectFlockKandang{
|
||||||
ProjectFlockId: projectFlockID,
|
ProjectFlockId: projectFlockID,
|
||||||
KandangId: id,
|
KandangId: id,
|
||||||
CreatedBy: createdBy,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := pivotRepo.CreateMany(ctx, records); err != nil {
|
if err := pivotRepo.CreateMany(ctx, records); err != nil {
|
||||||
@@ -578,7 +576,7 @@ func (s projectflockService) detachKandangs(ctx context.Context, tx *gorm.DB, pr
|
|||||||
return fiber.NewError(fiber.StatusInternalServerError, "Failed to update kandangs")
|
return fiber.NewError(fiber.StatusInternalServerError, "Failed to update kandangs")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.pivotRepoWithTx(tx).MarkDetached(ctx, projectFlockID, kandangIDs, time.Now()); err != nil {
|
if err := s.pivotRepoWithTx(tx).DeleteMany(ctx, projectFlockID, kandangIDs); err != nil {
|
||||||
return fiber.NewError(fiber.StatusInternalServerError, "Failed to persist project flock history")
|
return fiber.NewError(fiber.StatusInternalServerError, "Failed to persist project flock history")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -113,9 +113,6 @@ func TestProjectFlockSummary(t *testing.T) {
|
|||||||
if firstPivotRecord.KandangId != kandangID {
|
if firstPivotRecord.KandangId != kandangID {
|
||||||
t.Fatalf("expected pivot kandang id %d, got %d", kandangID, firstPivotRecord.KandangId)
|
t.Fatalf("expected pivot kandang id %d, got %d", kandangID, firstPivotRecord.KandangId)
|
||||||
}
|
}
|
||||||
if firstPivotRecord.DetachedAt != nil {
|
|
||||||
t.Fatalf("expected pivot DetachedAt to be nil for active assignment, got %v", firstPivotRecord.DetachedAt)
|
|
||||||
}
|
|
||||||
|
|
||||||
secondKandangID := createKandang(t, app, "Kandang Summary 2", locationID, 1)
|
secondKandangID := createKandang(t, app, "Kandang Summary 2", locationID, 1)
|
||||||
secondPayload := map[string]any{
|
secondPayload := map[string]any{
|
||||||
@@ -158,9 +155,6 @@ func TestProjectFlockSummary(t *testing.T) {
|
|||||||
if secondPivotRecord.KandangId != secondKandangID {
|
if secondPivotRecord.KandangId != secondKandangID {
|
||||||
t.Fatalf("expected second pivot kandang id %d, got %d", secondKandangID, secondPivotRecord.KandangId)
|
t.Fatalf("expected second pivot kandang id %d, got %d", secondKandangID, secondPivotRecord.KandangId)
|
||||||
}
|
}
|
||||||
if secondPivotRecord.DetachedAt != nil {
|
|
||||||
t.Fatalf("expected second pivot DetachedAt to be nil, got %v", secondPivotRecord.DetachedAt)
|
|
||||||
}
|
|
||||||
|
|
||||||
secondKandang := fetchKandang(t, db, secondKandangID)
|
secondKandang := fetchKandang(t, db, secondKandangID)
|
||||||
if secondKandang.Status != string(utils.KandangStatusPengajuan) {
|
if secondKandang.Status != string(utils.KandangStatusPengajuan) {
|
||||||
@@ -198,15 +192,14 @@ func TestProjectFlockSummary(t *testing.T) {
|
|||||||
t.Fatalf("expected kandang status to revert to NON_ACTIVE, got %s", firstKandang.Status)
|
t.Fatalf("expected kandang status to revert to NON_ACTIVE, got %s", firstKandang.Status)
|
||||||
}
|
}
|
||||||
|
|
||||||
var firstPivot entities.ProjectFlockKandang
|
var remainingFirst int64
|
||||||
if err := db.First(&firstPivot, firstPivotRecord.Id).Error; err != nil {
|
if err := db.Model(&entities.ProjectFlockKandang{}).
|
||||||
t.Fatalf("failed to reload first pivot record: %v", err)
|
Where("project_flock_id = ? AND kandang_id = ?", createResp.Data.Id, kandangID).
|
||||||
|
Count(&remainingFirst).Error; err != nil {
|
||||||
|
t.Fatalf("failed to count first pivot records after delete: %v", err)
|
||||||
}
|
}
|
||||||
if firstPivot.DetachedAt == nil {
|
if remainingFirst != 0 {
|
||||||
t.Fatalf("expected first pivot DetachedAt to be set after delete")
|
t.Fatalf("expected no pivot records remaining after delete, found %d", remainingFirst)
|
||||||
}
|
|
||||||
if firstPivot.ProjectFlockId != createResp.Data.Id {
|
|
||||||
t.Fatalf("expected first pivot project_flock_id %d, got %d", createResp.Data.Id, firstPivot.ProjectFlockId)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, body = doJSONRequest(t, app, http.MethodDelete, "/api/production/project_flocks/"+uintToString(createRespSecond.Data.Id), nil)
|
resp, body = doJSONRequest(t, app, http.MethodDelete, "/api/production/project_flocks/"+uintToString(createRespSecond.Data.Id), nil)
|
||||||
@@ -222,15 +215,14 @@ func TestProjectFlockSummary(t *testing.T) {
|
|||||||
t.Fatalf("expected second kandang status to revert to NON_ACTIVE, got %s", secondKandang.Status)
|
t.Fatalf("expected second kandang status to revert to NON_ACTIVE, got %s", secondKandang.Status)
|
||||||
}
|
}
|
||||||
|
|
||||||
var secondPivot entities.ProjectFlockKandang
|
var remainingSecond int64
|
||||||
if err := db.First(&secondPivot, secondPivotRecord.Id).Error; err != nil {
|
if err := db.Model(&entities.ProjectFlockKandang{}).
|
||||||
t.Fatalf("failed to reload second pivot record: %v", err)
|
Where("project_flock_id = ? AND kandang_id = ?", createRespSecond.Data.Id, secondKandangID).
|
||||||
|
Count(&remainingSecond).Error; err != nil {
|
||||||
|
t.Fatalf("failed to count second pivot records after delete: %v", err)
|
||||||
}
|
}
|
||||||
if secondPivot.DetachedAt == nil {
|
if remainingSecond != 0 {
|
||||||
t.Fatalf("expected second pivot DetachedAt to be set after delete")
|
t.Fatalf("expected no second pivot records remaining after delete, found %d", remainingSecond)
|
||||||
}
|
|
||||||
if secondPivot.ProjectFlockId != createRespSecond.Data.Id {
|
|
||||||
t.Fatalf("expected second pivot project_flock_id %d, got %d", createRespSecond.Data.Id, secondPivot.ProjectFlockId)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, body = doJSONRequest(t, app, http.MethodGet, "/api/production/project_flocks/flocks/"+uintToString(flockID)+"/periods", nil)
|
resp, body = doJSONRequest(t, app, http.MethodGet, "/api/production/project_flocks/flocks/"+uintToString(flockID)+"/periods", nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user