-
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
9 changed files
with
119 additions
and
12 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 |
---|---|---|
|
@@ -10,6 +10,7 @@ package-lock.json | |
# Environment | ||
.env | ||
.env.* | ||
!.env.template | ||
|
||
# pylon (build directory) | ||
.pylon | ||
|
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
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,31 @@ | ||
-- CreateTable | ||
CREATE TABLE "Post" ( | ||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, | ||
"title" TEXT NOT NULL, | ||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"content" TEXT, | ||
"published" BOOLEAN NOT NULL DEFAULT false, | ||
"authorId" INTEGER NOT NULL, | ||
CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Profile" ( | ||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, | ||
"bio" TEXT, | ||
"userId" INTEGER NOT NULL, | ||
CONSTRAINT "Profile_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "User" ( | ||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, | ||
"name" TEXT, | ||
"email" TEXT NOT NULL | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Profile_userId_key" ON "Profile"("userId"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); |
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,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "sqlite" |
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,39 @@ | ||
// This is your Prisma schema file, | ||
// learn more about it in the docs: https://pris.ly/d/prisma-schema | ||
|
||
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? | ||
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init | ||
|
||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
|
||
datasource db { | ||
provider = "sqlite" | ||
url = "file:./db/dev.db" | ||
} | ||
|
||
model Post { | ||
id Int @id @default(autoincrement()) | ||
title String | ||
createdAt DateTime @default(now()) | ||
content String? | ||
published Boolean @default(false) | ||
authorId Int | ||
User User @relation(fields: [authorId], references: [id], onDelete: NoAction, onUpdate: NoAction) | ||
} | ||
|
||
model Profile { | ||
id Int @id @default(autoincrement()) | ||
bio String? | ||
userId Int @unique | ||
User User @relation(fields: [userId], references: [id], onDelete: NoAction, onUpdate: NoAction) | ||
} | ||
|
||
model User { | ||
id Int @id @default(autoincrement()) | ||
name String? | ||
email String @unique | ||
Post Post[] | ||
Profile Profile? | ||
} |
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,3 @@ | ||
import { PrismaClient } from "@prisma/client"; | ||
|
||
export const prisma = new PrismaClient(); |
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,13 +1,14 @@ | ||
import {defineService, logger, PylonAPI} from '@getcronit/pylon' | ||
import { defineService, logger, PylonAPI } from "@getcronit/pylon"; | ||
import { prisma } from "./client"; | ||
|
||
export default defineService({ | ||
Query: { | ||
hello() { | ||
return 'Hello, World!' | ||
} | ||
} | ||
}) | ||
posts: async () => { | ||
return await prisma.post.findMany(); | ||
}, | ||
}, | ||
}); | ||
|
||
export const configureApp: PylonAPI['configureApp'] = app => { | ||
logger.info('Configuring app') | ||
} | ||
export const configureApp: PylonAPI["configureApp"] = (app) => { | ||
logger.info("Configuring app"); | ||
}; |