fix(api,ci): remove type-only imports for DI and isolate CI ports from dev
- Remove `type` keyword from NestJS injectable class imports across all modules to fix runtime DI resolution (330+ handler/listener files) - Offset CI docker-compose ports (5433/6380/8109/9002) to avoid conflicts with running dev containers - Update .env.test, playwright.config.ts, and e2e workflow to use isolated CI ports with configurable overrides - Fix prisma/seed.ts to use deterministic IDs for Prisma 7 upsert compatibility (phoneHash replaced phone as unique index) - Add dedicated Docker bridge network for CI service containers Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -30,16 +30,17 @@ export default async function globalTeardown() {
|
||||
|
||||
try {
|
||||
// Delete test-generated records (those NOT created by seed).
|
||||
// Seed data uses known IDs (prop-1..prop-5, listing-1..listing-5)
|
||||
// Seed data uses known IDs (seed-user-*, prop-1..prop-5, listing-1..listing-5)
|
||||
// and known phones (0900000001..0900000005).
|
||||
// Test fixtures generate users with phone starting with '09' + timestamp digits.
|
||||
//
|
||||
// Order matters due to foreign key constraints.
|
||||
// Seed phones and IDs to preserve between runs
|
||||
// Seed user IDs and phones to preserve between runs
|
||||
const SEED_USER_IDS = `('seed-user-admin','seed-user-agent1','seed-user-agent2','seed-user-buyer','seed-user-seller')`;
|
||||
const SEED_PHONES = `('0900000001','0900000002','0900000003','0900000004','0900000005')`;
|
||||
const SEED_LISTING_IDS = `('listing-1','listing-2','listing-3','listing-4','listing-5')`;
|
||||
const SEED_PROP_IDS = `('prop-1','prop-2','prop-3','prop-4','prop-5')`;
|
||||
const NON_SEED_USERS = `SELECT id FROM "User" WHERE phone NOT IN ${SEED_PHONES}`;
|
||||
const NON_SEED_USERS = `SELECT id FROM "User" WHERE id NOT IN ${SEED_USER_IDS} AND phone NOT IN ${SEED_PHONES}`;
|
||||
|
||||
await pool.query(`
|
||||
-- Delete test-generated data in dependency order (FK-safe)
|
||||
@@ -49,7 +50,7 @@ export default async function globalTeardown() {
|
||||
DELETE FROM "Lead" WHERE "agentId" IN (
|
||||
SELECT a.id FROM "Agent" a
|
||||
JOIN "User" u ON a."userId" = u.id
|
||||
WHERE u.phone NOT IN ${SEED_PHONES}
|
||||
WHERE u.id NOT IN ${SEED_USER_IDS} AND u.phone NOT IN ${SEED_PHONES}
|
||||
);
|
||||
DELETE FROM "Inquiry" WHERE "listingId" NOT IN ${SEED_LISTING_IDS};
|
||||
DELETE FROM "Transaction" WHERE "buyerId" IN (${NON_SEED_USERS});
|
||||
@@ -68,7 +69,7 @@ export default async function globalTeardown() {
|
||||
DELETE FROM "RefreshToken" WHERE "userId" IN (${NON_SEED_USERS});
|
||||
DELETE FROM "OAuthAccount" WHERE "userId" IN (${NON_SEED_USERS});
|
||||
DELETE FROM "SavedSearch" WHERE "userId" IN (${NON_SEED_USERS});
|
||||
DELETE FROM "User" WHERE phone NOT IN ${SEED_PHONES};
|
||||
DELETE FROM "User" WHERE id NOT IN ${SEED_USER_IDS} AND phone NOT IN ${SEED_PHONES};
|
||||
`);
|
||||
|
||||
console.log('[E2E globalTeardown] Test data cleaned up successfully.\n');
|
||||
|
||||
Reference in New Issue
Block a user