Merge branch 'filip-restructuring-prototype' into filip-project-install-step

This commit is contained in:
Filip Sodić 2024-01-08 15:53:19 +01:00
commit 3de8205750
575 changed files with 23232 additions and 4050 deletions

View File

@ -86,6 +86,10 @@ to install Wasp on OSX/Linux/WSL(Win). From there, just follow the instructions
For more details, check out [the docs](https://wasp-lang.dev/docs).
# Wasp AI / Mage
Wasp comes with experimental AI code generator to help you kickstart your next Wasp project -> you can use it via `wasp new` in the CLI (choose "AI" option) if you can provide your OpenAI keys or you can do it via our [Mage web app](https://usemage.ai) in which case our OpenAI keys are used in the background.
# This repository
This is the main repo of the Wasp universe, containing core code (mostly `waspc` - Wasp compiler) and the supporting materials.
@ -124,4 +128,6 @@ Check our [careers](https://wasp-lang.notion.site/Wasp-Careers-59fd1682c80d446f9
<a href="https://github.com/MarianoMiguel"><img src="https://github.com/MarianoMiguel.png" width="50px" alt="MarianoMiguel" /></a> - Big thanks Mariano for being one of our first sponsors and believing in us ❤️!
<a href="https://github.com/Tech4Money"><img src="https://github.com/Tech4Money.png" width="50px" alt="Tech4Money" /></a> - Thanks Mike ❤️ for supporting us so early on our journey!
<a href="https://github.com/haseeb-heaven"><img src="https://github.com/haseeb-heaven.png" width="50px" alt="haseeb-heaven" /></a> - We are thankful for your support Heaven in this early stage of Wasp :)!

37
examples/README.md Normal file
View File

@ -0,0 +1,37 @@
Example Wasp apps
=================
Here's a list of all officially maintained Wasp example apps!
Most of these apps are relatively small, and each one demonstrates several of Wasp's interesting features.
The **tutorials** directory contains [Wasp tutorial](https://wasp-lang.dev/docs/tutorial/create) apps.
1. **todo-typescript**
- A simple task-tracking app implemented in TypeScript.
- Demonstrates: **full-stack type safety in Wasp via TypeScript**, [auth](https://wasp-lang.dev/docs/auth/overview), [rpc](https://wasp-lang.dev/docs/data-model/operations/overview)
2. **waspello**
- A simple Trello clone.
- Demonstrates: [auth](https://wasp-lang.dev/docs/auth/overview), [rpc](https://wasp-lang.dev/docs/data-model/operations/overview)
3. **hackaton-submissions**
- An app for organizing your own hackaton.
- Demonstrates: [tailwind](https://wasp-lang.dev/docs/project/css-frameworks#tailwind), [rpc](https://wasp-lang.dev/docs/data-model/operations/overview)
4. **waspleau**
- A simple clone of Tableau. The app regularly pulls in external data and shows it on a nice dashboard.
- Demonstrates: **[jobs](https://wasp-lang.dev/docs/advanced/jobs)**, analytics
5. **thoughts**
- A simple note-taking app organized around the concept of hashtags.
- Demonstrates: [db seeding](https://wasp-lang.dev/docs/data-model/backends#seeding-the-database), [auth](https://wasp-lang.dev/docs/auth/overview), [rpc](https://wasp-lang.dev/docs/data-model/operations/overview)
6. **realworld**
- A Medium clone (https://github.com/gothinkster/realworld - the mother of all demo apps).
- Demonstrates: [auth](https://wasp-lang.dev/docs/auth/overview), [rpc](https://wasp-lang.dev/docs/data-model/operations/overview), [db seeding](https://wasp-lang.dev/docs/data-model/backends#seeding-the-database), Material UI
7. **streaming**
- Demonstrates: **http streaming**, [api](https://wasp-lang.dev/docs/advanced/apis)
8. **websockets-realtime-voting**
- Demonstrates: **[web sockets](https://wasp-lang.dev/docs/advanced/web-sockets)**, [auth](https://wasp-lang.dev/docs/auth/overview), voting system

View File

@ -1,51 +0,0 @@
-- CreateTable
CREATE TABLE "Thought" (
"id" SERIAL NOT NULL,
"textMarkdown" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Tag" (
"id" SERIAL NOT NULL,
"name" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "User" (
"id" SERIAL NOT NULL,
"email" TEXT NOT NULL,
"password" TEXT NOT NULL,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "_TagToThought" (
"A" INTEGER NOT NULL,
"B" INTEGER NOT NULL
);
-- CreateIndex
CREATE UNIQUE INDEX "Tag.name_unique" ON "Tag"("name");
-- CreateIndex
CREATE UNIQUE INDEX "User.email_unique" ON "User"("email");
-- CreateIndex
CREATE UNIQUE INDEX "_TagToThought_AB_unique" ON "_TagToThought"("A", "B");
-- CreateIndex
CREATE INDEX "_TagToThought_B_index" ON "_TagToThought"("B");
-- AddForeignKey
ALTER TABLE "_TagToThought" ADD FOREIGN KEY ("A") REFERENCES "Tag"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_TagToThought" ADD FOREIGN KEY ("B") REFERENCES "Thought"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -1,18 +0,0 @@
/*
Warnings:
- Added the required column `userId` to the `Tag` table without a default value. This is not possible if the table is not empty.
- Added the required column `userId` to the `Thought` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Tag" ADD COLUMN "userId" INTEGER NOT NULL;
-- AlterTable
ALTER TABLE "Thought" ADD COLUMN "userId" INTEGER NOT NULL;
-- AddForeignKey
ALTER TABLE "Tag" ADD FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Thought" ADD FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -1,11 +0,0 @@
/*
Warnings:
- A unique constraint covering the columns `[name,userId]` on the table `Tag` will be added. If there are existing duplicate values, this will fail.
*/
-- DropIndex
DROP INDEX "Tag.name_unique";
-- CreateIndex
CREATE UNIQUE INDEX "Tag.name_userId_unique" ON "Tag"("name", "userId");

View File

@ -1,9 +0,0 @@
-- DropIndex
DROP INDEX "User.email_unique";
-- AlterTable
ALTER TABLE "User"
RENAME COLUMN "email" TO "username";
-- CreateIndex
CREATE UNIQUE INDEX "User.username_unique" ON "User"("username");

View File

@ -1,17 +0,0 @@
-- DropForeignKey
ALTER TABLE "Tag" DROP CONSTRAINT "Tag_userId_fkey";
-- DropForeignKey
ALTER TABLE "Thought" DROP CONSTRAINT "Thought_userId_fkey";
-- AddForeignKey
ALTER TABLE "Thought" ADD CONSTRAINT "Thought_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Tag" ADD CONSTRAINT "Tag_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- RenameIndex
ALTER INDEX "Tag.name_userId_unique" RENAME TO "Tag_name_userId_key";
-- RenameIndex
ALTER INDEX "User.username_unique" RENAME TO "User_username_key";

View File

@ -1,20 +0,0 @@
import React from 'react'
import logout from '@wasp/auth/logout'
import './TopNavbar.css'
const TopNavbar = (props) => {
const user = props.user
return (
<div className="top-navbar">
{ user.username }
&nbsp;|&nbsp;
<button className="plain" onClick={logout}> logout </button>
</div>
)
}
export default TopNavbar

View File

@ -0,0 +1,21 @@
-- CreateTable
CREATE TABLE "Submission" (
"name" TEXT NOT NULL,
"email" TEXT NOT NULL,
"github" TEXT NOT NULL,
"description" TEXT NOT NULL,
"twitter" TEXT,
"country" TEXT,
"website" TEXT,
"image" TEXT,
"approved" BOOLEAN NOT NULL DEFAULT false,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Submission_pkey" PRIMARY KEY ("name")
);
-- CreateIndex
CREATE UNIQUE INDEX "Submission_name_key" ON "Submission"("name");
-- CreateIndex
CREATE UNIQUE INDEX "Submission_email_key" ON "Submission"("email");

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -80,8 +80,6 @@ psl=}
entity User {=psl
id Int @id @default(autoincrement())
username String @unique
password String
thoughts Thought[]
tags Tag[]

View File

@ -0,0 +1,81 @@
-- CreateTable
CREATE TABLE "User" (
"id" SERIAL NOT NULL,
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Thought" (
"id" SERIAL NOT NULL,
"textMarkdown" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"userId" INTEGER NOT NULL,
CONSTRAINT "Thought_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Tag" (
"id" SERIAL NOT NULL,
"name" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"userId" INTEGER NOT NULL,
CONSTRAINT "Tag_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Auth" (
"id" TEXT NOT NULL,
"userId" INTEGER,
CONSTRAINT "Auth_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "AuthIdentity" (
"providerName" TEXT NOT NULL,
"providerUserId" TEXT NOT NULL,
"providerData" TEXT NOT NULL DEFAULT '{}',
"authId" TEXT NOT NULL,
CONSTRAINT "AuthIdentity_pkey" PRIMARY KEY ("providerName","providerUserId")
);
-- CreateTable
CREATE TABLE "_TagToThought" (
"A" INTEGER NOT NULL,
"B" INTEGER NOT NULL
);
-- CreateIndex
CREATE UNIQUE INDEX "Tag_name_userId_key" ON "Tag"("name", "userId");
-- CreateIndex
CREATE UNIQUE INDEX "Auth_userId_key" ON "Auth"("userId");
-- CreateIndex
CREATE UNIQUE INDEX "_TagToThought_AB_unique" ON "_TagToThought"("A", "B");
-- CreateIndex
CREATE INDEX "_TagToThought_B_index" ON "_TagToThought"("B");
-- AddForeignKey
ALTER TABLE "Thought" ADD CONSTRAINT "Thought_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Tag" ADD CONSTRAINT "Tag_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Auth" ADD CONSTRAINT "Auth_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "AuthIdentity" ADD CONSTRAINT "AuthIdentity_authId_fkey" FOREIGN KEY ("authId") REFERENCES "Auth"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_TagToThought" ADD CONSTRAINT "_TagToThought_A_fkey" FOREIGN KEY ("A") REFERENCES "Tag"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_TagToThought" ADD CONSTRAINT "_TagToThought_B_fkey" FOREIGN KEY ("B") REFERENCES "Thought"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -0,0 +1,24 @@
import React from "react";
import logout from "@wasp/auth/logout";
import "./TopNavbar.css";
import { getUsername } from "@wasp/auth/user";
const TopNavbar = ({ user }) => {
const username = getUsername(user);
return (
<div className="top-navbar">
{username}
&nbsp;|&nbsp;
<button className="plain" onClick={logout}>
{" "}
logout{" "}
</button>
</div>
);
};
export default TopNavbar;

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -1,18 +0,0 @@
-- CreateTable
CREATE TABLE "User" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"username" TEXT NOT NULL,
"password" TEXT NOT NULL
);
-- CreateTable
CREATE TABLE "Task" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"description" TEXT NOT NULL,
"isDone" BOOLEAN NOT NULL DEFAULT false,
"userId" INTEGER NOT NULL,
CONSTRAINT "Task_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
-- CreateIndex
CREATE UNIQUE INDEX "User_username_key" ON "User"("username");

View File

@ -21,8 +21,6 @@ app TodoTypescript {
// Then run `wasp db studio` to open Prisma Studio and view your db models
entity User {=psl
id Int @id @default(autoincrement())
username String @unique
password String
tasks Task[]
psl=}

View File

@ -0,0 +1,34 @@
-- CreateTable
CREATE TABLE "User" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT
);
-- CreateTable
CREATE TABLE "Task" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"description" TEXT NOT NULL,
"isDone" BOOLEAN NOT NULL DEFAULT false,
"userId" INTEGER NOT NULL,
CONSTRAINT "Task_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
-- CreateTable
CREATE TABLE "Auth" (
"id" TEXT NOT NULL PRIMARY KEY,
"userId" INTEGER,
CONSTRAINT "Auth_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-- CreateTable
CREATE TABLE "AuthIdentity" (
"providerName" TEXT NOT NULL,
"providerUserId" TEXT NOT NULL,
"providerData" TEXT NOT NULL DEFAULT '{}',
"authId" TEXT NOT NULL,
PRIMARY KEY ("providerName", "providerUserId"),
CONSTRAINT "AuthIdentity_authId_fkey" FOREIGN KEY ("authId") REFERENCES "Auth" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-- CreateIndex
CREATE UNIQUE INDEX "Auth_userId_key" ON "Auth"("userId");

View File

@ -9,7 +9,9 @@ import getTasks from "@wasp/queries/getTasks";
import createTask from "@wasp/actions/createTask";
import updateTask from "@wasp/actions/updateTask";
import deleteTasks from "@wasp/actions/deleteTasks";
import type { Task, User } from "@wasp/entities";
import type { Task } from "@wasp/entities";
import type { User } from "@wasp/auth/types";
import { getUsername } from "@wasp/auth/user";
export const MainPage = ({ user }: { user: User }) => {
const { data: tasks, isLoading, error } = useQuery(getTasks);
@ -24,7 +26,7 @@ export const MainPage = ({ user }: { user: User }) => {
<img src={waspLogo} alt="wasp logo" />
{user && (
<h1>
{user.username}
{getUsername(user)}
{`'s tasks :)`}
</h1>
)}

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -1,41 +0,0 @@
-- CreateTable
CREATE TABLE "User" (
"id" SERIAL NOT NULL,
"email" TEXT NOT NULL,
"password" TEXT NOT NULL,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "List" (
"id" SERIAL NOT NULL,
"name" TEXT NOT NULL,
"pos" DOUBLE PRECISION NOT NULL,
"userId" INTEGER NOT NULL,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Card" (
"id" SERIAL NOT NULL,
"title" TEXT NOT NULL,
"pos" DOUBLE PRECISION NOT NULL,
"listId" INTEGER NOT NULL,
"authorId" INTEGER NOT NULL,
PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "User.email_unique" ON "User"("email");
-- AddForeignKey
ALTER TABLE "List" ADD FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Card" ADD FOREIGN KEY ("listId") REFERENCES "List"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Card" ADD FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -1,20 +0,0 @@
-- DropForeignKey
ALTER TABLE "Card" DROP CONSTRAINT "Card_authorId_fkey";
-- DropForeignKey
ALTER TABLE "Card" DROP CONSTRAINT "Card_listId_fkey";
-- DropForeignKey
ALTER TABLE "List" DROP CONSTRAINT "List_userId_fkey";
-- AddForeignKey
ALTER TABLE "List" ADD CONSTRAINT "List_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Card" ADD CONSTRAINT "Card_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Card" ADD CONSTRAINT "Card_listId_fkey" FOREIGN KEY ("listId") REFERENCES "List"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- RenameIndex
ALTER INDEX "User.email_unique" RENAME TO "User_email_key";

View File

@ -1,9 +0,0 @@
-- DropIndex
DROP INDEX "User_email_key";
-- AlterTable
ALTER TABLE "User"
RENAME COLUMN "email" TO "username";
-- CreateIndex
CREATE UNIQUE INDEX "User_username_key" ON "User"("username");

View File

@ -1,29 +0,0 @@
import React from 'react'
import logout from '@wasp/auth/logout'
import logo from './waspello-logo-navbar.svg'
import './Navbar.css'
const Navbar = ({ user }) => {
return (
<div className="navbar">
<div className='navbar-item'>
<span>Home</span>
</div>
<img alt="Waspello" className="navbar-logo navbar-item" src={logo} />
<div className='navbar-item'>
<span>
{ user.username }
&nbsp;|&nbsp;
<button className="logout-btn" onClick={logout}> logout </button>
</span>
</div>
</div>
)
}
export default Navbar

View File

@ -36,8 +36,6 @@ page LoginPage {
entity User {=psl
id Int @id @default(autoincrement())
username String @unique
password String
tasks Task[]
psl=}

View File

@ -1,18 +0,0 @@
-- CreateTable
CREATE TABLE "User" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"email" TEXT NOT NULL,
"password" TEXT NOT NULL
);
-- CreateTable
CREATE TABLE "Task" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"description" TEXT NOT NULL,
"isDone" BOOLEAN NOT NULL DEFAULT false,
"userId" INTEGER,
FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE
);
-- CreateIndex
CREATE UNIQUE INDEX "User.email_unique" ON "User"("email");

View File

@ -1,9 +0,0 @@
-- DropIndex
DROP INDEX "User.email_unique";
-- AlterTable
ALTER TABLE "User"
RENAME COLUMN "email" TO "username";
-- CreateIndex
CREATE UNIQUE INDEX "User.username_unique" ON "User"("username");

View File

@ -1,3 +0,0 @@
-- RedefineIndex
DROP INDEX "User.username_unique";
CREATE UNIQUE INDEX "User_username_key" ON "User"("username");

View File

@ -0,0 +1,39 @@
-- CreateTable
CREATE TABLE "User" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"username" TEXT NOT NULL,
"password" TEXT NOT NULL
);
-- CreateTable
CREATE TABLE "Task" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"description" TEXT NOT NULL,
"isDone" BOOLEAN NOT NULL DEFAULT false,
"userId" INTEGER,
CONSTRAINT "Task_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE
);
-- CreateTable
CREATE TABLE "Auth" (
"id" TEXT NOT NULL PRIMARY KEY,
"userId" INTEGER,
CONSTRAINT "Auth_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-- CreateTable
CREATE TABLE "AuthIdentity" (
"providerName" TEXT NOT NULL,
"providerUserId" TEXT NOT NULL,
"providerData" TEXT NOT NULL DEFAULT '{}',
"authId" TEXT NOT NULL,
PRIMARY KEY ("providerName", "providerUserId"),
CONSTRAINT "AuthIdentity_authId_fkey" FOREIGN KEY ("authId") REFERENCES "Auth" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-- CreateIndex
CREATE UNIQUE INDEX "User_username_key" ON "User"("username");
-- CreateIndex
CREATE UNIQUE INDEX "Auth_userId_key" ON "Auth"("userId");

View File

@ -0,0 +1,17 @@
/*
Warnings:
- You are about to drop the column `password` on the `User` table. All the data in the column will be lost.
- You are about to drop the column `username` on the `User` table. All the data in the column will be lost.
*/
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_User" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT
);
INSERT INTO "new_User" ("id") SELECT "id" FROM "User";
DROP TABLE "User";
ALTER TABLE "new_User" RENAME TO "User";
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;

View File

@ -36,8 +36,6 @@ page LoginPage {
entity User {=psl
id Int @id @default(autoincrement())
username String @unique
password String
tasks Task[]
psl=}

View File

@ -1,6 +0,0 @@
-- CreateTable
CREATE TABLE "Task" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"description" TEXT NOT NULL,
"isDone" BOOLEAN NOT NULL DEFAULT false
);

View File

@ -1,9 +0,0 @@
-- CreateTable
CREATE TABLE "User" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"username" TEXT NOT NULL,
"password" TEXT NOT NULL
);
-- CreateIndex
CREATE UNIQUE INDEX "User_username_key" ON "User"("username");

View File

@ -1,14 +0,0 @@
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Task" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"description" TEXT NOT NULL,
"isDone" BOOLEAN NOT NULL DEFAULT false,
"userId" INTEGER,
CONSTRAINT "Task_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE
);
INSERT INTO "new_Task" ("description", "id", "isDone") SELECT "description", "id", "isDone" FROM "Task";
DROP TABLE "Task";
ALTER TABLE "new_Task" RENAME TO "Task";
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;

View File

@ -0,0 +1,34 @@
-- CreateTable
CREATE TABLE "User" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT
);
-- CreateTable
CREATE TABLE "Task" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"description" TEXT NOT NULL,
"isDone" BOOLEAN NOT NULL DEFAULT false,
"userId" INTEGER,
CONSTRAINT "Task_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE
);
-- CreateTable
CREATE TABLE "Auth" (
"id" TEXT NOT NULL PRIMARY KEY,
"userId" INTEGER,
CONSTRAINT "Auth_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-- CreateTable
CREATE TABLE "AuthIdentity" (
"providerName" TEXT NOT NULL,
"providerUserId" TEXT NOT NULL,
"providerData" TEXT NOT NULL DEFAULT '{}',
"authId" TEXT NOT NULL,
PRIMARY KEY ("providerName", "providerUserId"),
CONSTRAINT "AuthIdentity_authId_fkey" FOREIGN KEY ("authId") REFERENCES "Auth" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-- CreateIndex
CREATE UNIQUE INDEX "Auth_userId_key" ON "Auth"("userId");

View File

@ -11,7 +11,6 @@ app waspello {
auth: {
userEntity: User,
externalAuthEntity: SocialLogin,
methods: {
usernameAndPassword: {},
google: {}
@ -47,21 +46,9 @@ page Login {
entity User {=psl
id Int @id @default(autoincrement())
username String @unique
password String
lists List[]
cards Card[]
externalAuthAssociations SocialLogin[]
psl=}
entity SocialLogin {=psl
id Int @id @default(autoincrement())
provider String
providerId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId Int
createdAt DateTime @default(now())
@@unique([provider, providerId, userId])
psl=}
entity List {=psl

View File

@ -0,0 +1,63 @@
-- CreateTable
CREATE TABLE "User" (
"id" SERIAL NOT NULL,
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "List" (
"id" SERIAL NOT NULL,
"name" TEXT NOT NULL,
"pos" DOUBLE PRECISION NOT NULL,
"userId" INTEGER NOT NULL,
CONSTRAINT "List_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Card" (
"id" SERIAL NOT NULL,
"title" TEXT NOT NULL,
"pos" DOUBLE PRECISION NOT NULL,
"listId" INTEGER NOT NULL,
"authorId" INTEGER NOT NULL,
CONSTRAINT "Card_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Auth" (
"id" TEXT NOT NULL,
"userId" INTEGER,
CONSTRAINT "Auth_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "AuthIdentity" (
"providerName" TEXT NOT NULL,
"providerUserId" TEXT NOT NULL,
"providerData" TEXT NOT NULL DEFAULT '{}',
"authId" TEXT NOT NULL,
CONSTRAINT "AuthIdentity_pkey" PRIMARY KEY ("providerName","providerUserId")
);
-- CreateIndex
CREATE UNIQUE INDEX "Auth_userId_key" ON "Auth"("userId");
-- AddForeignKey
ALTER TABLE "List" ADD CONSTRAINT "List_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Card" ADD CONSTRAINT "Card_listId_fkey" FOREIGN KEY ("listId") REFERENCES "List"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Card" ADD CONSTRAINT "Card_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Auth" ADD CONSTRAINT "Auth_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "AuthIdentity" ADD CONSTRAINT "AuthIdentity_authId_fkey" FOREIGN KEY ("authId") REFERENCES "Auth"("id") ON DELETE CASCADE ON UPDATE CASCADE;

Some files were not shown because too many files have changed in this diff Show More