阶段九:清理前端泛化兼容响应类型
This commit is contained in:
1 parent
2110d6c431
commit
e5d4998e61
4 files changed
+1130
-1159
No files matched your search
+1115
-1139
File diff suppressed because it is too large.
Load diff
@@ -621,3 +621,4 @@ npm --prefix frontend run build
|
||||
| 2026-08-15 | 完成阶段 8 第九个 PR 切片“登录审计与资料刷新共享 repository 边界” | 登录方式/状态、登录审计日志、账号资料更新、资料刷新凭证锁与平台视图读取统一通过 `accountLoginRepository`;运行时 Cookie 更新复用同一账号状态边界,移除无调用方的旧扁平 Cookie helper,保持 MTOP Cookie Jar 合并、资料刷新失败恢复和运行时唤醒语义不变;Server 全量测试、Server race、Go vet、lint、注释和全量门禁通过并合并为一个可回滚提交 | 阶段 8:数据库直连与事务边界最终审计 |
|
||||
| 2026-08-15 | 完成阶段 8 第十个 PR 切片“统一事务执行 repository 边界” | Server 统一事务入口不再直接持有 `Store.DB`,改由 `transactionRepository` 负责创建、提交和回滚事务;事务初始化失败、业务错误和提交失败均保持回滚语义,Server 依赖装配与事务回归测试已覆盖;Server 全量测试、Server race、Go vet、lint、注释和全量门禁通过并合并为一个可回滚提交 | 阶段 9:架构依赖门禁与数据库直连最终审计 |
|
||||
| 2026-08-15 | 完成阶段 9 第一个 PR 切片“Go/React 架构依赖门禁与数据库直连审计” | 新增 `tools/architecturecheck`,阻止 `internal/db`、`internal/xianyu`、`internal/browser` 反向依赖上层应用包,并阻止 Server 业务层直接创建事务;门禁接入 Makefile、CI 和 `make check`,同步更新阶段状态;架构检查、Go 全量测试、vet、lint、注释和前端注释门禁通过并合并为一个可回滚提交 | 阶段 9:兼容路由/字段调用方最终清理 |
|
||||
| 2026-08-15 | 完成阶段 9 第二个 PR 切片“前端泛化兼容响应类型清理” | 移除未被调用方使用的 `ApiResponse` 和含义不清的 `LoginResponse`,认证初始化/登录统一使用 `SessionResponse`,登出、密码修改、账号、聊天、订单等操作统一使用 `OperationResponse`;未改变 HTTP 路径和业务状态字段;前端类型检查、184 个测试、注释检查和构建门禁通过并合并为一个可回滚提交 | 阶段 9:账号 `cookie`/`note` 兼容字段调用方清理 |
|
||||
+12
-12
@@ -1,7 +1,7 @@
|
||||
import { get, post, put, del, postForm, type RequestControlOptions } from '../request';
|
||||
import {
|
||||
LoginResponse, AccountDetail, AccountSummaryResponse, Order, PaginatedResponse,
|
||||
AdminStats, DashboardStats, Card, SystemSettings, ApiResponse, OrderAnalytics,
|
||||
SessionResponse, AccountDetail, AccountSummaryResponse, Order, PaginatedResponse,
|
||||
AdminStats, DashboardStats, Card, SystemSettings, OrderAnalytics,
|
||||
Item, AIReplySettings, ShippingRule, ReplyRule, DefaultReply, AutomationAction, AutomationTriggerType,
|
||||
NotificationChannel, NotificationEventType, AccountTaskSettings, ChatSession, ChatMessage, ItemListEnvelope, AutomationIssuesEnvelope,
|
||||
CookieSettingsResponse, CookieProfileResponse, ItemDetailResponse, ItemPublishResponse, ItemSyncResponse, OrderDTOResponse, OrderDetailResponse, OrderSingleRefreshResponse, OrderBatchResponse, OrderRefreshResponse, AutomationRuleResponse, AutomationRulePageResponse, AIReplySettingsResponse, AIModelsResponse, UserSettingResponse, CardBatchResponse, CardAppendResponse, CategoryRecommendationResponse, ItemPublishBatchPreviewResponse, ItemPublishBatchListResponse, BatchIDResponse, ItemPublishBatchResponse, BatchCancelResponse, MutationIDResponse, OperationResponse, NotificationChannelResponse, NotificationBinding, AccountBindingsResponse, CardListResponse, KeywordTypedResponse, DefaultReplyResponse, AccountTaskSettingsResponse, AccountTaskRunResponseEnvelope, AdminStatsResponse, DashboardStatsResponse, OrderAnalyticsResponse, QRLoginGenerateResponse, QRLoginStatusResponse, QRLoginVerificationResponse, ValidOrderResponse, ValidOrdersResponse
|
||||
@@ -18,11 +18,11 @@ const normalizeSettings = (settings: Record<string, any>): SystemSettings => {
|
||||
};
|
||||
|
||||
// Auth
|
||||
export const login = async (data: { username?: string; password?: string; email?: string; verification_code?: string }): Promise<LoginResponse> => {
|
||||
export const login = async (data: { username?: string; password?: string; email?: string; verification_code?: string }): Promise<SessionResponse> => {
|
||||
return post('/api/v1/session/login', data, { skipAuthLogout: true });
|
||||
};
|
||||
|
||||
export const initializeAdmin = async (password: string): Promise<LoginResponse> => {
|
||||
export const initializeAdmin = async (password: string): Promise<SessionResponse> => {
|
||||
return post('/api/v1/session/initialize', { password }, { skipAuthLogout: true });
|
||||
};
|
||||
|
||||
@@ -35,11 +35,11 @@ export const getHealth = async (options?: RequestControlOptions): Promise<{ vers
|
||||
return get('/health', undefined, options);
|
||||
};
|
||||
|
||||
export const logout = async (): Promise<ApiResponse> => {
|
||||
export const logout = async (): Promise<OperationResponse> => {
|
||||
return post('/api/v1/session/logout', {});
|
||||
};
|
||||
|
||||
export const changePassword = async (currentPassword: string, newPassword: string): Promise<ApiResponse> => {
|
||||
export const changePassword = async (currentPassword: string, newPassword: string): Promise<OperationResponse> => {
|
||||
return post('/api/v1/session/password', { current_password: currentPassword, new_password: newPassword });
|
||||
};
|
||||
|
||||
@@ -47,12 +47,12 @@ export const updateLoginCredentials = async (data: {
|
||||
current_password: string;
|
||||
new_username: string;
|
||||
new_password?: string;
|
||||
}, options?: RequestControlOptions): Promise<ApiResponse & { requires_relogin?: boolean }> => {
|
||||
}, options?: RequestControlOptions): Promise<OperationResponse> => {
|
||||
return put('/api/v1/session/credentials', data, options);
|
||||
};
|
||||
|
||||
// Accounts
|
||||
export const addAccount = async (id: string, value: string, loginMethod?: string): Promise<ApiResponse> => {
|
||||
export const addAccount = async (id: string, value: string, loginMethod?: string): Promise<OperationResponse> => {
|
||||
return post('/api/v1/accounts', { id, value, login_method: loginMethod });
|
||||
};
|
||||
|
||||
@@ -153,7 +153,7 @@ export const sendChatImage = async (input: {
|
||||
return postForm('/api/v1/chat/images', form, { timeoutMs: 120_000, ...options });
|
||||
};
|
||||
|
||||
export const markChatRead = async (accountId: string, chatId: string, options?: RequestControlOptions): Promise<ApiResponse> =>
|
||||
export const markChatRead = async (accountId: string, chatId: string, options?: RequestControlOptions): Promise<OperationResponse> =>
|
||||
post('/api/v1/chat/read', { account_id: accountId, chat_id: chatId }, options);
|
||||
|
||||
export interface AccountRuntimeStatus {
|
||||
@@ -277,7 +277,7 @@ export const checkPasswordLoginStatus = async (sessionId: string, signal?: Abort
|
||||
return get(`/api/v1/password-login/check/${sessionId}`, undefined, { signal, timeoutMs: 10_000 });
|
||||
};
|
||||
|
||||
export const cancelPasswordLogin = async (sessionId: string, options?: RequestControlOptions): Promise<ApiResponse> => {
|
||||
export const cancelPasswordLogin = async (sessionId: string, options?: RequestControlOptions): Promise<OperationResponse> => {
|
||||
return del(`/api/v1/password-login/cancel/${sessionId}`, undefined, options);
|
||||
};
|
||||
|
||||
@@ -348,11 +348,11 @@ export const getOrderDetail = async (orderId: string): Promise<{ success: boolea
|
||||
};
|
||||
};
|
||||
|
||||
export const updateOrder = async (orderId: string, data: Partial<Order>): Promise<ApiResponse> => {
|
||||
export const updateOrder = async (orderId: string, data: Partial<Order>): Promise<OperationResponse> => {
|
||||
return put(`/api/v1/orders/${orderId}`, data);
|
||||
};
|
||||
|
||||
export const deleteOrder = async (orderId: string): Promise<ApiResponse> => {
|
||||
export const deleteOrder = async (orderId: string): Promise<OperationResponse> => {
|
||||
return del(`/api/v1/orders/${orderId}`);
|
||||
};
|
||||
|
||||
|
||||
+2
-8
@@ -1,11 +1,4 @@
|
||||
|
||||
// API Response Bases
|
||||
export interface ApiResponse {
|
||||
success?: boolean;
|
||||
message?: string;
|
||||
msg?: string;
|
||||
}
|
||||
|
||||
export interface PaginatedResponse<T> {
|
||||
success: boolean;
|
||||
data: T[];
|
||||
@@ -17,7 +10,8 @@ export interface PaginatedResponse<T> {
|
||||
}
|
||||
|
||||
// Auth
|
||||
export interface LoginResponse {
|
||||
/** 会话登录和首次初始化接口的具名响应。 */
|
||||
export interface SessionResponse {
|
||||
success: boolean;
|
||||
token?: string;
|
||||
message?: string;
|
||||
|
||||
Reference in new issue
Block a user