refactor: 完全重构为 Anki 兼容数据结构
- 用 Deck 替换 Folder - 用 Note + Card 替换 Pair (双向复习) - 添加 NoteType (卡片模板) - 添加 Revlog (复习历史) - 实现 SM-2 间隔重复算法 - 更新所有前端页面 - 添加数据库迁移
This commit is contained in:
86
src/modules/deck/deck-service-dto.ts
Normal file
86
src/modules/deck/deck-service-dto.ts
Normal file
@@ -0,0 +1,86 @@
|
||||
import { Visibility } from "../../../generated/prisma/enums";
|
||||
|
||||
export type ServiceInputCreateDeck = {
|
||||
name: string;
|
||||
desc?: string;
|
||||
userId: string;
|
||||
visibility?: Visibility;
|
||||
};
|
||||
|
||||
export type ServiceInputUpdateDeck = {
|
||||
deckId: number;
|
||||
name?: string;
|
||||
desc?: string;
|
||||
visibility?: Visibility;
|
||||
collapsed?: boolean;
|
||||
};
|
||||
|
||||
export type ServiceInputDeleteDeck = {
|
||||
deckId: number;
|
||||
};
|
||||
|
||||
export type ServiceInputGetDeckById = {
|
||||
deckId: number;
|
||||
};
|
||||
|
||||
export type ServiceInputGetDecksByUserId = {
|
||||
userId: string;
|
||||
};
|
||||
|
||||
export type ServiceInputGetPublicDecks = {
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
};
|
||||
|
||||
export type ServiceInputCheckOwnership = {
|
||||
deckId: number;
|
||||
userId: string;
|
||||
};
|
||||
|
||||
export type ServiceOutputDeck = {
|
||||
id: number;
|
||||
name: string;
|
||||
desc: string;
|
||||
userId: string;
|
||||
visibility: Visibility;
|
||||
collapsed: boolean;
|
||||
conf: unknown;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
cardCount?: number;
|
||||
};
|
||||
|
||||
export type ServiceOutputPublicDeck = ServiceOutputDeck & {
|
||||
userName: string | null;
|
||||
userUsername: string | null;
|
||||
favoriteCount: number;
|
||||
};
|
||||
|
||||
export type ServiceInputToggleDeckFavorite = {
|
||||
deckId: number;
|
||||
userId: string;
|
||||
};
|
||||
|
||||
export type ServiceInputCheckDeckFavorite = {
|
||||
deckId: number;
|
||||
userId: string;
|
||||
};
|
||||
|
||||
export type ServiceInputSearchPublicDecks = {
|
||||
query: string;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
};
|
||||
|
||||
export type ServiceInputGetPublicDeckById = {
|
||||
deckId: number;
|
||||
};
|
||||
|
||||
export type ServiceOutputDeckFavorite = {
|
||||
isFavorited: boolean;
|
||||
favoriteCount: number;
|
||||
};
|
||||
|
||||
export type ServiceOutputUserFavoriteDeck = ServiceOutputPublicDeck & {
|
||||
favoritedAt: Date;
|
||||
};
|
||||
Reference in New Issue
Block a user