refactor: 完全重构为 Anki 兼容数据结构
- 用 Deck 替换 Folder - 用 Note + Card 替换 Pair (双向复习) - 添加 NoteType (卡片模板) - 添加 Revlog (复习历史) - 实现 SM-2 间隔重复算法 - 更新所有前端页面 - 添加数据库迁移
This commit is contained in:
90
src/modules/deck/deck-repository-dto.ts
Normal file
90
src/modules/deck/deck-repository-dto.ts
Normal file
@@ -0,0 +1,90 @@
|
||||
import { Visibility } from "../../../generated/prisma/enums";
|
||||
|
||||
export interface RepoInputCreateDeck {
|
||||
name: string;
|
||||
desc?: string;
|
||||
userId: string;
|
||||
visibility?: Visibility;
|
||||
}
|
||||
|
||||
export interface RepoInputUpdateDeck {
|
||||
id: number;
|
||||
name?: string;
|
||||
desc?: string;
|
||||
visibility?: Visibility;
|
||||
collapsed?: boolean;
|
||||
}
|
||||
|
||||
export interface RepoInputGetDeckById {
|
||||
id: number;
|
||||
}
|
||||
|
||||
export interface RepoInputGetDecksByUserId {
|
||||
userId: string;
|
||||
}
|
||||
|
||||
export interface RepoInputGetPublicDecks {
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
orderBy?: "createdAt" | "name";
|
||||
}
|
||||
|
||||
export interface RepoInputDeleteDeck {
|
||||
id: number;
|
||||
}
|
||||
|
||||
export type RepoOutputDeck = {
|
||||
id: number;
|
||||
name: string;
|
||||
desc: string;
|
||||
userId: string;
|
||||
visibility: Visibility;
|
||||
collapsed: boolean;
|
||||
conf: unknown;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
cardCount?: number;
|
||||
};
|
||||
|
||||
export type RepoOutputPublicDeck = RepoOutputDeck & {
|
||||
userName: string | null;
|
||||
userUsername: string | null;
|
||||
favoriteCount: number;
|
||||
};
|
||||
|
||||
export type RepoOutputDeckOwnership = {
|
||||
userId: string;
|
||||
};
|
||||
|
||||
export interface RepoInputToggleDeckFavorite {
|
||||
deckId: number;
|
||||
userId: string;
|
||||
}
|
||||
|
||||
export interface RepoInputCheckDeckFavorite {
|
||||
deckId: number;
|
||||
userId: string;
|
||||
}
|
||||
|
||||
export interface RepoInputSearchPublicDecks {
|
||||
query: string;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
}
|
||||
|
||||
export interface RepoInputGetPublicDeckById {
|
||||
deckId: number;
|
||||
}
|
||||
|
||||
export type RepoOutputDeckFavorite = {
|
||||
isFavorited: boolean;
|
||||
favoriteCount: number;
|
||||
};
|
||||
|
||||
export interface RepoInputGetUserFavoriteDecks {
|
||||
userId: string;
|
||||
}
|
||||
|
||||
export type RepoOutputUserFavoriteDeck = RepoOutputPublicDeck & {
|
||||
favoritedAt: Date;
|
||||
};
|
||||
Reference in New Issue
Block a user