-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from chedakr/feature/login-api
기본 로그인 API 구현 및 페이지 추가
- Loading branch information
Showing
37 changed files
with
3,129 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Simple workflow for deploying static content to GitHub Pages | ||
name: Pages | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: ["main"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v3 | ||
with: | ||
version: 8 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: 'pnpm' | ||
- name: Install dependencies | ||
run: pnpm install | ||
- name: Build | ||
run: pnpm --filter=web run build | ||
- name: Deploy to GitHub Pages | ||
run: pnpm --filter=web run deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { defineConfig } from 'drizzle-kit' | ||
|
||
export default defineConfig({ | ||
schema: "./src/db/schema.ts", | ||
out: "./drizzle", | ||
driver: 'd1', | ||
verbose: true, | ||
strict: true, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
CREATE TABLE `users` ( | ||
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, | ||
`user_id` text NOT NULL, | ||
`user_name` text NOT NULL, | ||
`user_image` text, | ||
`created_at` integer NOT NULL, | ||
`updated_at` integer NOT NULL, | ||
`access_token` text, | ||
`refresh_token` text, | ||
`token_type` text, | ||
`expire_at` integer | ||
); | ||
--> statement-breakpoint | ||
CREATE UNIQUE INDEX `idx_users_user_id` ON `users` (`user_id`);--> statement-breakpoint | ||
CREATE INDEX `idx_users_user_name` ON `users` (`user_name`);--> statement-breakpoint | ||
CREATE INDEX `idx_users_created_at` ON `users` (`created_at`);--> statement-breakpoint | ||
CREATE INDEX `idx_users_updated_at` ON `users` (`updated_at`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
{ | ||
"version": "5", | ||
"dialect": "sqlite", | ||
"id": "adb7d579-e149-4d0e-9c32-f5c0f77d5f8a", | ||
"prevId": "00000000-0000-0000-0000-000000000000", | ||
"tables": { | ||
"users": { | ||
"name": "users", | ||
"columns": { | ||
"id": { | ||
"name": "id", | ||
"type": "integer", | ||
"primaryKey": true, | ||
"notNull": true, | ||
"autoincrement": true | ||
}, | ||
"user_id": { | ||
"name": "user_id", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false | ||
}, | ||
"user_name": { | ||
"name": "user_name", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false | ||
}, | ||
"user_image": { | ||
"name": "user_image", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false, | ||
"autoincrement": false | ||
}, | ||
"created_at": { | ||
"name": "created_at", | ||
"type": "integer", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false | ||
}, | ||
"updated_at": { | ||
"name": "updated_at", | ||
"type": "integer", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false | ||
}, | ||
"access_token": { | ||
"name": "access_token", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false, | ||
"autoincrement": false | ||
}, | ||
"refresh_token": { | ||
"name": "refresh_token", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false, | ||
"autoincrement": false | ||
}, | ||
"token_type": { | ||
"name": "token_type", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false, | ||
"autoincrement": false | ||
}, | ||
"expire_at": { | ||
"name": "expire_at", | ||
"type": "integer", | ||
"primaryKey": false, | ||
"notNull": false, | ||
"autoincrement": false | ||
} | ||
}, | ||
"indexes": { | ||
"idx_users_user_id": { | ||
"name": "idx_users_user_id", | ||
"columns": [ | ||
"user_id" | ||
], | ||
"isUnique": true | ||
}, | ||
"idx_users_user_name": { | ||
"name": "idx_users_user_name", | ||
"columns": [ | ||
"user_name" | ||
], | ||
"isUnique": false | ||
}, | ||
"idx_users_created_at": { | ||
"name": "idx_users_created_at", | ||
"columns": [ | ||
"created_at" | ||
], | ||
"isUnique": false | ||
}, | ||
"idx_users_updated_at": { | ||
"name": "idx_users_updated_at", | ||
"columns": [ | ||
"updated_at" | ||
], | ||
"isUnique": false | ||
} | ||
}, | ||
"foreignKeys": {}, | ||
"compositePrimaryKeys": {}, | ||
"uniqueConstraints": {} | ||
} | ||
}, | ||
"enums": {}, | ||
"_meta": { | ||
"schemas": {}, | ||
"tables": {}, | ||
"columns": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"version": "5", | ||
"dialect": "sqlite", | ||
"entries": [ | ||
{ | ||
"idx": 0, | ||
"version": "5", | ||
"when": 1713153522431, | ||
"tag": "0000_stale_doorman", | ||
"breakpoints": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { sqliteTable, integer, text, uniqueIndex, index } from 'drizzle-orm/sqlite-core'; | ||
|
||
export const users = sqliteTable('users', { | ||
id: integer('id').primaryKey({ autoIncrement: true }), | ||
userId: text('user_id').notNull(), | ||
userName: text('user_name').notNull(), | ||
userImage: text('user_image'), | ||
createdAt: integer('created_at', { mode: 'timestamp_ms' }).notNull(), | ||
updatedAt: integer('updated_at', { mode: 'timestamp_ms' }).notNull(), | ||
accessToken: text('access_token'), | ||
refreshToken: text('refresh_token'), | ||
tokenType: text('token_type'), | ||
expireAt: integer('expire_at', { mode: 'timestamp_ms' }), | ||
}, (table) => { | ||
return { | ||
idxUserId: uniqueIndex('idx_users_user_id').on(table.userId), | ||
idxUserName: index('idx_users_user_name').on(table.userName), | ||
idxCreatedAt: index('idx_users_created_at').on(table.createdAt), | ||
idxUpdatedAt: index('idx_users_updated_at').on(table.updatedAt), | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,31 @@ | ||
/** | ||
* Welcome to Cloudflare Workers! This is your first worker. | ||
* | ||
* - Run `npm run dev` in your terminal to start a development server | ||
* - Open a browser tab at http://localhost:8787/ to see your worker in action | ||
* - Run `npm run deploy` to publish your worker | ||
* | ||
* Learn more at https://developers.cloudflare.com/workers/ | ||
*/ | ||
import { Hono } from 'hono'; | ||
import { cors } from 'hono/cors'; | ||
import auth from './services/auth/v1/route'; | ||
import { Env } from '@/typings'; | ||
|
||
export interface Env { | ||
// Example binding to KV. Learn more at https://developers.cloudflare.com/workers/runtime-apis/kv/ | ||
// MY_KV_NAMESPACE: KVNamespace; | ||
// | ||
// Example binding to Durable Object. Learn more at https://developers.cloudflare.com/workers/runtime-apis/durable-objects/ | ||
// MY_DURABLE_OBJECT: DurableObjectNamespace; | ||
// | ||
// Example binding to R2. Learn more at https://developers.cloudflare.com/workers/runtime-apis/r2/ | ||
// MY_BUCKET: R2Bucket; | ||
// | ||
// Example binding to a Service. Learn more at https://developers.cloudflare.com/workers/runtime-apis/service-bindings/ | ||
// MY_SERVICE: Fetcher; | ||
// | ||
// Example binding to a Queue. Learn more at https://developers.cloudflare.com/queues/javascript-apis/ | ||
// MY_QUEUE: Queue; | ||
} | ||
const app = new Hono<{ Bindings: Env }>(); | ||
|
||
export default { | ||
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> { | ||
return new Response('Hello World!'); | ||
app.use('*', cors({ | ||
origin: (origin, c) => { | ||
if (c.env.DEV) { | ||
return origin; | ||
} | ||
|
||
try { | ||
const originUrl = new URL(origin); | ||
if (originUrl.hostname === 'cheda.kr' || originUrl.hostname.endsWith('.cheda.kr')) { | ||
return origin; | ||
} | ||
} catch (e) {} | ||
|
||
return origin; | ||
}, | ||
}; | ||
})); | ||
|
||
app.get('/', async (c) => { | ||
return c.json({ message: c.env.DEV ? 'Hello, World!' : 'OK' }); | ||
}); | ||
|
||
app.route('/services/auth/v1', auth); | ||
|
||
export default app; |
Oops, something went wrong.