Refactored prisma schema, switched from graphql-yoga to apollo-server
This commit is contained in:
219
prisma/migrations/20201006125838-initial-migration/README.md
Normal file
219
prisma/migrations/20201006125838-initial-migration/README.md
Normal file
@@ -0,0 +1,219 @@
|
||||
# Migration `20201006125838-initial-migration`
|
||||
|
||||
This migration has been generated by Dm1tr1y147 at 10/6/2020, 5:58:38 PM.
|
||||
You can check out the [state of the schema](./schema.prisma) after the migration.
|
||||
|
||||
## Database Steps
|
||||
|
||||
```sql
|
||||
CREATE TYPE "public"."ChoiseType" AS ENUM ('SELECT', 'CHECK', 'CHOOSE')
|
||||
|
||||
CREATE TYPE "public"."AnswerType" AS ENUM ('INPUT', 'CHOISE')
|
||||
|
||||
CREATE TABLE "public"."Form" (
|
||||
"title" text NOT NULL ,
|
||||
"dateCreated" timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"id" integer NOT NULL ,
|
||||
"userId" integer NOT NULL ,
|
||||
PRIMARY KEY ("id")
|
||||
)
|
||||
|
||||
CREATE TABLE "public"."ChoisesQuestion" (
|
||||
"title" text NOT NULL ,
|
||||
"type" "ChoiseType" NOT NULL ,
|
||||
"number" integer NOT NULL ,
|
||||
"id" integer NOT NULL ,
|
||||
"formId" integer ,
|
||||
PRIMARY KEY ("id")
|
||||
)
|
||||
|
||||
CREATE TABLE "public"."Variant" (
|
||||
"text" text NOT NULL ,
|
||||
"id" integer NOT NULL ,
|
||||
"choisesQuestionId" integer ,
|
||||
PRIMARY KEY ("id")
|
||||
)
|
||||
|
||||
CREATE TABLE "public"."InputQuestion" (
|
||||
"title" text NOT NULL ,
|
||||
"number" integer NOT NULL ,
|
||||
"id" integer NOT NULL ,
|
||||
"formId" integer ,
|
||||
PRIMARY KEY ("id")
|
||||
)
|
||||
|
||||
CREATE TABLE "public"."FormSubmission" (
|
||||
"date" timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"id" integer NOT NULL ,
|
||||
"formId" integer ,
|
||||
"userId" integer NOT NULL ,
|
||||
PRIMARY KEY ("id")
|
||||
)
|
||||
|
||||
CREATE TABLE "public"."Answer" (
|
||||
"id" integer NOT NULL ,
|
||||
"userInput" text NOT NULL ,
|
||||
"userChoise" integer NOT NULL ,
|
||||
"type" "AnswerType" NOT NULL ,
|
||||
"formSubmissionId" integer ,
|
||||
PRIMARY KEY ("id")
|
||||
)
|
||||
|
||||
CREATE TABLE "public"."User" (
|
||||
"id" integer NOT NULL ,
|
||||
"name" text NOT NULL ,
|
||||
PRIMARY KEY ("id")
|
||||
)
|
||||
|
||||
ALTER TABLE "public"."Form" ADD FOREIGN KEY ("userId")REFERENCES "public"."User"("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
|
||||
ALTER TABLE "public"."ChoisesQuestion" ADD FOREIGN KEY ("formId")REFERENCES "public"."Form"("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
|
||||
ALTER TABLE "public"."Variant" ADD FOREIGN KEY ("choisesQuestionId")REFERENCES "public"."ChoisesQuestion"("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
|
||||
ALTER TABLE "public"."InputQuestion" ADD FOREIGN KEY ("formId")REFERENCES "public"."Form"("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
|
||||
ALTER TABLE "public"."FormSubmission" ADD FOREIGN KEY ("userId")REFERENCES "public"."User"("id") ON DELETE CASCADE ON UPDATE CASCADE
|
||||
|
||||
ALTER TABLE "public"."FormSubmission" ADD FOREIGN KEY ("formId")REFERENCES "public"."Form"("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
|
||||
ALTER TABLE "public"."Answer" ADD FOREIGN KEY ("formSubmissionId")REFERENCES "public"."FormSubmission"("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
```
|
||||
|
||||
## Changes
|
||||
|
||||
```diff
|
||||
diff --git schema.prisma schema.prisma
|
||||
migration ..20201006125838-initial-migration
|
||||
--- datamodel.dml
|
||||
+++ datamodel.dml
|
||||
@@ -1,0 +1,126 @@
|
||||
+// This is your Prisma schema file,
|
||||
+// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
+
|
||||
+datasource db {
|
||||
+ provider = "postgres"
|
||||
+ url = "***"
|
||||
+}
|
||||
+
|
||||
+generator client {
|
||||
+ provider = "prisma-client-js"
|
||||
+}
|
||||
+
|
||||
+// model User {
|
||||
+// id Int @id @default(autoincrement())
|
||||
+// name String
|
||||
+// email String?
|
||||
+// createdAt DateTime @default(now())
|
||||
+// polls Poll[]
|
||||
+// }
|
||||
+
|
||||
+// model Poll {
|
||||
+// id Int @id @default(autoincrement())
|
||||
+// User User? @relation(fields: [userId], references: [id])
|
||||
+// userId Int?
|
||||
+// title String
|
||||
+// description String?
|
||||
+// slug String @unique @default(cuid())
|
||||
+// questions Question[]
|
||||
+// createdAt DateTime @default(now())
|
||||
+// }
|
||||
+
|
||||
+// model Question {
|
||||
+// id Int @id @default(autoincrement())
|
||||
+// Poll Poll? @relation(fields: [pollId], references: [id])
|
||||
+// pollId Int?
|
||||
+// title String
|
||||
+// variants Variant[]
|
||||
+// }
|
||||
+
|
||||
+// model Variant {
|
||||
+// id Int @id @default(autoincrement())
|
||||
+// Question Question? @relation(fields: [questionId], references: [id])
|
||||
+// questionId Int?
|
||||
+// text String
|
||||
+// count Int @default(0)
|
||||
+// }
|
||||
+
|
||||
+model Form {
|
||||
+ title String
|
||||
+ choisesQuestions ChoisesQuestion[]
|
||||
+ inputQuestions InputQuestion[]
|
||||
+ submissions FormSubmission[]
|
||||
+ dateCreated DateTime @default(now())
|
||||
+
|
||||
+ id Int @id
|
||||
+ userId Int
|
||||
+ author User @relation(fields: [userId], references: [id])
|
||||
+}
|
||||
+
|
||||
+model ChoisesQuestion {
|
||||
+ title String
|
||||
+ variants Variant[]
|
||||
+ type ChoiseType
|
||||
+ number Int
|
||||
+
|
||||
+ id Int @id
|
||||
+ Form Form? @relation(fields: [formId], references: [id])
|
||||
+ formId Int?
|
||||
+}
|
||||
+
|
||||
+model Variant {
|
||||
+ text String
|
||||
+
|
||||
+ id Int @id
|
||||
+ ChoisesQuestion ChoisesQuestion? @relation(fields: [choisesQuestionId], references: [id])
|
||||
+ choisesQuestionId Int?
|
||||
+}
|
||||
+
|
||||
+model InputQuestion {
|
||||
+ title String
|
||||
+ number Int
|
||||
+
|
||||
+ id Int @id
|
||||
+ Form Form? @relation(fields: [formId], references: [id])
|
||||
+ formId Int?
|
||||
+}
|
||||
+
|
||||
+model FormSubmission {
|
||||
+ answers Answer[]
|
||||
+ date DateTime @default(now())
|
||||
+
|
||||
+
|
||||
+ id Int @id
|
||||
+ user User @relation(fields: [userId], references: [id])
|
||||
+ Form Form? @relation(fields: [formId], references: [id])
|
||||
+ formId Int?
|
||||
+ userId Int
|
||||
+}
|
||||
+
|
||||
+model Answer {
|
||||
+ id Int @id
|
||||
+ userInput String
|
||||
+ userChoise Int
|
||||
+ type AnswerType
|
||||
+ FormSubmission FormSubmission? @relation(fields: [formSubmissionId], references: [id])
|
||||
+ formSubmissionId Int?
|
||||
+}
|
||||
+
|
||||
+enum ChoiseType {
|
||||
+ SELECT
|
||||
+ CHECK
|
||||
+ CHOOSE
|
||||
+}
|
||||
+
|
||||
+enum AnswerType {
|
||||
+ INPUT
|
||||
+ CHOISE
|
||||
+}
|
||||
+
|
||||
+model User {
|
||||
+ id Int @id
|
||||
+ name String
|
||||
+
|
||||
+ forms Form[]
|
||||
+ formsSubmissions FormSubmission[]
|
||||
+}
|
||||
```
|
||||
|
||||
|
126
prisma/migrations/20201006125838-initial-migration/schema.prisma
Normal file
126
prisma/migrations/20201006125838-initial-migration/schema.prisma
Normal file
@@ -0,0 +1,126 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
datasource db {
|
||||
provider = "postgres"
|
||||
url = "***"
|
||||
}
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
// model User {
|
||||
// id Int @id @default(autoincrement())
|
||||
// name String
|
||||
// email String?
|
||||
// createdAt DateTime @default(now())
|
||||
// polls Poll[]
|
||||
// }
|
||||
|
||||
// model Poll {
|
||||
// id Int @id @default(autoincrement())
|
||||
// User User? @relation(fields: [userId], references: [id])
|
||||
// userId Int?
|
||||
// title String
|
||||
// description String?
|
||||
// slug String @unique @default(cuid())
|
||||
// questions Question[]
|
||||
// createdAt DateTime @default(now())
|
||||
// }
|
||||
|
||||
// model Question {
|
||||
// id Int @id @default(autoincrement())
|
||||
// Poll Poll? @relation(fields: [pollId], references: [id])
|
||||
// pollId Int?
|
||||
// title String
|
||||
// variants Variant[]
|
||||
// }
|
||||
|
||||
// model Variant {
|
||||
// id Int @id @default(autoincrement())
|
||||
// Question Question? @relation(fields: [questionId], references: [id])
|
||||
// questionId Int?
|
||||
// text String
|
||||
// count Int @default(0)
|
||||
// }
|
||||
|
||||
model Form {
|
||||
title String
|
||||
choisesQuestions ChoisesQuestion[]
|
||||
inputQuestions InputQuestion[]
|
||||
submissions FormSubmission[]
|
||||
dateCreated DateTime @default(now())
|
||||
|
||||
id Int @id
|
||||
userId Int
|
||||
author User @relation(fields: [userId], references: [id])
|
||||
}
|
||||
|
||||
model ChoisesQuestion {
|
||||
title String
|
||||
variants Variant[]
|
||||
type ChoiseType
|
||||
number Int
|
||||
|
||||
id Int @id
|
||||
Form Form? @relation(fields: [formId], references: [id])
|
||||
formId Int?
|
||||
}
|
||||
|
||||
model Variant {
|
||||
text String
|
||||
|
||||
id Int @id
|
||||
ChoisesQuestion ChoisesQuestion? @relation(fields: [choisesQuestionId], references: [id])
|
||||
choisesQuestionId Int?
|
||||
}
|
||||
|
||||
model InputQuestion {
|
||||
title String
|
||||
number Int
|
||||
|
||||
id Int @id
|
||||
Form Form? @relation(fields: [formId], references: [id])
|
||||
formId Int?
|
||||
}
|
||||
|
||||
model FormSubmission {
|
||||
answers Answer[]
|
||||
date DateTime @default(now())
|
||||
|
||||
|
||||
id Int @id
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
Form Form? @relation(fields: [formId], references: [id])
|
||||
formId Int?
|
||||
userId Int
|
||||
}
|
||||
|
||||
model Answer {
|
||||
id Int @id
|
||||
userInput String
|
||||
userChoise Int
|
||||
type AnswerType
|
||||
FormSubmission FormSubmission? @relation(fields: [formSubmissionId], references: [id])
|
||||
formSubmissionId Int?
|
||||
}
|
||||
|
||||
enum ChoiseType {
|
||||
SELECT
|
||||
CHECK
|
||||
CHOOSE
|
||||
}
|
||||
|
||||
enum AnswerType {
|
||||
INPUT
|
||||
CHOISE
|
||||
}
|
||||
|
||||
model User {
|
||||
id Int @id
|
||||
name String
|
||||
|
||||
forms Form[]
|
||||
formsSubmissions FormSubmission[]
|
||||
}
|
759
prisma/migrations/20201006125838-initial-migration/steps.json
Normal file
759
prisma/migrations/20201006125838-initial-migration/steps.json
Normal file
@@ -0,0 +1,759 @@
|
||||
{
|
||||
"version": "0.3.14-fixed",
|
||||
"steps": [
|
||||
{
|
||||
"tag": "CreateEnum",
|
||||
"enum": "ChoiseType",
|
||||
"values": [
|
||||
"SELECT",
|
||||
"CHECK",
|
||||
"CHOOSE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"tag": "CreateEnum",
|
||||
"enum": "AnswerType",
|
||||
"values": [
|
||||
"INPUT",
|
||||
"CHOISE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"tag": "CreateSource",
|
||||
"source": "db"
|
||||
},
|
||||
{
|
||||
"tag": "CreateArgument",
|
||||
"location": {
|
||||
"tag": "Source",
|
||||
"source": "db"
|
||||
},
|
||||
"argument": "provider",
|
||||
"value": "\"postgres\""
|
||||
},
|
||||
{
|
||||
"tag": "CreateArgument",
|
||||
"location": {
|
||||
"tag": "Source",
|
||||
"source": "db"
|
||||
},
|
||||
"argument": "url",
|
||||
"value": "\"***\""
|
||||
},
|
||||
{
|
||||
"tag": "CreateModel",
|
||||
"model": "Form"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Form",
|
||||
"field": "title",
|
||||
"type": "String",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Form",
|
||||
"field": "choisesQuestions",
|
||||
"type": "ChoisesQuestion",
|
||||
"arity": "List"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Form",
|
||||
"field": "inputQuestions",
|
||||
"type": "InputQuestion",
|
||||
"arity": "List"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Form",
|
||||
"field": "submissions",
|
||||
"type": "FormSubmission",
|
||||
"arity": "List"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Form",
|
||||
"field": "dateCreated",
|
||||
"type": "DateTime",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateDirective",
|
||||
"location": {
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "Form",
|
||||
"field": "dateCreated"
|
||||
},
|
||||
"directive": "default"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "CreateArgument",
|
||||
"location": {
|
||||
"tag": "Directive",
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "Form",
|
||||
"field": "dateCreated"
|
||||
},
|
||||
"directive": "default"
|
||||
},
|
||||
"argument": "",
|
||||
"value": "now()"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Form",
|
||||
"field": "id",
|
||||
"type": "Int",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateDirective",
|
||||
"location": {
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "Form",
|
||||
"field": "id"
|
||||
},
|
||||
"directive": "id"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Form",
|
||||
"field": "userId",
|
||||
"type": "Int",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Form",
|
||||
"field": "author",
|
||||
"type": "User",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateDirective",
|
||||
"location": {
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "Form",
|
||||
"field": "author"
|
||||
},
|
||||
"directive": "relation"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "CreateArgument",
|
||||
"location": {
|
||||
"tag": "Directive",
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "Form",
|
||||
"field": "author"
|
||||
},
|
||||
"directive": "relation"
|
||||
},
|
||||
"argument": "fields",
|
||||
"value": "[userId]"
|
||||
},
|
||||
{
|
||||
"tag": "CreateArgument",
|
||||
"location": {
|
||||
"tag": "Directive",
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "Form",
|
||||
"field": "author"
|
||||
},
|
||||
"directive": "relation"
|
||||
},
|
||||
"argument": "references",
|
||||
"value": "[id]"
|
||||
},
|
||||
{
|
||||
"tag": "CreateModel",
|
||||
"model": "ChoisesQuestion"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "ChoisesQuestion",
|
||||
"field": "title",
|
||||
"type": "String",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "ChoisesQuestion",
|
||||
"field": "variants",
|
||||
"type": "Variant",
|
||||
"arity": "List"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "ChoisesQuestion",
|
||||
"field": "type",
|
||||
"type": "ChoiseType",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "ChoisesQuestion",
|
||||
"field": "number",
|
||||
"type": "Int",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "ChoisesQuestion",
|
||||
"field": "id",
|
||||
"type": "Int",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateDirective",
|
||||
"location": {
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "ChoisesQuestion",
|
||||
"field": "id"
|
||||
},
|
||||
"directive": "id"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "ChoisesQuestion",
|
||||
"field": "Form",
|
||||
"type": "Form",
|
||||
"arity": "Optional"
|
||||
},
|
||||
{
|
||||
"tag": "CreateDirective",
|
||||
"location": {
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "ChoisesQuestion",
|
||||
"field": "Form"
|
||||
},
|
||||
"directive": "relation"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "CreateArgument",
|
||||
"location": {
|
||||
"tag": "Directive",
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "ChoisesQuestion",
|
||||
"field": "Form"
|
||||
},
|
||||
"directive": "relation"
|
||||
},
|
||||
"argument": "fields",
|
||||
"value": "[formId]"
|
||||
},
|
||||
{
|
||||
"tag": "CreateArgument",
|
||||
"location": {
|
||||
"tag": "Directive",
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "ChoisesQuestion",
|
||||
"field": "Form"
|
||||
},
|
||||
"directive": "relation"
|
||||
},
|
||||
"argument": "references",
|
||||
"value": "[id]"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "ChoisesQuestion",
|
||||
"field": "formId",
|
||||
"type": "Int",
|
||||
"arity": "Optional"
|
||||
},
|
||||
{
|
||||
"tag": "CreateModel",
|
||||
"model": "Variant"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Variant",
|
||||
"field": "text",
|
||||
"type": "String",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Variant",
|
||||
"field": "id",
|
||||
"type": "Int",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateDirective",
|
||||
"location": {
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "Variant",
|
||||
"field": "id"
|
||||
},
|
||||
"directive": "id"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Variant",
|
||||
"field": "ChoisesQuestion",
|
||||
"type": "ChoisesQuestion",
|
||||
"arity": "Optional"
|
||||
},
|
||||
{
|
||||
"tag": "CreateDirective",
|
||||
"location": {
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "Variant",
|
||||
"field": "ChoisesQuestion"
|
||||
},
|
||||
"directive": "relation"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "CreateArgument",
|
||||
"location": {
|
||||
"tag": "Directive",
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "Variant",
|
||||
"field": "ChoisesQuestion"
|
||||
},
|
||||
"directive": "relation"
|
||||
},
|
||||
"argument": "fields",
|
||||
"value": "[choisesQuestionId]"
|
||||
},
|
||||
{
|
||||
"tag": "CreateArgument",
|
||||
"location": {
|
||||
"tag": "Directive",
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "Variant",
|
||||
"field": "ChoisesQuestion"
|
||||
},
|
||||
"directive": "relation"
|
||||
},
|
||||
"argument": "references",
|
||||
"value": "[id]"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Variant",
|
||||
"field": "choisesQuestionId",
|
||||
"type": "Int",
|
||||
"arity": "Optional"
|
||||
},
|
||||
{
|
||||
"tag": "CreateModel",
|
||||
"model": "InputQuestion"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "InputQuestion",
|
||||
"field": "title",
|
||||
"type": "String",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "InputQuestion",
|
||||
"field": "number",
|
||||
"type": "Int",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "InputQuestion",
|
||||
"field": "id",
|
||||
"type": "Int",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateDirective",
|
||||
"location": {
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "InputQuestion",
|
||||
"field": "id"
|
||||
},
|
||||
"directive": "id"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "InputQuestion",
|
||||
"field": "Form",
|
||||
"type": "Form",
|
||||
"arity": "Optional"
|
||||
},
|
||||
{
|
||||
"tag": "CreateDirective",
|
||||
"location": {
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "InputQuestion",
|
||||
"field": "Form"
|
||||
},
|
||||
"directive": "relation"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "CreateArgument",
|
||||
"location": {
|
||||
"tag": "Directive",
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "InputQuestion",
|
||||
"field": "Form"
|
||||
},
|
||||
"directive": "relation"
|
||||
},
|
||||
"argument": "fields",
|
||||
"value": "[formId]"
|
||||
},
|
||||
{
|
||||
"tag": "CreateArgument",
|
||||
"location": {
|
||||
"tag": "Directive",
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "InputQuestion",
|
||||
"field": "Form"
|
||||
},
|
||||
"directive": "relation"
|
||||
},
|
||||
"argument": "references",
|
||||
"value": "[id]"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "InputQuestion",
|
||||
"field": "formId",
|
||||
"type": "Int",
|
||||
"arity": "Optional"
|
||||
},
|
||||
{
|
||||
"tag": "CreateModel",
|
||||
"model": "FormSubmission"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "FormSubmission",
|
||||
"field": "answers",
|
||||
"type": "Answer",
|
||||
"arity": "List"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "FormSubmission",
|
||||
"field": "date",
|
||||
"type": "DateTime",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateDirective",
|
||||
"location": {
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "FormSubmission",
|
||||
"field": "date"
|
||||
},
|
||||
"directive": "default"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "CreateArgument",
|
||||
"location": {
|
||||
"tag": "Directive",
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "FormSubmission",
|
||||
"field": "date"
|
||||
},
|
||||
"directive": "default"
|
||||
},
|
||||
"argument": "",
|
||||
"value": "now()"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "FormSubmission",
|
||||
"field": "id",
|
||||
"type": "Int",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateDirective",
|
||||
"location": {
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "FormSubmission",
|
||||
"field": "id"
|
||||
},
|
||||
"directive": "id"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "FormSubmission",
|
||||
"field": "user",
|
||||
"type": "User",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateDirective",
|
||||
"location": {
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "FormSubmission",
|
||||
"field": "user"
|
||||
},
|
||||
"directive": "relation"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "CreateArgument",
|
||||
"location": {
|
||||
"tag": "Directive",
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "FormSubmission",
|
||||
"field": "user"
|
||||
},
|
||||
"directive": "relation"
|
||||
},
|
||||
"argument": "fields",
|
||||
"value": "[userId]"
|
||||
},
|
||||
{
|
||||
"tag": "CreateArgument",
|
||||
"location": {
|
||||
"tag": "Directive",
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "FormSubmission",
|
||||
"field": "user"
|
||||
},
|
||||
"directive": "relation"
|
||||
},
|
||||
"argument": "references",
|
||||
"value": "[id]"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "FormSubmission",
|
||||
"field": "Form",
|
||||
"type": "Form",
|
||||
"arity": "Optional"
|
||||
},
|
||||
{
|
||||
"tag": "CreateDirective",
|
||||
"location": {
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "FormSubmission",
|
||||
"field": "Form"
|
||||
},
|
||||
"directive": "relation"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "CreateArgument",
|
||||
"location": {
|
||||
"tag": "Directive",
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "FormSubmission",
|
||||
"field": "Form"
|
||||
},
|
||||
"directive": "relation"
|
||||
},
|
||||
"argument": "fields",
|
||||
"value": "[formId]"
|
||||
},
|
||||
{
|
||||
"tag": "CreateArgument",
|
||||
"location": {
|
||||
"tag": "Directive",
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "FormSubmission",
|
||||
"field": "Form"
|
||||
},
|
||||
"directive": "relation"
|
||||
},
|
||||
"argument": "references",
|
||||
"value": "[id]"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "FormSubmission",
|
||||
"field": "formId",
|
||||
"type": "Int",
|
||||
"arity": "Optional"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "FormSubmission",
|
||||
"field": "userId",
|
||||
"type": "Int",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateModel",
|
||||
"model": "Answer"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Answer",
|
||||
"field": "id",
|
||||
"type": "Int",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateDirective",
|
||||
"location": {
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "Answer",
|
||||
"field": "id"
|
||||
},
|
||||
"directive": "id"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Answer",
|
||||
"field": "userInput",
|
||||
"type": "String",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Answer",
|
||||
"field": "userChoise",
|
||||
"type": "Int",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Answer",
|
||||
"field": "type",
|
||||
"type": "AnswerType",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Answer",
|
||||
"field": "FormSubmission",
|
||||
"type": "FormSubmission",
|
||||
"arity": "Optional"
|
||||
},
|
||||
{
|
||||
"tag": "CreateDirective",
|
||||
"location": {
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "Answer",
|
||||
"field": "FormSubmission"
|
||||
},
|
||||
"directive": "relation"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "CreateArgument",
|
||||
"location": {
|
||||
"tag": "Directive",
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "Answer",
|
||||
"field": "FormSubmission"
|
||||
},
|
||||
"directive": "relation"
|
||||
},
|
||||
"argument": "fields",
|
||||
"value": "[formSubmissionId]"
|
||||
},
|
||||
{
|
||||
"tag": "CreateArgument",
|
||||
"location": {
|
||||
"tag": "Directive",
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "Answer",
|
||||
"field": "FormSubmission"
|
||||
},
|
||||
"directive": "relation"
|
||||
},
|
||||
"argument": "references",
|
||||
"value": "[id]"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Answer",
|
||||
"field": "formSubmissionId",
|
||||
"type": "Int",
|
||||
"arity": "Optional"
|
||||
},
|
||||
{
|
||||
"tag": "CreateModel",
|
||||
"model": "User"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "User",
|
||||
"field": "id",
|
||||
"type": "Int",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateDirective",
|
||||
"location": {
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "User",
|
||||
"field": "id"
|
||||
},
|
||||
"directive": "id"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "User",
|
||||
"field": "name",
|
||||
"type": "String",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "User",
|
||||
"field": "forms",
|
||||
"type": "Form",
|
||||
"arity": "List"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "User",
|
||||
"field": "formsSubmissions",
|
||||
"type": "FormSubmission",
|
||||
"arity": "List"
|
||||
}
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user