fix: add updatedAt=NOW() to all INSERTs for NOT NULL columns
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 48s
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 48s
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> EOF )
This commit is contained in:
parent
533b525496
commit
6e7f4b0219
@ -174,11 +174,11 @@ export async function dbClose(): Promise<void> {
|
||||
export async function setupFixtures(dbUrl: string, userId: string, kbId: string, kiId: string, sessionId: string): Promise<void> {
|
||||
await dbExec(dbUrl, `INSERT IGNORE INTO User (id, email, nickname, role, status, updatedAt) VALUES (?, ?, ?, ?, ?, NOW())`,
|
||||
[userId, `test-${Date.now()}@zhixi.app`, 'Integration Test', 'USER', 'active']);
|
||||
await dbExec(dbUrl, `INSERT IGNORE INTO KnowledgeBase (id, userId, title) VALUES (?, ?, ?)`,
|
||||
await dbExec(dbUrl, `INSERT IGNORE INTO KnowledgeBase (id, userId, title, updatedAt) VALUES (?, ?, ?, NOW())`,
|
||||
[kbId, userId, 'Test KB']);
|
||||
await dbExec(dbUrl, `INSERT IGNORE INTO KnowledgeItem (id, userId, knowledgeBaseId, itemType, title, content, status) VALUES (?, ?, ?, ?, ?, ?, ?)`,
|
||||
await dbExec(dbUrl, `INSERT IGNORE INTO KnowledgeItem (id, userId, knowledgeBaseId, itemType, title, content, status, updatedAt) VALUES (?, ?, ?, ?, ?, ?, ?, NOW())`,
|
||||
[kiId, userId, kbId, 'concept', 'Test Item', 'Test content.', 'active']);
|
||||
await dbExec(dbUrl, `INSERT IGNORE INTO LearningSession (id, userId, knowledgeBaseId, knowledgeItemId, mode, status, startedAt) VALUES (?, ?, ?, ?, ?, ?, NOW())`,
|
||||
await dbExec(dbUrl, `INSERT IGNORE INTO LearningSession (id, userId, knowledgeBaseId, knowledgeItemId, mode, status, startedAt, updatedAt) VALUES (?, ?, ?, ?, ?, ?, NOW(), NOW())`,
|
||||
[sessionId, userId, kbId, kiId, 'active_recall', 'active']);
|
||||
}
|
||||
|
||||
|
||||
@ -99,8 +99,8 @@ describe('M-AI-01-09 真实集成测试', () => {
|
||||
it('通过 API 入队 AI 分析任务', async () => {
|
||||
// Create an AiAnalysisJob via the repository
|
||||
await dbExec(DB_URL,
|
||||
`INSERT INTO AiAnalysisJob (id, userId, jobType, sessionId, status, queuedAt)
|
||||
VALUES (?, ?, ?, ?, 'pending', NOW())`,
|
||||
`INSERT INTO AiAnalysisJob (id, userId, jobType, sessionId, status, queuedAt, updatedAt)
|
||||
VALUES (?, ?, ?, ?, 'pending', NOW(), NOW())`,
|
||||
[`ar-job-1`, TEST_USER, 'active-recall', TEST_SESSION]);
|
||||
|
||||
jobId = 'ar-job-1';
|
||||
@ -165,8 +165,8 @@ describe('M-AI-01-09 真实集成测试', () => {
|
||||
const beforeCnt = Number((before[0] as any).cnt);
|
||||
|
||||
await dbExec(DB_URL,
|
||||
`INSERT IGNORE INTO AiAnalysisJob (id, userId, jobType, sessionId, status, queuedAt)
|
||||
VALUES (?, ?, ?, ?, 'pending', NOW())`,
|
||||
`INSERT IGNORE INTO AiAnalysisJob (id, userId, jobType, sessionId, status, queuedAt, updatedAt)
|
||||
VALUES (?, ?, ?, ?, 'pending', NOW(), NOW())`,
|
||||
[`ar-dup-1`, TEST_USER, 'active-recall', TEST_SESSION]);
|
||||
|
||||
await new Promise(r => setTimeout(r, 8000));
|
||||
@ -182,8 +182,8 @@ describe('M-AI-01-09 真实集成测试', () => {
|
||||
describe('Document Import', () => {
|
||||
it('创建 KnowledgeItem', async () => {
|
||||
await dbExec(DB_URL,
|
||||
`INSERT INTO KnowledgeItem (id, userId, knowledgeBaseId, itemType, title, content, status)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)`,
|
||||
`INSERT INTO KnowledgeItem (id, userId, knowledgeBaseId, itemType, title, content, status, updatedAt)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, NOW())`,
|
||||
[`ki-import-1`, TEST_USER, TEST_KB, 'concept', 'Import Test', '# Test\n\nHello world', 'active']);
|
||||
|
||||
const rows = await dbQuery(DB_URL, 'SELECT id FROM KnowledgeItem WHERE id = ?', ['ki-import-1']);
|
||||
@ -226,8 +226,8 @@ describe('M-AI-01-09 真实集成测试', () => {
|
||||
'SELECT COUNT(*) as cnt FROM AiAnalysisResult WHERE userId = ?', [TEST_USER]);
|
||||
|
||||
await dbExec(DB_URL,
|
||||
`INSERT IGNORE INTO AiAnalysisJob (id, userId, jobType, sessionId, status, queuedAt)
|
||||
VALUES (?, ?, ?, ?, 'pending', NOW())`,
|
||||
`INSERT IGNORE INTO AiAnalysisJob (id, userId, jobType, sessionId, status, queuedAt, updatedAt)
|
||||
VALUES (?, ?, ?, ?, 'pending', NOW(), NOW())`,
|
||||
[`ar-500-test`, TEST_USER, 'feynman-evaluation', TEST_SESSION]);
|
||||
|
||||
await new Promise(r => setTimeout(r, 10_000));
|
||||
@ -243,8 +243,8 @@ describe('M-AI-01-09 真实集成测试', () => {
|
||||
mockAI.setInvalidJson();
|
||||
|
||||
await dbExec(DB_URL,
|
||||
`INSERT IGNORE INTO AiAnalysisJob (id, userId, jobType, sessionId, status, queuedAt)
|
||||
VALUES (?, ?, ?, ?, 'pending', NOW())`,
|
||||
`INSERT IGNORE INTO AiAnalysisJob (id, userId, jobType, sessionId, status, queuedAt, updatedAt)
|
||||
VALUES (?, ?, ?, ?, 'pending', NOW(), NOW())`,
|
||||
[`ar-badjson-test`, TEST_USER, 'active-recall', TEST_SESSION]);
|
||||
|
||||
await new Promise(r => setTimeout(r, 10_000));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user