From 07efc4e4681775159b047c36215042e2a7781c00 Mon Sep 17 00:00:00 2001 From: xiongxiao Date: Thu, 19 Mar 2026 01:56:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=20microMark=20schema?= =?UTF-8?q?=20=E5=92=8C=20mark=20=E8=B7=AF=E7=94=B1=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=20skill?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .npmrc | 2 - .opencode/skills/pnpm-deploy/SKILL.md | 29 ++++++++++++++ src/db/drizzle/schema.ts | 8 ++-- src/routes/mark/list.ts | 57 ++++++++++++++++++++++++++- 4 files changed, 89 insertions(+), 7 deletions(-) delete mode 100644 .npmrc create mode 100644 .opencode/skills/pnpm-deploy/SKILL.md diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 3ca2007..0000000 --- a/.npmrc +++ /dev/null @@ -1,2 +0,0 @@ -@abearxiong:registry=https://npm.pkg.github.com -ignore-workspace-root-check=true \ No newline at end of file diff --git a/.opencode/skills/pnpm-deploy/SKILL.md b/.opencode/skills/pnpm-deploy/SKILL.md new file mode 100644 index 0000000..c70248c --- /dev/null +++ b/.opencode/skills/pnpm-deploy/SKILL.md @@ -0,0 +1,29 @@ +--- +name: pnpm-deploy +description: 使用pnpm部署应用到测试或生成环境 +--- + +# pnpm-deploy 部署技能 + +部署应用到测试或生成环境。 + +## 部署环境 + +| 环境 | 命令 | +|------|------| +| 测试环境 | `pnpm pub:me` | +| 生成环境 | `pnpm pub:kevisual` | + +## 使用方法 + +在项目目录下执行部署命令: + +### 部署到测试环境 +```bash +pnpm pub:me +``` + +### 部署到生成环境 +```bash +pnpm pub:kevisual +``` diff --git a/src/db/drizzle/schema.ts b/src/db/drizzle/schema.ts index 6e05bed..ccb2cbd 100644 --- a/src/db/drizzle/schema.ts +++ b/src/db/drizzle/schema.ts @@ -330,8 +330,11 @@ export const microAppsUpload = pgTable("micro_apps_upload", { export const microMark = pgTable("micro_mark", { id: uuid().primaryKey().defaultRandom(), title: text().default(''), - description: text().default(''), tags: jsonb().default([]), + link: text().default(''), + summary: text().default(''), + description: text().default(''), + data: jsonb().default({}), uname: varchar({ length: 255 }).default(''), uid: uuid(), @@ -339,8 +342,7 @@ export const microMark = pgTable("micro_mark", { updatedAt: timestamp({ withTimezone: true, mode: 'string' }).notNull().defaultNow(), cover: text().default(''), thumbnail: text().default(''), - link: text().default(''), - summary: text().default(''), + markType: text().default('md'), config: jsonb().default({}), puid: uuid(), diff --git a/src/routes/mark/list.ts b/src/routes/mark/list.ts index ebebfa5..f5dbb65 100644 --- a/src/routes/mark/list.ts +++ b/src/routes/mark/list.ts @@ -7,7 +7,7 @@ app .route({ path: 'mark', key: 'list', - description: 'mark list.', + description: '获取mark列表', middleware: ['auth'], metadata: { args: { @@ -33,6 +33,7 @@ app .route({ path: 'mark', key: 'getVersion', + description: '获取mark版本信息', middleware: ['auth'], metadata: { args: { @@ -69,6 +70,7 @@ app path: 'mark', key: 'get', middleware: ['auth'], + description: '获取mark详情', metadata: { args: { @@ -100,10 +102,18 @@ app path: 'mark', key: 'update', middleware: ['auth'], + description: '更新mark内容', isDebug: true, metadata: { args: { id: z.string().describe('mark id'), + data: z.object({ + title: z.string().default(''), + tags: z.any().default([]), + link: z.string().default(''), + summary: z.string().default(''), + description: z.string().default(''), + }) } }, }) @@ -147,11 +157,14 @@ app ctx.body = markModel; }) .addTo(app); + + app .route({ path: 'mark', key: 'updateNode', middleware: ['auth'], + description: '更新mark节点,支持更新和删除操作', metadata: { args: { id: z.string().describe('mark id'), @@ -207,6 +220,7 @@ app path: 'mark', key: 'updateNodes', middleware: ['auth'], + description: '批量更新mark节点,支持更新和删除操作', metadata: { args: { id: z.string().describe('mark id'), @@ -292,11 +306,50 @@ app }) .addTo(app); +app + .route({ + path: 'mark', + key: 'create', + description: '创建一个新的mark.', + middleware: ['auth'], + metadata: { + args: { + title: z.string().default('').describe('标题'), + tags: z.any().default([]).describe('标签'), + link: z.string().default('').describe('链接'), + summary: z.string().default('').describe('摘要'), + description: z.string().default('').describe('描述'), + markType: z.string().default('md').describe('mark类型'), + config: z.any().default({}).describe('配置'), + data: z.any().default({}).describe('数据') + } + } + }) + .define(async (ctx) => { + const tokenUser = ctx.state.tokenUser; + const { title, tags, link, summary, description, markType, config, data } = ctx.query; + const inserted = await db.insert(schema.microMark).values({ + title, + tags: tags || [], + link: link || '', + summary: summary || '', + description: description || '', + markType: markType || 'md', + config: config || {}, + data: data || {}, + uname: tokenUser.username, + uid: tokenUser.id, + puid: tokenUser.uid, + }).returning(); + ctx.body = inserted[0]; + }) + .addTo(app); + app .route({ path: 'mark', key: 'getMenu', - description: '获取菜单', + description: '获取mark菜单', middleware: ['auth'] }) .define(async (ctx) => {