Update redwood version 0.20.0 to 0.26.0 #216

Merged
Irev-Dev merged 7 commits from kurt/issue-214-update-redwood-version into main 2021-02-28 10:46:31 +01:00
36 changed files with 1368 additions and 2344 deletions

View File

@@ -27,17 +27,16 @@ Install dependencies
yarn install
```
Initialise the db
``` terminal
yarn rw db up
yarn rw db seed
```
Setting up the db, you'll need to have a postgres installed locally, you can [follow this guide](https://redwoodjs.com/docs/local-postgres-setup) with a couple of exceptions:
- Run `yarn rw prisma migrate dev` instead of `yarn rw db up` in the guide.
- Don't worry about changing the `schema.prisma` file.
- You will need to add a `DATABASE_URL` and test url to you `.env` file at the root of the project.
Move some files to the public directory
Run the following
``` terminal
yarn rw prisma migrate dev
yarn rw prisma db seed
```
yarn move-cad-worker
```
The above step should be repeated whenever you modify anything in the git submodule `web/src/cascade/*`
### Fire up dev
```terminal

View File

@@ -0,0 +1,94 @@
-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL,
"userName" TEXT NOT NULL,
"email" TEXT NOT NULL,
"name" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"image" TEXT,
"bio" TEXT,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Part" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"description" TEXT,
"code" TEXT,
"mainImage" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"userId" TEXT NOT NULL,
"deleted" BOOLEAN NOT NULL DEFAULT false,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "PartReaction" (
"id" TEXT NOT NULL,
"emote" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"partId" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Comment" (
"id" TEXT NOT NULL,
"text" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"partId" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "SubjectAccessRequest" (
"id" TEXT NOT NULL,
"comment" TEXT NOT NULL,
"payload" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "User.userName_unique" ON "User"("userName");
-- CreateIndex
CREATE UNIQUE INDEX "User.email_unique" ON "User"("email");
-- CreateIndex
CREATE UNIQUE INDEX "Part.title_userId_unique" ON "Part"("title", "userId");
-- CreateIndex
CREATE UNIQUE INDEX "PartReaction.emote_userId_partId_unique" ON "PartReaction"("emote", "userId", "partId");
-- AddForeignKey
ALTER TABLE "Part" ADD FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "PartReaction" ADD FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "PartReaction" ADD FOREIGN KEY ("partId") REFERENCES "Part"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Comment" ADD FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Comment" ADD FOREIGN KEY ("partId") REFERENCES "Part"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "SubjectAccessRequest" ADD FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@@ -0,0 +1,2 @@
# Please do not edit this file manually
provider = "postgresql"

View File

@@ -1,11 +1,11 @@
datasource DS {
provider = ["sqlite", "postgresql"]
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "rhel-openssl-1.0.x"]
binaryTargets = "native"
}
// sqlLight does not suport enums so we can't use enums until we set up postgresql in dev mode

View File

@@ -87,7 +87,7 @@ async function main() {
const aPart = await db.part.findOne({where: {
const aPart = await db.part.findUnique({where: {
title_userId: {
title: parts[0].title,
userId: users[0].id,

View File

@@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@redwoodjs/api": "^0.20.0",
"@redwoodjs/api": "^0.26.2",
"cloudinary": "^1.23.0"
}
}

View File

@@ -1,158 +0,0 @@
# Migration `20201101183848-db-init`
This migration has been generated by Kurt Hutten at 11/2/2020, 5:38:48 AM.
You can check out the [state of the schema](./schema.prisma) after the migration.
## Database Steps
```sql
CREATE TABLE "User" (
"id" TEXT NOT NULL,
"userName" TEXT NOT NULL,
"email" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
"image" TEXT,
"bio" TEXT,
PRIMARY KEY ("id")
)
CREATE TABLE "Part" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"description" TEXT,
"code" TEXT,
"mainImage" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
"userId" TEXT NOT NULL,
FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY ("id")
)
CREATE TABLE "PartReaction" (
"id" TEXT NOT NULL,
"emote" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"partId" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY ("partId") REFERENCES "Part"("id") ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY ("id")
)
CREATE TABLE "Comment" (
"id" TEXT NOT NULL,
"text" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"partId" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY ("partId") REFERENCES "Part"("id") ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY ("id")
)
CREATE UNIQUE INDEX "User.userName_unique" ON "User"("userName")
CREATE UNIQUE INDEX "User.email_unique" ON "User"("email")
CREATE UNIQUE INDEX "Part.title_userId_unique" ON "Part"("title", "userId")
CREATE UNIQUE INDEX "PartReaction.emote_userId_partId_unique" ON "PartReaction"("emote", "userId", "partId")
```
## Changes
```diff
diff --git schema.prisma schema.prisma
migration ..20201101183848-db-init
--- datamodel.dml
+++ datamodel.dml
@@ -1,0 +1,79 @@
+datasource DS {
+ provider = ["sqlite", "postgresql"]
+ url = "***"
+}
+
+generator client {
+ provider = "prisma-client-js"
+ binaryTargets = "native"
+}
+
+// sqlLight does not suport enums so we can't use enums until we set up postgresql in dev mode
+// enum Role {
+// USER
+// ADMIN
+// }
+
+// enum PartType {
+// CASCADESTUDIO
+// JSCAD
+// }
+
+model User {
+ id String @id @default(uuid())
+ userName String @unique // reffered to as userId in @relations
+ email String @unique
+ // role should probably be a list [] and also use enums, neither are supported by sqllight, so we need to set up postgresql in dev
+ // maybe let netlify handle roles for now.
+ // role String @default("user")
+
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+
+ image String? // url maybe id or file storage service? cloudinary?
+ bio String? //mark down
+ Part Part[]
+ Reaction PartReaction[]
+ Comment Comment[]
+}
+
+model Part {
+ id String @id @default(uuid())
+ title String
+ description String? // markdown string
+ code String?
+ mainImage String? // link to cloudinary
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ user User @relation(fields: [userId], references: [id])
+ userId String
+
+ Comment Comment[]
+ Reaction PartReaction[]
+ @@unique([title, userId])
+}
+
+model PartReaction {
+ id String @id @default(uuid())
+ emote String // an emoji
+ user User @relation(fields: [userId], references: [id])
+ userId String
+ part Part @relation(fields: [partId], references: [id])
+ partId String
+
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ @@unique([emote, userId, partId])
+}
+
+model Comment {
+ id String @id @default(uuid())
+ text String // the comment, should I allow mark down?
+ user User @relation(fields: [userId], references: [id])
+ userId String
+ part Part @relation(fields: [partId], references: [id])
+ partId String
+
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+}
```

View File

@@ -1,79 +0,0 @@
datasource DS {
provider = ["sqlite", "postgresql"]
url = "***"
}
generator client {
provider = "prisma-client-js"
binaryTargets = "native"
}
// sqlLight does not suport enums so we can't use enums until we set up postgresql in dev mode
// enum Role {
// USER
// ADMIN
// }
// enum PartType {
// CASCADESTUDIO
// JSCAD
// }
model User {
id String @id @default(uuid())
userName String @unique // reffered to as userId in @relations
email String @unique
// role should probably be a list [] and also use enums, neither are supported by sqllight, so we need to set up postgresql in dev
// maybe let netlify handle roles for now.
// role String @default("user")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
image String? // url maybe id or file storage service? cloudinary?
bio String? //mark down
Part Part[]
Reaction PartReaction[]
Comment Comment[]
}
model Part {
id String @id @default(uuid())
title String
description String? // markdown string
code String?
mainImage String? // link to cloudinary
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id])
userId String
Comment Comment[]
Reaction PartReaction[]
@@unique([title, userId])
}
model PartReaction {
id String @id @default(uuid())
emote String // an emoji
user User @relation(fields: [userId], references: [id])
userId String
part Part @relation(fields: [partId], references: [id])
partId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([emote, userId, partId])
}
model Comment {
id String @id @default(uuid())
text String // the comment, should I allow mark down?
user User @relation(fields: [userId], references: [id])
userId String
part Part @relation(fields: [partId], references: [id])
partId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

View File

@@ -1,839 +0,0 @@
{
"version": "0.3.14-fixed",
"steps": [
{
"tag": "CreateSource",
"source": "DS"
},
{
"tag": "CreateArgument",
"location": {
"tag": "Source",
"source": "DS"
},
"argument": "provider",
"value": "[\"sqlite\", \"postgresql\"]"
},
{
"tag": "CreateArgument",
"location": {
"tag": "Source",
"source": "DS"
},
"argument": "url",
"value": "\"***\""
},
{
"tag": "CreateModel",
"model": "User"
},
{
"tag": "CreateField",
"model": "User",
"field": "id",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "User",
"field": "id"
},
"directive": "id"
}
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "User",
"field": "id"
},
"directive": "default"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "User",
"field": "id"
},
"directive": "default"
},
"argument": "",
"value": "uuid()"
},
{
"tag": "CreateField",
"model": "User",
"field": "userName",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "User",
"field": "userName"
},
"directive": "unique"
}
},
{
"tag": "CreateField",
"model": "User",
"field": "email",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "User",
"field": "email"
},
"directive": "unique"
}
},
{
"tag": "CreateField",
"model": "User",
"field": "createdAt",
"type": "DateTime",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "User",
"field": "createdAt"
},
"directive": "default"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "User",
"field": "createdAt"
},
"directive": "default"
},
"argument": "",
"value": "now()"
},
{
"tag": "CreateField",
"model": "User",
"field": "updatedAt",
"type": "DateTime",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "User",
"field": "updatedAt"
},
"directive": "updatedAt"
}
},
{
"tag": "CreateField",
"model": "User",
"field": "image",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "User",
"field": "bio",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "User",
"field": "Part",
"type": "Part",
"arity": "List"
},
{
"tag": "CreateField",
"model": "User",
"field": "Reaction",
"type": "PartReaction",
"arity": "List"
},
{
"tag": "CreateField",
"model": "User",
"field": "Comment",
"type": "Comment",
"arity": "List"
},
{
"tag": "CreateModel",
"model": "Part"
},
{
"tag": "CreateField",
"model": "Part",
"field": "id",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Part",
"field": "id"
},
"directive": "id"
}
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Part",
"field": "id"
},
"directive": "default"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "Part",
"field": "id"
},
"directive": "default"
},
"argument": "",
"value": "uuid()"
},
{
"tag": "CreateField",
"model": "Part",
"field": "title",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "Part",
"field": "description",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "Part",
"field": "code",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "Part",
"field": "mainImage",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "Part",
"field": "createdAt",
"type": "DateTime",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Part",
"field": "createdAt"
},
"directive": "default"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "Part",
"field": "createdAt"
},
"directive": "default"
},
"argument": "",
"value": "now()"
},
{
"tag": "CreateField",
"model": "Part",
"field": "updatedAt",
"type": "DateTime",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Part",
"field": "updatedAt"
},
"directive": "updatedAt"
}
},
{
"tag": "CreateField",
"model": "Part",
"field": "user",
"type": "User",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Part",
"field": "user"
},
"directive": "relation"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "Part",
"field": "user"
},
"directive": "relation"
},
"argument": "fields",
"value": "[userId]"
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "Part",
"field": "user"
},
"directive": "relation"
},
"argument": "references",
"value": "[id]"
},
{
"tag": "CreateField",
"model": "Part",
"field": "userId",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "Part",
"field": "Comment",
"type": "Comment",
"arity": "List"
},
{
"tag": "CreateField",
"model": "Part",
"field": "Reaction",
"type": "PartReaction",
"arity": "List"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Model",
"model": "Part",
"arguments": [
{
"name": "",
"value": "[title, userId]"
}
]
},
"directive": "unique"
}
},
{
"tag": "CreateModel",
"model": "PartReaction"
},
{
"tag": "CreateField",
"model": "PartReaction",
"field": "id",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "PartReaction",
"field": "id"
},
"directive": "id"
}
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "PartReaction",
"field": "id"
},
"directive": "default"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "PartReaction",
"field": "id"
},
"directive": "default"
},
"argument": "",
"value": "uuid()"
},
{
"tag": "CreateField",
"model": "PartReaction",
"field": "emote",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "PartReaction",
"field": "user",
"type": "User",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "PartReaction",
"field": "user"
},
"directive": "relation"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "PartReaction",
"field": "user"
},
"directive": "relation"
},
"argument": "fields",
"value": "[userId]"
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "PartReaction",
"field": "user"
},
"directive": "relation"
},
"argument": "references",
"value": "[id]"
},
{
"tag": "CreateField",
"model": "PartReaction",
"field": "userId",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "PartReaction",
"field": "part",
"type": "Part",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "PartReaction",
"field": "part"
},
"directive": "relation"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "PartReaction",
"field": "part"
},
"directive": "relation"
},
"argument": "fields",
"value": "[partId]"
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "PartReaction",
"field": "part"
},
"directive": "relation"
},
"argument": "references",
"value": "[id]"
},
{
"tag": "CreateField",
"model": "PartReaction",
"field": "partId",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "PartReaction",
"field": "createdAt",
"type": "DateTime",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "PartReaction",
"field": "createdAt"
},
"directive": "default"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "PartReaction",
"field": "createdAt"
},
"directive": "default"
},
"argument": "",
"value": "now()"
},
{
"tag": "CreateField",
"model": "PartReaction",
"field": "updatedAt",
"type": "DateTime",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "PartReaction",
"field": "updatedAt"
},
"directive": "updatedAt"
}
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Model",
"model": "PartReaction",
"arguments": [
{
"name": "",
"value": "[emote, userId, partId]"
}
]
},
"directive": "unique"
}
},
{
"tag": "CreateModel",
"model": "Comment"
},
{
"tag": "CreateField",
"model": "Comment",
"field": "id",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Comment",
"field": "id"
},
"directive": "id"
}
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Comment",
"field": "id"
},
"directive": "default"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "Comment",
"field": "id"
},
"directive": "default"
},
"argument": "",
"value": "uuid()"
},
{
"tag": "CreateField",
"model": "Comment",
"field": "text",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "Comment",
"field": "user",
"type": "User",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Comment",
"field": "user"
},
"directive": "relation"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "Comment",
"field": "user"
},
"directive": "relation"
},
"argument": "fields",
"value": "[userId]"
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "Comment",
"field": "user"
},
"directive": "relation"
},
"argument": "references",
"value": "[id]"
},
{
"tag": "CreateField",
"model": "Comment",
"field": "userId",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "Comment",
"field": "part",
"type": "Part",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Comment",
"field": "part"
},
"directive": "relation"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "Comment",
"field": "part"
},
"directive": "relation"
},
"argument": "fields",
"value": "[partId]"
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "Comment",
"field": "part"
},
"directive": "relation"
},
"argument": "references",
"value": "[id]"
},
{
"tag": "CreateField",
"model": "Comment",
"field": "partId",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "Comment",
"field": "createdAt",
"type": "DateTime",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Comment",
"field": "createdAt"
},
"directive": "default"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "Comment",
"field": "createdAt"
},
"directive": "default"
},
"argument": "",
"value": "now()"
},
{
"tag": "CreateField",
"model": "Comment",
"field": "updatedAt",
"type": "DateTime",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Comment",
"field": "updatedAt"
},
"directive": "updatedAt"
}
}
]
}

View File

@@ -1,43 +0,0 @@
# Migration `20201105184423-add-name-to-user`
This migration has been generated by Kurt Hutten at 11/6/2020, 5:44:24 AM.
You can check out the [state of the schema](./schema.prisma) after the migration.
## Database Steps
```sql
ALTER TABLE "User" ADD COLUMN "name" TEXT
```
## Changes
```diff
diff --git schema.prisma schema.prisma
migration 20201101183848-db-init..20201105184423-add-name-to-user
--- datamodel.dml
+++ datamodel.dml
@@ -1,7 +1,7 @@
datasource DS {
provider = ["sqlite", "postgresql"]
- url = "***"
+ url = "***"
}
generator client {
provider = "prisma-client-js"
@@ -19,11 +19,12 @@
// JSCAD
// }
model User {
- id String @id @default(uuid())
- userName String @unique // reffered to as userId in @relations
- email String @unique
+ id String @id @default(uuid())
+ userName String @unique // reffered to as userId in @relations
+ email String @unique
+ name String?
// role should probably be a list [] and also use enums, neither are supported by sqllight, so we need to set up postgresql in dev
// maybe let netlify handle roles for now.
// role String @default("user")
```

View File

@@ -1,80 +0,0 @@
datasource DS {
provider = ["sqlite", "postgresql"]
url = "***"
}
generator client {
provider = "prisma-client-js"
binaryTargets = "native"
}
// sqlLight does not suport enums so we can't use enums until we set up postgresql in dev mode
// enum Role {
// USER
// ADMIN
// }
// enum PartType {
// CASCADESTUDIO
// JSCAD
// }
model User {
id String @id @default(uuid())
userName String @unique // reffered to as userId in @relations
email String @unique
name String?
// role should probably be a list [] and also use enums, neither are supported by sqllight, so we need to set up postgresql in dev
// maybe let netlify handle roles for now.
// role String @default("user")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
image String? // url maybe id or file storage service? cloudinary?
bio String? //mark down
Part Part[]
Reaction PartReaction[]
Comment Comment[]
}
model Part {
id String @id @default(uuid())
title String
description String? // markdown string
code String?
mainImage String? // link to cloudinary
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id])
userId String
Comment Comment[]
Reaction PartReaction[]
@@unique([title, userId])
}
model PartReaction {
id String @id @default(uuid())
emote String // an emoji
user User @relation(fields: [userId], references: [id])
userId String
part Part @relation(fields: [partId], references: [id])
partId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([emote, userId, partId])
}
model Comment {
id String @id @default(uuid())
text String // the comment, should I allow mark down?
user User @relation(fields: [userId], references: [id])
userId String
part Part @relation(fields: [partId], references: [id])
partId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

View File

@@ -1,12 +0,0 @@
{
"version": "0.3.14-fixed",
"steps": [
{
"tag": "CreateField",
"model": "User",
"field": "name",
"type": "String",
"arity": "Optional"
}
]
}

View File

@@ -1,63 +0,0 @@
# Migration `20201213004819-add-delete-on-part`
This migration has been generated by Kurt Hutten at 12/13/2020, 11:48:20 AM.
You can check out the [state of the schema](./schema.prisma) after the migration.
## Database Steps
```sql
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Part" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"description" TEXT,
"code" TEXT,
"mainImage" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
"userId" TEXT NOT NULL,
"deleted" BOOLEAN NOT NULL DEFAULT false,
FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY ("id")
);
INSERT INTO "new_Part" ("id", "title", "description", "code", "mainImage", "createdAt", "updatedAt", "userId") SELECT "id", "title", "description", "code", "mainImage", "createdAt", "updatedAt", "userId" FROM "Part";
DROP TABLE "Part";
ALTER TABLE "new_Part" RENAME TO "Part";
CREATE UNIQUE INDEX "Part.title_userId_unique" ON "Part"("title", "userId");
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON
```
## Changes
```diff
diff --git schema.prisma schema.prisma
migration 20201105184423-add-name-to-user..20201213004819-add-delete-on-part
--- datamodel.dml
+++ datamodel.dml
@@ -1,12 +1,12 @@
datasource DS {
provider = ["sqlite", "postgresql"]
- url = "***"
+ url = "***"
}
generator client {
provider = "prisma-client-js"
- binaryTargets = "native"
+ binaryTargets = ["native", "rhel-openssl-1.0.x"]
}
// sqlLight does not suport enums so we can't use enums until we set up postgresql in dev mode
// enum Role {
@@ -47,8 +47,9 @@
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id])
userId String
+ deleted Boolean @default(false)
Comment Comment[]
Reaction PartReaction[]
@@unique([title, userId])
```

View File

@@ -1,81 +0,0 @@
datasource DS {
provider = ["sqlite", "postgresql"]
url = "***"
}
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "rhel-openssl-1.0.x"]
}
// sqlLight does not suport enums so we can't use enums until we set up postgresql in dev mode
// enum Role {
// USER
// ADMIN
// }
// enum PartType {
// CASCADESTUDIO
// JSCAD
// }
model User {
id String @id @default(uuid())
userName String @unique // reffered to as userId in @relations
email String @unique
name String?
// role should probably be a list [] and also use enums, neither are supported by sqllight, so we need to set up postgresql in dev
// maybe let netlify handle roles for now.
// role String @default("user")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
image String? // url maybe id or file storage service? cloudinary?
bio String? //mark down
Part Part[]
Reaction PartReaction[]
Comment Comment[]
}
model Part {
id String @id @default(uuid())
title String
description String? // markdown string
code String?
mainImage String? // link to cloudinary
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id])
userId String
deleted Boolean @default(false)
Comment Comment[]
Reaction PartReaction[]
@@unique([title, userId])
}
model PartReaction {
id String @id @default(uuid())
emote String // an emoji
user User @relation(fields: [userId], references: [id])
userId String
part Part @relation(fields: [partId], references: [id])
partId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([emote, userId, partId])
}
model Comment {
id String @id @default(uuid())
text String // the comment, should I allow mark down?
user User @relation(fields: [userId], references: [id])
userId String
part Part @relation(fields: [partId], references: [id])
partId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

View File

@@ -1,37 +0,0 @@
{
"version": "0.3.14-fixed",
"steps": [
{
"tag": "CreateField",
"model": "Part",
"field": "deleted",
"type": "Boolean",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Part",
"field": "deleted"
},
"directive": "default"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "Part",
"field": "deleted"
},
"directive": "default"
},
"argument": "",
"value": "false"
}
]
}

View File

@@ -1,71 +0,0 @@
# Migration `20201227195638-add-subject-access-request-table`
This migration has been generated by Kurt Hutten at 12/28/2020, 6:56:38 AM.
You can check out the [state of the schema](./schema.prisma) after the migration.
## Database Steps
```sql
CREATE TABLE "SubjectAccessRequest" (
"id" TEXT NOT NULL,
"comment" TEXT NOT NULL,
"payload" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY ("id")
)
```
## Changes
```diff
diff --git schema.prisma schema.prisma
migration 20201213004819-add-delete-on-part..20201227195638-add-subject-access-request-table
--- datamodel.dml
+++ datamodel.dml
@@ -1,7 +1,7 @@
datasource DS {
provider = ["sqlite", "postgresql"]
- url = "***"
+ url = "***"
}
generator client {
provider = "prisma-client-js"
@@ -30,13 +30,14 @@
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
- image String? // url maybe id or file storage service? cloudinary?
- bio String? //mark down
- Part Part[]
- Reaction PartReaction[]
- Comment Comment[]
+ image String? // url maybe id or file storage service? cloudinary?
+ bio String? //mark down
+ Part Part[]
+ Reaction PartReaction[]
+ Comment Comment[]
+ SubjectAccessRequest SubjectAccessRequest[]
}
model Part {
id String @id @default(uuid())
@@ -78,4 +79,15 @@
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
+
+model SubjectAccessRequest {
+ id String @id @default(uuid())
+ comment String
+ payload String // json dump
+ user User @relation(fields: [userId], references: [id])
+ userId String
+
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+}
```

View File

@@ -1,93 +0,0 @@
datasource DS {
provider = ["sqlite", "postgresql"]
url = "***"
}
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "rhel-openssl-1.0.x"]
}
// sqlLight does not suport enums so we can't use enums until we set up postgresql in dev mode
// enum Role {
// USER
// ADMIN
// }
// enum PartType {
// CASCADESTUDIO
// JSCAD
// }
model User {
id String @id @default(uuid())
userName String @unique // reffered to as userId in @relations
email String @unique
name String?
// role should probably be a list [] and also use enums, neither are supported by sqllight, so we need to set up postgresql in dev
// maybe let netlify handle roles for now.
// role String @default("user")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
image String? // url maybe id or file storage service? cloudinary?
bio String? //mark down
Part Part[]
Reaction PartReaction[]
Comment Comment[]
SubjectAccessRequest SubjectAccessRequest[]
}
model Part {
id String @id @default(uuid())
title String
description String? // markdown string
code String?
mainImage String? // link to cloudinary
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id])
userId String
deleted Boolean @default(false)
Comment Comment[]
Reaction PartReaction[]
@@unique([title, userId])
}
model PartReaction {
id String @id @default(uuid())
emote String // an emoji
user User @relation(fields: [userId], references: [id])
userId String
part Part @relation(fields: [partId], references: [id])
partId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([emote, userId, partId])
}
model Comment {
id String @id @default(uuid())
text String // the comment, should I allow mark down?
user User @relation(fields: [userId], references: [id])
userId String
part Part @relation(fields: [partId], references: [id])
partId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model SubjectAccessRequest {
id String @id @default(uuid())
comment String
payload String // json dump
user User @relation(fields: [userId], references: [id])
userId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

View File

@@ -1,176 +0,0 @@
{
"version": "0.3.14-fixed",
"steps": [
{
"tag": "CreateModel",
"model": "SubjectAccessRequest"
},
{
"tag": "CreateField",
"model": "SubjectAccessRequest",
"field": "id",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "SubjectAccessRequest",
"field": "id"
},
"directive": "id"
}
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "SubjectAccessRequest",
"field": "id"
},
"directive": "default"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "SubjectAccessRequest",
"field": "id"
},
"directive": "default"
},
"argument": "",
"value": "uuid()"
},
{
"tag": "CreateField",
"model": "SubjectAccessRequest",
"field": "comment",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "SubjectAccessRequest",
"field": "payload",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "SubjectAccessRequest",
"field": "user",
"type": "User",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "SubjectAccessRequest",
"field": "user"
},
"directive": "relation"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "SubjectAccessRequest",
"field": "user"
},
"directive": "relation"
},
"argument": "fields",
"value": "[userId]"
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "SubjectAccessRequest",
"field": "user"
},
"directive": "relation"
},
"argument": "references",
"value": "[id]"
},
{
"tag": "CreateField",
"model": "SubjectAccessRequest",
"field": "userId",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "SubjectAccessRequest",
"field": "createdAt",
"type": "DateTime",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "SubjectAccessRequest",
"field": "createdAt"
},
"directive": "default"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "SubjectAccessRequest",
"field": "createdAt"
},
"directive": "default"
},
"argument": "",
"value": "now()"
},
{
"tag": "CreateField",
"model": "SubjectAccessRequest",
"field": "updatedAt",
"type": "DateTime",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "SubjectAccessRequest",
"field": "updatedAt"
},
"directive": "updatedAt"
}
},
{
"tag": "CreateField",
"model": "User",
"field": "SubjectAccessRequest",
"type": "SubjectAccessRequest",
"arity": "List"
}
]
}

View File

@@ -1,6 +0,0 @@
# Prisma Migrate lockfile v1
20201101183848-db-init
20201105184423-add-name-to-user
20201213004819-add-delete-on-part
20201227195638-add-subject-access-request-table

View File

@@ -59,7 +59,7 @@ export const handler = async (req, _context) => {
if (eventType === 'signup') {
roles.push('user')
const isUniqueCallback = async (seed) =>
db.user.findOne({
db.user.findUnique({
where: { userName: seed },
})
const userNameSeed = enforceAlphaNumeric(user?.user_metadata?.userName)

View File

@@ -2,7 +2,7 @@
// to return a real user from your database, you could do something like:
//
// export const getCurrentUser = async ({ email }) => {
// return await db.user.findOne({ where: { email } })
// return await db.user.findUnique({ where: { email } })
// }
//
// If you want to enforce role-based access ...
@@ -67,7 +67,7 @@ import { AuthenticationError, ForbiddenError, parseJWT } from '@redwoodjs/api'
* @example - No role-based access control.
*
* export const getCurrentUser = async (decoded) => {
* return await db.user.findOne({ where: { decoded.email } })
* return await db.user.findUnique({ where: { decoded.email } })
* }
*
* @example - User info is contained in the decoded token and roles extracted
@@ -79,7 +79,7 @@ import { AuthenticationError, ForbiddenError, parseJWT } from '@redwoodjs/api'
* @example - User record query by email with namespaced app_metadata roles
*
* export const getCurrentUser = async (decoded) => {
* const currentUser = await db.user.findOne({ where: { email: decoded.email } })
* const currentUser = await db.user.findUnique({ where: { email: decoded.email } })
*
* return {
* ...currentUser,
@@ -90,7 +90,7 @@ import { AuthenticationError, ForbiddenError, parseJWT } from '@redwoodjs/api'
* @example - User record query by an identity with app_metadata roles
*
* const getCurrentUser = async (decoded) => {
* const currentUser = await db.user.findOne({ where: { userIdentity: decoded.sub } })
* const currentUser = await db.user.findUnique({ where: { userIdentity: decoded.sub } })
* return {
* ...currentUser,
* roles: parseJWT({ decoded: decoded }).roles,

View File

@@ -21,7 +21,7 @@ export const requireOwnership = async ({ userId, userName, partId } = {}) => {
}
if (userName) {
const user = await db.user.findOne({
const user = await db.user.findUnique({
where: { userName },
})
@@ -32,7 +32,7 @@ export const requireOwnership = async ({ userId, userName, partId } = {}) => {
if (partId) {
const user = await db.part
.findOne({
.findUnique({
where: { id: partId },
})
.user()

View File

@@ -6,7 +6,7 @@ export const comments = () => {
}
export const comment = ({ id }) => {
return db.comment.findOne({
return db.comment.findUnique({
where: { id },
})
}
@@ -32,7 +32,7 @@ export const deleteComment = ({ id }) => {
export const Comment = {
user: (_obj, { root }) =>
db.comment.findOne({ where: { id: root.id } }).user(),
db.comment.findUnique({ where: { id: root.id } }).user(),
part: (_obj, { root }) =>
db.comment.findOne({ where: { id: root.id } }).part(),
db.comment.findUnique({ where: { id: root.id } }).part(),
}

View File

@@ -10,7 +10,7 @@ export const partReactions = () => {
}
export const partReaction = ({ id }) => {
return db.partReaction.findOne({
return db.partReaction.findUnique({
where: { id },
})
}
@@ -62,7 +62,7 @@ export const deletePartReaction = ({ id }) => {
export const PartReaction = {
user: (_obj, { root }) =>
db.partReaction.findOne({ where: { id: root.id } }).user(),
db.partReaction.findUnique({ where: { id: root.id } }).user(),
part: (_obj, { root }) =>
db.partReaction.findOne({ where: { id: root.id } }).part(),
db.partReaction.findUnique({ where: { id: root.id } }).part(),
}

View File

@@ -23,17 +23,17 @@ export const parts = ({ userName }) => {
}
export const part = ({ id }) => {
return db.part.findOne({
return db.part.findUnique({
where: { id },
})
}
export const partByUserAndTitle = async ({ userName, partTitle }) => {
const user = await db.user.findOne({
const user = await db.user.findUnique({
where: {
userName,
},
})
return db.part.findOne({
return db.part.findUnique({
where: {
title_userId: {
title: partTitle,
@@ -54,7 +54,7 @@ export const forkPart = async ({ input }) => {
// Only difference between create and fork part is that fork part will generate a unique title
// (for the user) if there is a conflict
const isUniqueCallback = async (seed) =>
db.part.findOne({
db.part.findUnique({
where: {
title_userId: {
title: seed,
@@ -75,7 +75,7 @@ export const updatePart = async ({ id, input }) => {
if (input.title) {
input.title = enforceAlphaNumeric(input.title)
}
const originalPart = await db.part.findOne({ where: { id } })
const originalPart = await db.part.findUnique({ where: { id } })
const imageToDestroy =
originalPart.mainImage !== input.mainImage && originalPart.mainImage
const update = await db.part.update({
@@ -102,11 +102,12 @@ export const deletePart = async ({ id }) => {
}
export const Part = {
user: (_obj, { root }) => db.part.findOne({ where: { id: root.id } }).user(),
user: (_obj, { root }) =>
db.part.findUnique({ where: { id: root.id } }).user(),
Comment: (_obj, { root }) =>
db.part.findOne({ where: { id: root.id } }).Comment(),
db.part.findUnique({ where: { id: root.id } }).Comment(),
Reaction: (_obj, { root }) =>
db.part
.findOne({ where: { id: root.id } })
.findUnique({ where: { id: root.id } })
.Reaction({ where: { userId: _obj.userId } }),
}

View File

@@ -9,7 +9,7 @@ export const subjectAccessRequests = () => {
export const subjectAccessRequest = ({ id }) => {
requireAuth({ role: 'admin' })
return db.subjectAccessRequest.findOne({
return db.subjectAccessRequest.findUnique({
where: { id },
})
}
@@ -38,5 +38,5 @@ export const deleteSubjectAccessRequest = ({ id }) => {
export const SubjectAccessRequest = {
user: (_obj, { root }) =>
db.subjectAccessRequest.findOne({ where: { id: root.id } }).user(),
db.subjectAccessRequest.findUnique({ where: { id: root.id } }).user(),
}

View File

@@ -10,13 +10,13 @@ export const users = () => {
}
export const user = ({ id }) => {
return db.user.findOne({
return db.user.findUnique({
where: { id },
})
}
export const userName = ({ userName }) => {
return db.user.findOne({
return db.user.findUnique({
where: { userName },
})
}
@@ -51,7 +51,7 @@ export const updateUserByUserName = async ({ userName, input }) => {
`You've tried to used a protected word as you userName, try something other than `
)
}
const originalPart = await db.user.findOne({ where: { userName } })
const originalPart = await db.user.findUnique({ where: { userName } })
const imageToDestroy =
originalPart.image !== input.image && originalPart.image
const update = await db.user.update({
@@ -73,10 +73,11 @@ export const deleteUser = ({ id }) => {
}
export const User = {
Parts: (_obj, { root }) => db.user.findOne({ where: { id: root.id } }).Part(),
Parts: (_obj, { root }) =>
db.user.findUnique({ where: { id: root.id } }).Part(),
Part: (_obj, { root }) =>
_obj.partTitle &&
db.part.findOne({
db.part.findUnique({
where: {
title_userId: {
title: _obj.partTitle,
@@ -85,9 +86,9 @@ export const User = {
},
}),
Reaction: (_obj, { root }) =>
db.user.findOne({ where: { id: root.id } }).Reaction(),
db.user.findUnique({ where: { id: root.id } }).Reaction(),
Comment: (_obj, { root }) =>
db.user.findOne({ where: { id: root.id } }).Comment(),
db.user.findUnique({ where: { id: root.id } }).Comment(),
SubjectAccessRequest: (_obj, { root }) =>
db.user.findOne({ where: { id: root.id } }).SubjectAccessRequest(),
db.user.findUnique({ where: { id: root.id } }).SubjectAccessRequest(),
}

View File

@@ -1,5 +1,5 @@
[build]
command = "yarn rw build && yarn rw db up --no-db-client --auto-approve && yarn rw dataMigrate up"
command = "yarn rw deploy netlify"
publish = "web/dist"
functions = "api/dist/functions"

View File

@@ -6,10 +6,9 @@
"web"
]
},
"scripts": {
},
"scripts": {},
"devDependencies": {
"@redwoodjs/core": "^0.20.0"
"@redwoodjs/core": "^0.26.2"
},
"eslintConfig": {
"extends": "@redwoodjs/eslint-config"

View File

@@ -9,8 +9,9 @@
port = 8910
apiProxyPath = "/.netlify/functions"
includeEnvironmentVariables = ['GOOGLE_ANALYTICS_ID', 'CLOUDINARY_API_KEY', 'CLOUDINARY_API_SECRET']
experimentalFastRefresh = true
# experimentalFastRefresh = true # this seems to break cascadeStudio
[api]
port = 8911
schemaPath = "./api/db/schema.prisma"
[browser]
open = true

View File

@@ -14,10 +14,10 @@
},
"dependencies": {
"@material-ui/core": "^4.11.0",
"@redwoodjs/auth": "^0.21.0",
"@redwoodjs/forms": "^0.20.0",
"@redwoodjs/router": "^0.20.0",
"@redwoodjs/web": "^0.20.0",
"@redwoodjs/auth": "^0.26.2",
"@redwoodjs/forms": "^0.26.2",
"@redwoodjs/router": "^0.26.2",
"@redwoodjs/web": "^0.26.2",
"cloudinary-react": "^1.6.7",
"controlkit": "^0.1.9",
"get-active-classes": "^0.0.11",

View File

@@ -1,8 +1,8 @@
import { AuthProvider } from '@redwoodjs/auth'
import GoTrue from 'gotrue-js'
import ReactDOM from 'react-dom'
import { RedwoodProvider, FatalErrorBoundary } from '@redwoodjs/web'
import { FatalErrorBoundary } from '@redwoodjs/web'
import { RedwoodApolloProvider } from '@redwoodjs/web/apollo'
import FatalErrorPage from 'src/pages/FatalErrorPage'
import ReactGA from 'react-ga'
@@ -18,13 +18,14 @@ const goTrueClient = new GoTrue({
setCookie: true,
})
ReactDOM.render(
const App = () => (
<FatalErrorBoundary page={FatalErrorPage}>
<AuthProvider client={goTrueClient} type="goTrue">
<RedwoodProvider>
<RedwoodApolloProvider>
<Routes />
</RedwoodProvider>
</RedwoodApolloProvider>
</AuthProvider>
</FatalErrorBoundary>,
document.getElementById('redwood-app')
</FatalErrorBoundary>
)
export default App

View File

@@ -36,7 +36,7 @@ const Routes = () => {
<Route path="/policies/code-of-conduct" page={CodeOfConductPage} name="codeOfConduct" />
<Route path="/account-recovery/update-password" page={UpdatePasswordPage} name="updatePassword" />
<Route path="/account-recovery" page={AccountRecoveryPage} name="accountRecovery" />
<Route path="/" page={HomePage} name="home" />
<Route path="/" page={HomePage} name="home" prerender />
<Route notfound page={NotFoundPage} />
{/* Ownership enforced routes */}

View File

@@ -26,7 +26,9 @@
</script>
</head>
<body>
<div id="redwood-app"></div>
<div id="redwood-app">
<%= prerenderPlaceholder %>
</div>
<div
id="cascade-container"
style="opacity: 0; overflow: hidden; height: 0"

View File

@@ -9,6 +9,7 @@ import Footer from 'src/components/Footer'
import { useLocation } from '@redwoodjs/router'
import LoginModal from 'src/components/LoginModal'
import ReactGA from 'react-ga'
import { isBrowser } from '@redwoodjs/prerender/browserUtils'
import Svg from 'src/components/Svg'
import ImageUploader from 'src/components/ImageUploader'
@@ -63,7 +64,10 @@ const MainLayout = ({ children, shouldRemoveFooterInIde }) => {
previousSubmission = newSubmission
}
}, [pathname, params])
const hash = window.location.hash
let hash
if (isBrowser) {
hash = window.location.hash
}
useEffect(() => {
const [key, token] = hash.slice(1).split('=')
if (key === 'confirmation_token') {

1744
yarn.lock

File diff suppressed because it is too large Load Diff