Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.

Commit f3362a3

Browse files
authored
refactor: align types and API with mx-core v11 (#1036)
* refactor: align types and API with mx-core v11 - Rename model fields to match v11 API (created→createdAt, modified→modifiedAt, pin→pinAt, etc.) - Update model types (PostModel, NoteModel, CommentModel, DraftModel, etc.) with v11 schema - Flatten nested routes for /says and /projects (remove unnecessary RouterView wrapper) - Remove deprecated subscribe export API and subscribe model - Replace unsubscribe with unsubscribeBatch API - Simplify comment detail component and drawer - Update snippet editor with improved type handling - Remove unused route names and types * fix: handle password management for protected notes after PG migration Signed-off-by: Innei <tukon479@gmail.com> --------- Signed-off-by: Innei <tukon479@gmail.com>
1 parent fd6fd0b commit f3362a3

64 files changed

Lines changed: 344 additions & 348 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/admin/src/api/ai-agent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ export interface AgentConversation {
77
title?: string
88
model: string
99
providerId: string
10-
created: string
11-
updated: string
10+
createdAt: string
11+
updatedAt: string
1212
messageCount: number
1313
messages?: Record<string, unknown>[]
1414
reviewState?: Record<string, unknown>

apps/admin/src/api/ai.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export type TranslationEntryKeyPath =
270270

271271
export interface TranslationEntry {
272272
id: string
273-
created: string
273+
createdAt: string
274274
keyPath: TranslationEntryKeyPath
275275
lang: string
276276
keyType: 'entity' | 'dict'
@@ -494,7 +494,7 @@ export const aiApi = {
494494
getSlugBackfillStatus: () =>
495495
request.get<{
496496
count: number
497-
notes: Array<{ _id: string; title: string; nid: number }>
497+
notes: Array<{ id: string; title: string; nid: number }>
498498
}>('/ai/writer/backfill-slugs/status'),
499499

500500
createSlugBackfillTask: () =>

apps/admin/src/api/analyze.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1+
import type { UA } from '~/models/analyze'
12
import type { PaginateResult } from '~/models/base'
23

34
import { request } from '~/utils/request'
45

5-
export interface AnalyzeRecord {
6-
id: string
7-
ip: string
8-
path: string
9-
ua: string
10-
country?: string
11-
region?: string
12-
city?: string
13-
created: string
6+
export type AnalyzeRecord = UA.Root & {
7+
country?: string | null
8+
referer?: string | null
149
}
1510

1611
export interface IPAggregate {

apps/admin/src/api/cron-task.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ export enum CronTaskType {
88
PushToBaiduSearch = 'cron:push-to-baidu-search',
99
PushToBingSearch = 'cron:push-to-bing-search',
1010
DeleteExpiredJWT = 'cron:delete-expired-jwt',
11-
CleanupOrphanImages = 'cron:cleanup-orphan-images',
12-
SyncPublishedImagesToS3 = 'cron:sync-published-images-to-s3',
11+
RebuildSearchIndex = 'cron:rebuild-search-index',
12+
CleanCommentUploads = 'cron:clean-comment-uploads',
1313
}
1414

1515
export enum CronTaskStatus {

apps/admin/src/api/files.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@ export interface OrphanFile {
1515
id: string
1616
fileName: string
1717
fileUrl: string
18-
created: string
18+
status?: 'pending' | 'active' | 'detached'
19+
uploadedBy?: string | null
20+
readerId?: string | null
21+
mimeType?: string | null
22+
byteSize?: number | null
23+
refType?: string | null
24+
refId?: string | null
25+
detachedAt?: string | null
26+
createdAt: string
1927
}
2028

2129
export interface OrphanListResponse {
@@ -132,7 +140,7 @@ export interface CommentUploadFile {
132140
refType?: string
133141
refId?: string
134142
detachedAt?: string
135-
created: string
143+
createdAt: string
136144
}
137145

138146
export interface CommentUploadListResponse {

apps/admin/src/api/notes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export interface UpdateNoteData extends Partial<CreateNoteData> {}
3535
// 用于 patch 操作的数据类型,允许将某些字段设为 null
3636
export interface PatchNoteData {
3737
topicId?: string | null
38-
slug?: string
38+
slug?: string | null
3939
[key: string]: unknown
4040
}
4141

apps/admin/src/api/pages.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export interface CreatePageData {
1515
slug: string
1616
subtitle?: string
1717
order?: number
18-
allowComment?: boolean
1918
meta?: Record<string, unknown>
2019
/** 关联的草稿 ID,发布时传递以标记草稿为已发布 */
2120
draftId?: string

apps/admin/src/api/subscribe.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import { request } from '~/utils/request'
33
export interface Subscriber {
44
id: string
55
email: string
6-
subscribed: boolean
6+
cancelToken: string
77
subscribe: number
8-
created: string
8+
verified: boolean
9+
createdAt: string
910
}
1011

1112
export interface SubscribeResponse {
@@ -28,16 +29,13 @@ export const subscribeApi = {
2829
getList: (params?: { page?: number; size?: number }) =>
2930
request.get<SubscribeResponse>('/subscribe', { params }),
3031

31-
// 取消订阅
32-
unsubscribe: (params: { email: string }) =>
33-
request.get<void>('/subscribe/unsubscribe', { params }),
32+
// 取消订阅 (单个,需 cancelToken)
33+
unsubscribe: (params: { email: string; cancelToken: string }) =>
34+
request.get<string>('/subscribe/unsubscribe', { params }),
3435

3536
// 批量取消订阅
3637
unsubscribeBatch: (params: { emails?: string[]; all?: boolean }) =>
3738
request.delete<{ deletedCount: number }>('/subscribe/unsubscribe/batch', {
3839
data: params,
3940
}),
40-
41-
// 批量导出订阅
42-
export: () => request.get<Blob>('/subscribe/export'),
4341
}

apps/admin/src/components/draft/draft-list-modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export const DraftListModal = defineComponent({
133133
v{draft.version} · {formatWordCount(draft.text)}
134134
</p>
135135
<p class="mt-0.5 text-xs text-neutral-400 dark:text-neutral-500">
136-
{new Date(draft.updated).toLocaleString()}
136+
{new Date(draft.updatedAt).toLocaleString()}
137137
</p>
138138
</div>
139139
</div>

apps/admin/src/components/draft/draft-recovery-modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export const DraftRecoveryModal = defineComponent({
156156
list.push({
157157
version: 'current',
158158
title: props.draft.title,
159-
savedAt: props.draft.updated,
159+
savedAt: props.draft.updatedAt,
160160
isCurrent: true,
161161
})
162162

0 commit comments

Comments
 (0)