mark确定的类型

This commit is contained in:
2025-10-20 11:09:17 +08:00
parent f694299059
commit 9dfb3f4160
3 changed files with 509 additions and 269 deletions

694
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -62,6 +62,7 @@ export class MarkModel extends Model {
declare fileList: MarkFile[]; // 文件管理 declare fileList: MarkFile[]; // 文件管理
declare uname: string; // 用户的名称, 或者着别名 declare uname: string; // 用户的名称, 或者着别名
declare markedAt: Date; // 标记时间
declare createdAt: Date; declare createdAt: Date;
declare updatedAt: Date; declare updatedAt: Date;
declare version: number; declare version: number;
@@ -290,6 +291,11 @@ export const MarkMInit = async <T = any>(opts: MarkInitOpts<T>, sync?: Opts) =>
type: DataTypes.INTEGER, // 更新刷新版本,多人协作 type: DataTypes.INTEGER, // 更新刷新版本,多人协作
defaultValue: 1, defaultValue: 1,
}, },
markedAt: {
type: DataTypes.DATE,
allowNull: true,
comment: '标记时间',
},
uid: { uid: {
type: DataTypes.UUID, type: DataTypes.UUID,
allowNull: true, allowNull: true,

78
src/mark/mark.ts Normal file
View File

@@ -0,0 +1,78 @@
export type Mark<T = any> = {
/**
* 标记ID
*/
id: string;
/**
* 标题
*/
title?: string;
/**
* 描述
*/
description?: string;
/**
* 标签
*/
tags?: string[];
/**
* 标记类型
*/
markType?: string;
/**
* 封面
*/
cover?: string;
/**
* 链接
*/
link?: string;
/**
* 摘要
*/
summary?: string;
/**
* 键
*/
key?: string;
data: T;
/**
* 附件列表
*/
fileList?: any[];
/**
* 创建人信息
*/
uname?: string;
/**
* 版本号
*/
version?: number;
/**
* 创建时间
*/
createdAt: Date;
/**
* 更新时间
*/
updatedAt: Date;
/**
* 标记时间
*/
markedAt?: Date;
uid?: string;
puid?: string;
}
const ensureType = ['markdown', 'json', 'html', 'image', 'video', 'audio', 'code', 'link', 'file']
export type MarkEnsureType = typeof ensureType[number];