diff options
Diffstat (limited to 'backend/database')
| -rw-r--r-- | backend/database/datamodel.graphql | 26 | ||||
| -rw-r--r-- | backend/database/prisma.yml | 21 | ||||
| -rw-r--r-- | backend/database/seed.graphql | 24 |
3 files changed, 71 insertions, 0 deletions
diff --git a/backend/database/datamodel.graphql b/backend/database/datamodel.graphql new file mode 100644 index 0000000..605e242 --- /dev/null +++ b/backend/database/datamodel.graphql @@ -0,0 +1,26 @@ +type Post { + id: ID! @unique + createdAt: DateTime! + updatedAt: DateTime! + isPublished: Boolean! @default(value: "false") + title: String! + text: String! + author: User! +} + +type User { + id: ID! @unique + email: String! @unique + password: String! + name: String! + posts: [Post!]! + website: String + age: Int +} + +type Item { + id: ID! @unique + title: String! + description: String! + price: Int! +} diff --git a/backend/database/prisma.yml b/backend/database/prisma.yml new file mode 100644 index 0000000..6570be2 --- /dev/null +++ b/backend/database/prisma.yml @@ -0,0 +1,21 @@ +# the name for the service (will be part of the service's HTTP endpoint) +service: my-own + +# the cluster and stage the service is deployed to +stage: ${env:PRISMA_STAGE} + +# to disable authentication: +# disableAuth: true +secret: ${env:PRISMA_SECRET} + +# the file path pointing to your data model +datamodel: datamodel.graphql + +# uncomment the following two lines to seed your service with initial data +# seed: +# import: seed.graphql + +cluster: ${env:PRISMA_CLUSTER} + + +disableAuth: true
\ No newline at end of file diff --git a/backend/database/seed.graphql b/backend/database/seed.graphql new file mode 100644 index 0000000..5779328 --- /dev/null +++ b/backend/database/seed.graphql @@ -0,0 +1,24 @@ +mutation { + createUser(data: { + email: "developer@example.com" + password: "$2a$10$hACwQ5/HQI6FhbIISOUVeusy3sKyUDhSq36fF5d/54aAdiygJPFzm" # plaintext password: "nooneknows" + name: "Sarah" + posts: { + create: [{ + title: "Hello World" + text: "This is my first blog post ever!" + isPublished: true + }, { + title: "My Second Post" + text: "My first post was good, but this one is better!" + isPublished: true + }, { + title: "Solving World Hunger" + text: "This is a draft..." + isPublished: false + }] + } + }) { + id + } +}
\ No newline at end of file |
