mirror of
https://github.com/d0zingcat/alert-message-center.git
synced 2026-06-02 23:16:43 +00:00
docs: add mandatory lint check convention for AI
Signed-off-by: d0zingcat <iamtangli42@gmail.com>
This commit is contained in:
@@ -2,8 +2,8 @@ import { db } from "./index";
|
||||
import { migrateUserTokens } from "./migrate";
|
||||
|
||||
async function main() {
|
||||
await migrateUserTokens(db);
|
||||
process.exit(0);
|
||||
await migrateUserTokens(db);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
main();
|
||||
|
||||
@@ -9,7 +9,7 @@ const connectionString =
|
||||
process.env.DATABASE_URL ||
|
||||
"postgres://postgres:password@localhost:5432/alert_message_center";
|
||||
|
||||
export async function migrateUserTokens(db: any) {
|
||||
export async function migrateUserTokens(db: ReturnType<typeof drizzle>) {
|
||||
console.log("⏳ Checking for user tokens that need shortening...");
|
||||
try {
|
||||
const allUsers = await db.select().from(users);
|
||||
|
||||
@@ -4,7 +4,6 @@ import { db } from "./db";
|
||||
import { alertLogs, alertTasks, topics, users } from "./db/schema";
|
||||
import { feishuClient } from "./feishu";
|
||||
import { logger } from "./lib/logger";
|
||||
import { uuid } from "zod/v4";
|
||||
|
||||
type FeishuReceiveIdType = "open_id" | "user_id" | "email" | "chat_id";
|
||||
|
||||
@@ -144,21 +143,22 @@ webhook.post("/:token/topic/:slug", async (c) => {
|
||||
} else {
|
||||
// 2. Pass-through strategy: Use rest of body as content
|
||||
// Exclude keys that are definitely not part of content
|
||||
// biome-ignore lint/performance/noDelete: usage is limited
|
||||
const { msg_type, token, ...rest } = body;
|
||||
content = rest;
|
||||
|
||||
// 3. Infer msgType if missing
|
||||
if (!msgType) {
|
||||
if (body.post) msgType = "post";
|
||||
else if (body.file_key && body.image_key)
|
||||
msgType = "media"; // Media has both
|
||||
else if (body.image_key) msgType = "image";
|
||||
else if (body.file_key && body.image_key) msgType = "media"; // Media has both
|
||||
else if (body.file_key) msgType = "file";
|
||||
else if (body.audio_key) msgType = "audio";
|
||||
else if (body.sticker_key) msgType = "sticker";
|
||||
else if (body.chat_id) msgType = "share_chat";
|
||||
else if (body.user_id) msgType = "share_user";
|
||||
else if (body.header || body.elements) msgType = "interactive"; // Unwrapped card
|
||||
else if (body.header || body.elements)
|
||||
msgType = "interactive"; // Unwrapped card
|
||||
else {
|
||||
// Fallback to text
|
||||
msgType = "text";
|
||||
|
||||
Reference in New Issue
Block a user