-
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.
- Loading branch information
Showing
25 changed files
with
2,840 additions
and
0 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,2 @@ | ||
SECRET_KEY = "" | ||
COOKIE_KEY = "token" |
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,16 @@ | ||
name: Deploy Worker | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build & Deploy Worker | ||
uses: cloudflare/wrangler-action@v3 | ||
with: | ||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} |
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,37 @@ | ||
# prod | ||
dist/ | ||
|
||
# dev | ||
.yarn/ | ||
!.yarn/releases | ||
.vscode/* | ||
!.vscode/launch.json | ||
!.vscode/*.code-snippets | ||
.idea/workspace.xml | ||
.idea/usage.statistics.xml | ||
.idea/shelf | ||
|
||
# deps | ||
node_modules/ | ||
.wrangler | ||
|
||
# env | ||
.env | ||
.env.production | ||
.dev.vars | ||
|
||
# logs | ||
logs/ | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
# misc | ||
.DS_Store | ||
prisma/dev.db | ||
|
||
wrangler.toml | ||
.dev.vars |
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,28 @@ | ||
# Mock Service | ||
|
||
```bash | ||
pnpm install | ||
pnpm run dev | ||
``` | ||
|
||
```bash | ||
pnpm run deploy | ||
``` | ||
|
||
## Prisma Note | ||
|
||
```bash | ||
npx wrangler d1 migrations create mock-service init | ||
|
||
npx prisma migrate diff \ | ||
--from-empty \ | ||
--to-schema-datamodel ./prisma/schema.prisma \ | ||
--script \ | ||
--output migrations/0001_init.sql | ||
|
||
npx wrangler d1 migrations apply mock-service --local | ||
|
||
npx wrangler d1 migrations apply mock-service --remote | ||
|
||
npx prisma generate | ||
``` |
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,64 @@ | ||
-- CreateTable | ||
CREATE TABLE "User" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"email" TEXT NOT NULL, | ||
"username" TEXT, | ||
"name" TEXT, | ||
"avatar" TEXT, | ||
"birthdate" DATETIME, | ||
"bio" TEXT, | ||
"password" TEXT NOT NULL, | ||
"registeredAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" DATETIME NOT NULL | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Album" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"title" TEXT NOT NULL, | ||
"cover" TEXT, | ||
"url" TEXT, | ||
"slogan" TEXT, | ||
"digitalDownloads" REAL, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" DATETIME NOT NULL | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "TeamUser" ( | ||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, | ||
"name" TEXT NOT NULL, | ||
"email" TEXT, | ||
"avatar" TEXT, | ||
"status" TEXT NOT NULL, | ||
"role" TEXT NOT NULL, | ||
"bio" TEXT, | ||
"amount" REAL NOT NULL, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" DATETIME NOT NULL | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Role" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"name" TEXT NOT NULL, | ||
"description" TEXT NOT NULL DEFAULT '', | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" DATETIME NOT NULL | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Permission" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"name" TEXT NOT NULL, | ||
"description" TEXT NOT NULL DEFAULT '', | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" DATETIME NOT NULL | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_username_key" ON "User"("username"); |
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,30 @@ | ||
{ | ||
"name": "mock-service", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "wrangler dev src/index.ts", | ||
"deploy": "wrangler deploy --minify src/index.ts", | ||
"test": "vitest", | ||
"setup": "prisma generate && prisma migrate deploy && prisma db seed" | ||
}, | ||
"dependencies": { | ||
"@hono/swagger-ui": "^0.4.1", | ||
"@prisma/adapter-d1": "^5.19.1", | ||
"@prisma/client": "5.19.1", | ||
"@prisma/extension-accelerate": "^1.1.0", | ||
"bcryptjs": "^2.4.3", | ||
"hono": "^4.6.2", | ||
"@faker-js/faker": "^9.0.1" | ||
}, | ||
"devDependencies": { | ||
"@cloudflare/vitest-pool-workers": "^0.5.6", | ||
"@cloudflare/workers-types": "^4.20240919.0", | ||
"@types/bcryptjs": "^2.4.6", | ||
"@types/node": "^22.5.5", | ||
"prisma": "^5.19.1", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.6.2", | ||
"vitest": "^2.1.1", | ||
"wrangler": "^3.78.6" | ||
} | ||
} |
Oops, something went wrong.