feat: 添加设备注册 API 并重构安装横幅组件
This commit is contained in:
@@ -11,24 +11,29 @@ import {
|
||||
} from "drizzle-orm/mysql-core";
|
||||
import { sql } from "drizzle-orm";
|
||||
|
||||
export const claws = mysqlTable("claws", {
|
||||
id: varchar("id", { length: 21 }).primaryKey(),
|
||||
apiKey: varchar("api_key", { length: 64 }).notNull().unique(),
|
||||
name: varchar("name", { length: 100 }).notNull(),
|
||||
platform: varchar("platform", { length: 20 }),
|
||||
model: varchar("model", { length: 50 }),
|
||||
ip: varchar("ip", { length: 45 }),
|
||||
latitude: decimal("latitude", { precision: 10, scale: 7 }),
|
||||
longitude: decimal("longitude", { precision: 10, scale: 7 }),
|
||||
city: varchar("city", { length: 100 }),
|
||||
country: varchar("country", { length: 100 }),
|
||||
countryCode: varchar("country_code", { length: 5 }),
|
||||
region: varchar("region", { length: 50 }),
|
||||
lastHeartbeat: datetime("last_heartbeat"),
|
||||
totalTasks: int("total_tasks").default(0),
|
||||
createdAt: datetime("created_at").default(sql`NOW()`),
|
||||
updatedAt: datetime("updated_at").default(sql`NOW()`),
|
||||
});
|
||||
export const claws = mysqlTable(
|
||||
"claws",
|
||||
{
|
||||
id: varchar("id", { length: 21 }).primaryKey(),
|
||||
apiKey: varchar("api_key", { length: 64 }).notNull().unique(),
|
||||
deviceId: varchar("device_id", { length: 64 }),
|
||||
name: varchar("name", { length: 100 }).notNull(),
|
||||
platform: varchar("platform", { length: 20 }),
|
||||
model: varchar("model", { length: 50 }),
|
||||
ip: varchar("ip", { length: 45 }),
|
||||
latitude: decimal("latitude", { precision: 10, scale: 7 }),
|
||||
longitude: decimal("longitude", { precision: 10, scale: 7 }),
|
||||
city: varchar("city", { length: 100 }),
|
||||
country: varchar("country", { length: 100 }),
|
||||
countryCode: varchar("country_code", { length: 5 }),
|
||||
region: varchar("region", { length: 50 }),
|
||||
lastHeartbeat: datetime("last_heartbeat"),
|
||||
totalTasks: int("total_tasks").default(0),
|
||||
createdAt: datetime("created_at").default(sql`NOW()`),
|
||||
updatedAt: datetime("updated_at").default(sql`NOW()`),
|
||||
},
|
||||
(table) => [uniqueIndex("claws_device_id_unq").on(table.deviceId)]
|
||||
);
|
||||
|
||||
export const heartbeats = mysqlTable(
|
||||
"heartbeats",
|
||||
|
||||
Reference in New Issue
Block a user