df-hono-generator 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/create.cjs +61 -0
- package/package.json +50 -0
- package/template/.env.example +25 -0
- package/template/LICENSE +21 -0
- package/template/README.md +327 -0
- package/template/docker-compose.yml +8 -0
- package/template/drizzle.config.ts +10 -0
- package/template/eslint.config.js +9 -0
- package/template/package.json +50 -0
- package/template/src/app.ts +26 -0
- package/template/src/db/dev.db +0 -0
- package/template/src/db/index.ts +8 -0
- package/template/src/db/migrations/0000_outgoing_gamora.sql +6 -0
- package/template/src/db/migrations/0001_minor_phantom_reporter.sql +118 -0
- package/template/src/db/migrations/0002_same_the_spike.sql +6 -0
- package/template/src/db/migrations/meta/0000_snapshot.json +57 -0
- package/template/src/db/migrations/meta/0001_snapshot.json +841 -0
- package/template/src/db/migrations/meta/0002_snapshot.json +880 -0
- package/template/src/db/migrations/meta/_journal.json +27 -0
- package/template/src/db/schema.ts +162 -0
- package/template/src/db/seeds/index.ts +32 -0
- package/template/src/env.ts +42 -0
- package/template/src/index.ts +10 -0
- package/template/src/lib/configure-open-api.ts +30 -0
- package/template/src/lib/create-app.ts +44 -0
- package/template/src/lib/http-status-codes.ts +354 -0
- package/template/src/lib/json-content.ts +14 -0
- package/template/src/lib/response.ts +50 -0
- package/template/src/lib/types.ts +13 -0
- package/template/src/middleware/auth.ts +127 -0
- package/template/src/middleware/pino-logger.ts +13 -0
- package/template/src/public/favicon.ico +0 -0
- package/template/src/routes/auth/auth.handler.ts +72 -0
- package/template/src/routes/auth/auth.index.ts +9 -0
- package/template/src/routes/auth/auth.routes.ts +76 -0
- package/template/src/routes/oss/alioss.handler.ts +27 -0
- package/template/src/routes/oss/alioss.index.ts +8 -0
- package/template/src/routes/oss/alioss.routes.ts +41 -0
- package/template/src/routes/oss/alioss.service.ts +101 -0
- package/template/src/routes/oss/schema/oss.schemas.ts +21 -0
- package/template/src/utils/jwt.ts +212 -0
- package/template/src/utils/passwordAuth.ts +30 -0
- package/template/src/utils/redis.cache.ts +65 -0
- package/template/tsconfig.json +23 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
CREATE TABLE `blog` (
|
|
2
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
3
|
+
`title` text NOT NULL,
|
|
4
|
+
`content` text,
|
|
5
|
+
`user_id` integer,
|
|
6
|
+
`status` integer DEFAULT 0 NOT NULL,
|
|
7
|
+
`sort` integer DEFAULT 0 NOT NULL,
|
|
8
|
+
`created_at` text DEFAULT (CURRENT_TIMESTAMP) NOT NULL,
|
|
9
|
+
`updated_at` text DEFAULT (CURRENT_TIMESTAMP) NOT NULL,
|
|
10
|
+
`remark` text,
|
|
11
|
+
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
|
|
12
|
+
);
|
|
13
|
+
--> statement-breakpoint
|
|
14
|
+
CREATE TABLE `category` (
|
|
15
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
16
|
+
`title` text NOT NULL,
|
|
17
|
+
`description` text,
|
|
18
|
+
`user_id` integer,
|
|
19
|
+
`sort` integer DEFAULT 0 NOT NULL,
|
|
20
|
+
`created_at` text DEFAULT (CURRENT_TIMESTAMP) NOT NULL,
|
|
21
|
+
`updated_at` text DEFAULT (CURRENT_TIMESTAMP) NOT NULL,
|
|
22
|
+
`remark` text,
|
|
23
|
+
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
|
|
24
|
+
);
|
|
25
|
+
--> statement-breakpoint
|
|
26
|
+
CREATE TABLE `chapter` (
|
|
27
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
28
|
+
`title` text NOT NULL,
|
|
29
|
+
`content` text,
|
|
30
|
+
`course_id` integer NOT NULL,
|
|
31
|
+
`video` text,
|
|
32
|
+
`status` integer DEFAULT 0 NOT NULL,
|
|
33
|
+
`sort` integer DEFAULT 0 NOT NULL,
|
|
34
|
+
`created_at` text DEFAULT (CURRENT_TIMESTAMP) NOT NULL,
|
|
35
|
+
`updated_at` text DEFAULT (CURRENT_TIMESTAMP) NOT NULL,
|
|
36
|
+
`remark` text,
|
|
37
|
+
FOREIGN KEY (`course_id`) REFERENCES `course`(`id`) ON UPDATE no action ON DELETE no action
|
|
38
|
+
);
|
|
39
|
+
--> statement-breakpoint
|
|
40
|
+
CREATE TABLE `course` (
|
|
41
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
42
|
+
`title` text NOT NULL,
|
|
43
|
+
`cover` text,
|
|
44
|
+
`category_id` integer NOT NULL,
|
|
45
|
+
`tags` text,
|
|
46
|
+
`description` text,
|
|
47
|
+
`type` integer DEFAULT 0 NOT NULL,
|
|
48
|
+
`price` integer DEFAULT 0 NOT NULL,
|
|
49
|
+
`status` integer DEFAULT 0 NOT NULL,
|
|
50
|
+
`user_id` integer,
|
|
51
|
+
`sort` integer DEFAULT 0 NOT NULL,
|
|
52
|
+
`created_at` text DEFAULT (CURRENT_TIMESTAMP) NOT NULL,
|
|
53
|
+
`updated_at` text DEFAULT (CURRENT_TIMESTAMP) NOT NULL,
|
|
54
|
+
`remark` text,
|
|
55
|
+
FOREIGN KEY (`category_id`) REFERENCES `category`(`id`) ON UPDATE no action ON DELETE no action,
|
|
56
|
+
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
|
|
57
|
+
);
|
|
58
|
+
--> statement-breakpoint
|
|
59
|
+
CREATE TABLE `course_collect` (
|
|
60
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
61
|
+
`user_id` integer NOT NULL,
|
|
62
|
+
`course_id` integer NOT NULL,
|
|
63
|
+
`created_at` text DEFAULT (CURRENT_TIMESTAMP) NOT NULL,
|
|
64
|
+
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action,
|
|
65
|
+
FOREIGN KEY (`course_id`) REFERENCES `course`(`id`) ON UPDATE no action ON DELETE no action
|
|
66
|
+
);
|
|
67
|
+
--> statement-breakpoint
|
|
68
|
+
CREATE TABLE `notice` (
|
|
69
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
70
|
+
`title` text NOT NULL,
|
|
71
|
+
`content` text,
|
|
72
|
+
`user_id` integer,
|
|
73
|
+
`status` integer DEFAULT 0 NOT NULL,
|
|
74
|
+
`sort` integer DEFAULT 0 NOT NULL,
|
|
75
|
+
`created_at` text DEFAULT (CURRENT_TIMESTAMP) NOT NULL,
|
|
76
|
+
`updated_at` text DEFAULT (CURRENT_TIMESTAMP) NOT NULL,
|
|
77
|
+
`remark` text,
|
|
78
|
+
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
|
|
79
|
+
);
|
|
80
|
+
--> statement-breakpoint
|
|
81
|
+
CREATE TABLE `oauth_account` (
|
|
82
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
83
|
+
`user_id` integer NOT NULL,
|
|
84
|
+
`provider` text NOT NULL,
|
|
85
|
+
`provider_user_id` text NOT NULL,
|
|
86
|
+
`nickname` text,
|
|
87
|
+
`avatar` text,
|
|
88
|
+
`access_token` text,
|
|
89
|
+
`refresh_token` text,
|
|
90
|
+
`expires_at` text,
|
|
91
|
+
`created_at` text DEFAULT (current_timestamp) NOT NULL,
|
|
92
|
+
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
|
|
93
|
+
);
|
|
94
|
+
--> statement-breakpoint
|
|
95
|
+
CREATE UNIQUE INDEX `oauth_account_provider_provider_user_id_unique` ON `oauth_account` (`provider`,`provider_user_id`);--> statement-breakpoint
|
|
96
|
+
CREATE TABLE `user` (
|
|
97
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
98
|
+
`username` text,
|
|
99
|
+
`password` text,
|
|
100
|
+
`email` text,
|
|
101
|
+
`mobile` text,
|
|
102
|
+
`nickname` text,
|
|
103
|
+
`avatar` text,
|
|
104
|
+
`gender` integer DEFAULT 0 NOT NULL,
|
|
105
|
+
`birthday` text,
|
|
106
|
+
`region` text,
|
|
107
|
+
`signature` text,
|
|
108
|
+
`role` integer DEFAULT 1 NOT NULL,
|
|
109
|
+
`status` integer DEFAULT 1 NOT NULL,
|
|
110
|
+
`created_at` text DEFAULT (CURRENT_TIMESTAMP) NOT NULL,
|
|
111
|
+
`updated_at` text DEFAULT (CURRENT_TIMESTAMP) NOT NULL,
|
|
112
|
+
`remark` text
|
|
113
|
+
);
|
|
114
|
+
--> statement-breakpoint
|
|
115
|
+
CREATE UNIQUE INDEX `user_username_unique` ON `user` (`username`);--> statement-breakpoint
|
|
116
|
+
CREATE UNIQUE INDEX `user_email_unique` ON `user` (`email`);--> statement-breakpoint
|
|
117
|
+
CREATE UNIQUE INDEX `user_mobile_unique` ON `user` (`mobile`);--> statement-breakpoint
|
|
118
|
+
DROP TABLE `test`;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "6",
|
|
3
|
+
"dialect": "sqlite",
|
|
4
|
+
"id": "8b64d00a-dcd4-4f01-bc95-176dcf4904ed",
|
|
5
|
+
"prevId": "00000000-0000-0000-0000-000000000000",
|
|
6
|
+
"tables": {
|
|
7
|
+
"test": {
|
|
8
|
+
"name": "test",
|
|
9
|
+
"columns": {
|
|
10
|
+
"id": {
|
|
11
|
+
"name": "id",
|
|
12
|
+
"type": "integer",
|
|
13
|
+
"primaryKey": true,
|
|
14
|
+
"notNull": true,
|
|
15
|
+
"autoincrement": true
|
|
16
|
+
},
|
|
17
|
+
"username": {
|
|
18
|
+
"name": "username",
|
|
19
|
+
"type": "text",
|
|
20
|
+
"primaryKey": false,
|
|
21
|
+
"notNull": true,
|
|
22
|
+
"autoincrement": false
|
|
23
|
+
},
|
|
24
|
+
"gender": {
|
|
25
|
+
"name": "gender",
|
|
26
|
+
"type": "integer",
|
|
27
|
+
"primaryKey": false,
|
|
28
|
+
"notNull": true,
|
|
29
|
+
"autoincrement": false,
|
|
30
|
+
"default": 0
|
|
31
|
+
},
|
|
32
|
+
"created_at": {
|
|
33
|
+
"name": "created_at",
|
|
34
|
+
"type": "integer",
|
|
35
|
+
"primaryKey": false,
|
|
36
|
+
"notNull": true,
|
|
37
|
+
"autoincrement": false
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"indexes": {},
|
|
41
|
+
"foreignKeys": {},
|
|
42
|
+
"compositePrimaryKeys": {},
|
|
43
|
+
"uniqueConstraints": {},
|
|
44
|
+
"checkConstraints": {}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"views": {},
|
|
48
|
+
"enums": {},
|
|
49
|
+
"_meta": {
|
|
50
|
+
"schemas": {},
|
|
51
|
+
"tables": {},
|
|
52
|
+
"columns": {}
|
|
53
|
+
},
|
|
54
|
+
"internal": {
|
|
55
|
+
"indexes": {}
|
|
56
|
+
}
|
|
57
|
+
}
|