-
Notifications
You must be signed in to change notification settings - Fork 3
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
11 changed files
with
519 additions
and
158 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
backend/prisma/migrations/20240810025710_schema4/migration.sql
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,41 @@ | ||
/* | ||
Warnings: | ||
- Added the required column `projectId` to the `Farmer` table without a default value. This is not possible if the table is not empty. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "Farmer" ADD COLUMN "projectId" TEXT NOT NULL; | ||
|
||
-- CreateTable | ||
CREATE TABLE "Project" ( | ||
"id" TEXT NOT NULL, | ||
"farmerId" TEXT NOT NULL, | ||
"employeeId" TEXT NOT NULL, | ||
"temperature10" TEXT NOT NULL, | ||
"moisture" TEXT NOT NULL, | ||
"temperature" TEXT NOT NULL, | ||
"ultravioletIndex" TEXT NOT NULL, | ||
"weatherGroup" TEXT NOT NULL, | ||
"weatherDescription" TEXT NOT NULL, | ||
"atmosphericTemprature" TEXT NOT NULL, | ||
"pressure" TEXT NOT NULL, | ||
"humidity" TEXT NOT NULL, | ||
"cloudiness" TEXT NOT NULL, | ||
"rainVolume3hrs" TEXT NOT NULL, | ||
"snowVolume3hrs" TEXT NOT NULL, | ||
|
||
CONSTRAINT "Project_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Project_farmerId_key" ON "Project"("farmerId"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Project_employeeId_key" ON "Project"("employeeId"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Project" ADD CONSTRAINT "Project_farmerId_fkey" FOREIGN KEY ("farmerId") REFERENCES "Farmer"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Project" ADD CONSTRAINT "Project_employeeId_fkey" FOREIGN KEY ("employeeId") REFERENCES "Employee"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import { Hono } from "hono"; | ||
import { cors } from "hono/cors"; | ||
import { userRouter } from "./routes/user"; | ||
import { farmerRouter } from "./routes/farmer"; | ||
|
||
const app = new Hono(); | ||
|
||
app.use("/*", cors()); | ||
app.route("/api/v1/user", userRouter); | ||
app.route("/api/v1/farmer", farmerRouter); | ||
|
||
export default app; |
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,11 @@ | ||
import { Hono } from "hono"; | ||
|
||
export const farmerRouter = new Hono<{ | ||
Bindings: { | ||
DATABASE_URL: string; | ||
JWT_SECRET: string; | ||
}; | ||
Variables: { | ||
userId: string; | ||
}; | ||
}>(); |
Oops, something went wrong.