feature/user-model-phase1
develop
- 添加 store 包导入 - 当 storage.driver 为 postgres 时创建 pgxpool - 使用 defer 确保连接池正确关闭 - 添加日志记录连接状态
- 新增 migrations/001_users.up.sql:创建 users 表和 refresh_tokens 表 - 新增 migrations/001_users.down.sql:回滚脚本 - users 表包含 id, username, password_hash, created_at, updated_at - refresh_tokens 表包含 id, user_id, token_hash, expires_at, created_at - 添加必要的索引优化查询性能
- 新增 internal/store/db.go - 实现 NewPostgresPool(ctx, dsn) 创建连接池 - 添加 pgx/v5 依赖 - 最大连接数设置为 10
- 新增 AuthConfig 结构体(JWTSecret, AccessTTL, RefreshTTL) - 在 Config 中添加 Auth 字段 - 设置默认值:access_ttl=15分钟,refresh_ttl=10080分钟(7天) - JWTSecret 必须通过环境变量 CAMTALK_AUTH_JWT_SECRET 设置