Created
October 4, 2023 20:07
-
-
Save dayhaysoos/8b04b362de3f9b7c21b75408d610a015 to your computer and use it in GitHub Desktop.
schema.graphql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type User | |
@model | |
@auth( | |
rules: [ | |
{ allow: owner } | |
{ allow: public, operations: [read], provider: iam } | |
] | |
) { | |
id: ID! | |
username: String! | |
owner: String | |
twitch: String | |
discord: String | |
city: String | |
profilePicture: String | |
reputation: Int | |
questions: [Question] @hasMany(indexName: "byUser", fields: ["id"]) | |
answers: [Answer] @hasMany(indexName: "byUser", fields: ["id"]) | |
comments: [Comment] @hasMany(indexName: "byUser", fields: ["id"]) | |
votes: [Vote] @hasMany(indexName: "byUser", fields: ["id"]) | |
moderationActivities: [ModerationActivity] | |
@hasMany(indexName: "byUser", fields: ["id"]) | |
} | |
type Question | |
@model | |
@auth( | |
rules: [ | |
{ allow: owner } | |
{ allow: public, provider: iam, operations: [read] } | |
] | |
) { | |
id: ID! | |
title: String | |
body: String | |
user: User @belongsTo(fields: ["userId"]) | |
userId: ID! @index(name: "byUser") | |
tags: [String] | |
createdAt: AWSDateTime | |
updatedAt: AWSDateTime | |
answers: [Answer] @hasMany(indexName: "byQuestion", fields: ["id"]) | |
comments: [Comment] @hasMany(indexName: "byQuestion", fields: ["id"]) | |
votes: [Vote] @hasMany(indexName: "byQuestion", fields: ["id"]) | |
moderationActivities: [ModerationActivity] | |
@hasMany(indexName: "byQuestion", fields: ["id"]) | |
bestAnswersIds: [ID] | |
} | |
type Answer @model { | |
id: ID! | |
@auth( | |
rules: [ | |
{ allow: owner, operations: [read] } | |
{ allow: public, operations: [read], provider: iam } | |
] | |
) | |
body: String! | |
@auth( | |
rules: [ | |
{ allow: owner, operations: [read] } | |
{ allow: public, operations: [read], provider: iam } | |
] | |
) | |
user: User | |
@belongsTo(fields: ["userId"]) | |
@auth( | |
rules: [ | |
{ allow: owner } | |
{ allow: public, operations: [read], provider: iam } | |
] | |
) | |
userId: ID! | |
@index(name: "byUser") | |
@auth( | |
rules: [ | |
{ allow: owner, operations: [read] } | |
{ allow: public, operations: [read], provider: iam } | |
] | |
) | |
question: Question @belongsTo(fields: ["questionId"]) | |
questionId: ID! | |
@index(name: "byQuestion") | |
@auth( | |
rules: [ | |
{ allow: owner, operations: [read] } | |
{ allow: public, operations: [read], provider: iam } | |
] | |
) | |
createdAt: AWSDateTime | |
updatedAt: AWSDateTime | |
comments: [Comment] @hasMany(indexName: "byAnswer", fields: ["id"]) | |
votes: [Vote] @hasMany(indexName: "byAnswer", fields: ["id"]) | |
moderationActivities: [ModerationActivity] | |
@hasMany(indexName: "byAnswer", fields: ["id"]) | |
} | |
type Comment | |
@model | |
@auth( | |
rules: [ | |
{ allow: owner } | |
{ allow: public, operations: [read], provider: iam } | |
] | |
) { | |
id: ID! | |
body: String! | |
user: User @belongsTo(fields: ["userId"]) | |
userId: ID! @index(name: "byUser") | |
question: Question @belongsTo(fields: ["questionId"]) | |
questionId: ID @index(name: "byQuestion") | |
answer: Answer @belongsTo(fields: ["answerId"]) | |
answerId: ID @index(name: "byAnswer") | |
createdAt: AWSDateTime | |
updatedAt: AWSDateTime | |
votes: [Vote] @hasMany(indexName: "byComment", fields: ["id"]) | |
moderationActivities: [ModerationActivity] | |
@hasMany(indexName: "byComment", fields: ["id"]) | |
} | |
type Vote | |
@model | |
@auth( | |
rules: [ | |
{ allow: owner } | |
{ allow: public, operations: [read], provider: iam } | |
] | |
) { | |
id: ID! | |
value: Int! | |
user: User @belongsTo(fields: ["userId"]) | |
userId: ID! @index(name: "byUser") | |
question: Question @belongsTo(fields: ["questionId"]) | |
questionId: ID @index(name: "byQuestion") | |
answer: Answer @belongsTo(fields: ["answerId"]) | |
answerId: ID @index(name: "byAnswer") | |
comment: Comment @belongsTo(fields: ["commentId"]) | |
commentId: ID @index(name: "byComment") | |
createdAt: AWSDateTime | |
updatedAt: AWSDateTime | |
} | |
type ModerationActivity | |
@model | |
@auth( | |
rules: [ | |
{ allow: owner } | |
{ allow: public, operations: [read], provider: iam } | |
] | |
) { | |
id: ID! | |
type: ModerationType! | |
user: User @belongsTo(fields: ["userId"]) | |
userId: ID! @index(name: "byUser") | |
question: Question @belongsTo(fields: ["questionId"]) | |
questionId: ID @index(name: "byQuestion") | |
answer: Answer @belongsTo(fields: ["answerId"]) | |
answerId: ID @index(name: "byAnswer") | |
comment: Comment @belongsTo(fields: ["commentId"]) | |
commentId: ID @index(name: "byComment") | |
createdAt: AWSDateTime | |
updatedAt: AWSDateTime | |
} | |
enum ModerationType { | |
CLOSED | |
REOPENED | |
DELETED | |
UNDELETED | |
EDITED | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment