Skip to content

Commit 5e09a2a

Browse files
committed
game cat linking. sort opt on search
1 parent 65caa89 commit 5e09a2a

File tree

15 files changed

+1132
-15
lines changed

15 files changed

+1132
-15
lines changed

src/index.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Env } from '~/lib/handler'
55
import { AssetHandler } from './routes/asset'
66
import { GameHandler } from './routes/game'
77
import { CategoryHandler } from './routes/category'
8+
import { TagHandler } from './routes/tag'
89
import { AuthHandler } from './routes/auth'
910
import { UserHandler } from './routes/user'
1011
import { apiReference } from '@scalar/hono-api-reference'
@@ -14,14 +15,20 @@ const app = new OpenAPIHono<{ Bindings: Env }>()
1415
app.use(
1516
'*',
1617
cors({
17-
origin: ['http://localhost:8787', 'https://wanderer.moe', 'https://staging.wanderer.moe'],
18+
origin: [
19+
'http://localhost:8787',
20+
'http://localhost:3000',
21+
'https://wanderer.moe',
22+
'https://staging.wanderer.moe',
23+
],
1824
credentials: true,
1925
}),
2026
)
2127

2228
app.route('/asset', AssetHandler)
2329
app.route('/game', GameHandler)
2430
app.route('/category', CategoryHandler)
31+
app.route('/tag', TagHandler)
2532
app.route('/user', UserHandler)
2633
app.route('/auth', AuthHandler)
2734

@@ -56,4 +63,9 @@ app.get(
5663
}),
5764
)
5865

66+
app.onError((err, c) => {
67+
console.error(err)
68+
return c.json({ success: false, message: 'Internal Server Error' }, 500)
69+
})
70+
5971
export default app
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CREATE TABLE `game_to_category` (
2+
`game_id` text NOT NULL,
3+
`category_id` text NOT NULL,
4+
PRIMARY KEY(`game_id`, `category_id`),
5+
FOREIGN KEY (`game_id`) REFERENCES `game`(`id`) ON UPDATE no action ON DELETE cascade,
6+
FOREIGN KEY (`category_id`) REFERENCES `category`(`id`) ON UPDATE no action ON DELETE cascade
7+
);

0 commit comments

Comments
 (0)