Skip to content

Commit

Permalink
add: wrangler 配置
Browse files Browse the repository at this point in the history
wip: 存储单条记录的抽象
  • Loading branch information
Mr-Ao-Dragon committed Jan 30, 2025
1 parent be08317 commit 4983f4b
Show file tree
Hide file tree
Showing 11 changed files with 373 additions and 38 deletions.
42 changes: 42 additions & 0 deletions db/schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright FCW
*/
import { customType, integer, sqliteTable, text } from "drizzle-orm/sqlite-core";

export const datetime = customType<{ data: Date; driverData: string }>({
dataType() {
return "text"; // 指定数据库中的类型
},
toDriver(value: Date) {
// 写入数据库时的转换
return value.toISOString();
},
fromDriver(value: string): Date {
// 从数据库读取时的转换
return new Date(value);
},
});
export const organization = sqliteTable("organization", {
id: integer("id").primaryKey({ autoIncrement: true }),
name: text("name"),
slug: text("slug"),
coverUrl: text("coverUrl"),
globalUrl: text("globalUrl"),
cnUrl: text("cnUrl"),
});
export const Party = sqliteTable("partyData", {
id: integer("id").primaryKey({ autoIncrement: true }),
name: text("name").notNull(),
scale: text("scale"),
status: text("status"),
startDate: datetime("startDate"),
endDate: datetime("endDate"),
address: text("address"),
city: text("city"),
coverUrl: text("coverUrl"),
org: text("organization")
.references(() => organization.name)
.notNull(),
globalUrl: text("globalUrl"),
cnUrl: text("cnUrl"),
});
62 changes: 62 additions & 0 deletions docs/tableSchema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# 表结构

## `partyData`

| 字段名 | 数据类型 | 是否为主键 | 是否允许为空 | 备注 |
|--------------|----------|-------|--------|---------|
| id | INT ||| 主键 |
| name | VARCHAR ||| 活动名称 |
| scale | VARCHAR ||| 规模 |
| status | VARCHAR ||| 状态 |
| startDate | DATETIME ||| 开始日期 |
| endDate | DATETIME ||| 结束日期 |
| address | VARCHAR ||| 地址 |
| city | VARCHAR ||| 城市 |
| coverUrl | VARCHAR ||| 封面图片URL |
| organization | VARCHAR ||| 组织表关联索引 |

## `organization`

| 字段名 | 数据类型 | 是否为主键 | 是否允许为空 | 备注 |
|-----------|---------|-------|--------|----------|
| name | VARCHAR ||| 聚会名称 |
| slug | VARCHAR ||| 组织名称 |
| coverUrl | VARCHAR ||| 封面图片 URL |
| globalUrl | VARCHAR ||| 全球直达链接 |
| cnUrl | VARCHAR ||| 中国直达链接 |

# 数据结构

```json
{
"total": 1,
"data": [
{
"name": "冬兽聚2024",
"scale": "medium",
"status": "scheduled",
"slug": "2024-dec-shanghai-con",
"startDate": "2024-12-20T02:00:00.677Z",
"endDate": "2024-12-22T10:00:00.816Z",
"address": "夏阳湖皇冠假日酒店",
"city": "上海",
"coverUrl": "https://images.furrycons.cn/organizations/furrychina/2024-dec-shanghai-con/cover-lMiuOMbUlUsqmiiOTpWpG.png",
"detail": "将它们化作璀璨星辰,让我在下雨之际看见我的玫瑰。\n关注并转发BILIBILI动态,抽一名小伙伴送出【冬兽聚2024】入场票1张~\n【11月9日19点正式开售!】\n购票&酒店预订:官网FurryChina.com\n\n【冬兽聚2024!】2024年12月20-22日\n第五年!上海·夏阳湖皇冠假日酒店!共计三天两夜!\n\n★★【新上线日夜通票!套票内含高能派对通行证!】★★\n房间套票现在内含高能派对通行证!无需额外购买!\n更多票务详情请访问官网Furrychina.com 或查看长图!\n\n★【新上线户外野营!】★\n想尝试不一样的兽聚体验?来试试户外野营吧!*\n\n【申请中心现已开放!】\n摊位申请、舞台申请、户外野营申请现已开放!\n\n【摊位展商速览!】\n天邪鬼工作室、狛神本铺、MOFUMOFU、犇犇牛火锅店、FLUFFYLAND!\n更多摊位正在路上!\n\n【那些熟悉的活动们!】\n毛毛大合照、名片交友会\n商品贩售、舞台表演\n高能派对、CFCC集市\n茶话会、祈愿亭\n【还有更多活动正在筹备中!敬请期待!】\n\n更多详情请查看长图!\n\n*该项逃票票活动需要参加者拥有野营装备及经验\n----------------------\n2024.12.20-22 上海·冬兽聚\n官网:FurryChina.com \n购票页面:FurryChina.com \n冬兽聚官方交流群③:652214537\nX: @furrychina\nFacebook:@furrychina\n展会联络邮箱:[email protected]\n商务咨询邮箱:[email protected]",
"organization": {
"name": "极兽聚",
"slug": "furrychina",
"coverUrl": "https://images.furrycons.cn/organizations/furrychina/logo.svg",
"globalUrl": "https://www.furryeventchina.com/furrychina",
"cnUrl": "https://www.furrycons.cn/furrychina"
},
"globalUrl": "https://www.furryeventchina.com/furrychina/2024-dec-shanghai-con",
"cnUrl": "https://www.furrycons.cn/furrychina/2024-dec-shanghai-con"
}
]
}
```

### 说明:

- 主键不允许为空。
- 其他字段默认允许为空,除非在创建表时指定了 `NOT NULL`
154 changes: 140 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"wrangler": "3.19.0"
},
"dependencies": {
"axios": "^1.7.8"
"axios": "^1.7.8",
"drizzle-orm": "^0.39.0"
}
}
29 changes: 29 additions & 0 deletions qodana.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#-------------------------------------------------------------------------------#
# Qodana analysis is configured by qodana.yaml file #
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
#-------------------------------------------------------------------------------#
version: "1.0"

#Specify inspection profile for code analysis
profile:
name: qodana.starter

#Enable inspections
#include:
# - name: <SomeEnabledInspectionId>

#Disable inspections
#exclude:
# - name: <SomeDisabledInspectionId>
# paths:
# - <path/where/not/run/inspection>

#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
#bootstrap: sh ./prepare-qodana.sh

#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
#plugins:
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)

#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
linter: jetbrains/qodana-js:2024.3
Loading

0 comments on commit 4983f4b

Please sign in to comment.