main: 增强会话功能,支持消息管理和接口文档

- 添加 `last_message_id` 字段至 `chat_sessions` 表,更新其关联索引
- 实现会话更新接口,支持修改名称与状态并添加验证逻辑
- 增加会话列表接口,支持状态过滤与关键字查询
- 提供会话和消息相关的资源类和请求验证类
- 扩展 `ChatService` 服务层逻辑以处理会话更新和消息附加
- 编写测试用例以验证新功能的正确性
- 增加接口文档及 OpenAPI 规范文件,覆盖新增功能
- 更新数据库播种器,添加默认用户
This commit is contained in:
2025-12-14 20:20:27 +08:00
parent c6d6534b63
commit 6356baacc0
14 changed files with 852 additions and 4 deletions

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('chat_sessions', function (Blueprint $table) {
$table->uuid('last_message_id')->nullable()->after('last_seq');
$table->index('updated_at');
$table->index('status');
$table->index('last_message_id');
});
}
public function down(): void
{
Schema::table('chat_sessions', function (Blueprint $table) {
$table->dropIndex(['updated_at']);
$table->dropIndex(['status']);
$table->dropIndex(['last_message_id']);
$table->dropColumn('last_message_id');
});
}
};

View File

@@ -25,5 +25,15 @@ class DatabaseSeeder extends Seeder
'email_verified_at' => now(),
],
);
User::updateOrCreate(
['email' => 'guxinpei@qq.com'],
[
'name' => 'roog',
'password' => Hash::make('w2021976'),
'is_active' => true,
'email_verified_at' => now(),
],
);
}
}