feat: initial commit with accounts manager project structure

- TypeScript项目基础架构
- API路由和账户管理服务
- 数据库模式和迁移
- 基础配置文件和文档

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Your Name
2025-09-23 01:42:50 +08:00
commit 891ae27689
27 changed files with 4828 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
CREATE TABLE IF NOT EXISTS "accounts" (
"id" serial PRIMARY KEY NOT NULL,
"owner_id" varchar(128) NOT NULL,
"platform" varchar(100) NOT NULL,
"custom_id" varchar(255) NOT NULL,
"data" text NOT NULL,
"status" varchar(50) NOT NULL,
"notes" text,
"locked_at" timestamp,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS "platform_custom_id_idx" ON "accounts" ("platform","custom_id");
CREATE INDEX IF NOT EXISTS "owner_id_status_idx" ON "accounts" ("owner_id","status");
CREATE INDEX IF NOT EXISTS "platform_owner_idx" ON "accounts" ("platform","owner_id");

View File

@@ -0,0 +1,16 @@
CREATE TABLE IF NOT EXISTS "accounts" (
"id" serial PRIMARY KEY NOT NULL,
"owner_id" varchar(128) NOT NULL,
"platform" varchar(100) NOT NULL,
"custom_id" varchar(255) NOT NULL,
"data" text NOT NULL,
"status" varchar(50) NOT NULL,
"notes" text,
"locked_at" timestamp,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX IF NOT EXISTS "platform_custom_id_idx" ON "accounts" USING btree ("platform","custom_id");--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "owner_id_status_idx" ON "accounts" USING btree ("owner_id","status");--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "platform_owner_idx" ON "accounts" USING btree ("platform","owner_id");

View File

@@ -0,0 +1,152 @@
{
"id": "57f2c5ed-21e7-4918-8534-8cca691243fb",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.accounts": {
"name": "accounts",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"owner_id": {
"name": "owner_id",
"type": "varchar(128)",
"primaryKey": false,
"notNull": true
},
"platform": {
"name": "platform",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"custom_id": {
"name": "custom_id",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"data": {
"name": "data",
"type": "text",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"locked_at": {
"name": "locked_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"platform_custom_id_idx": {
"name": "platform_custom_id_idx",
"columns": [
{
"expression": "platform",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "custom_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"owner_id_status_idx": {
"name": "owner_id_status_idx",
"columns": [
{
"expression": "owner_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "status",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"platform_owner_idx": {
"name": "platform_owner_idx",
"columns": [
{
"expression": "platform",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "owner_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"schemas": {},
"sequences": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

View File

@@ -0,0 +1,13 @@
{
"version": "7",
"dialect": "postgresql",
"entries": [
{
"idx": 0,
"version": "7",
"when": 1758524929427,
"tag": "0000_wet_joshua_kane",
"breakpoints": true
}
]
}