Skip to content

Instantly share code, notes, and snippets.

@dayhaysoos
Created June 14, 2023 15:04
Show Gist options
  • Save dayhaysoos/e810e0e9557a99d267038b034c1044e1 to your computer and use it in GitHub Desktop.
Save dayhaysoos/e810e0e9557a99d267038b034c1044e1 to your computer and use it in GitHub Desktop.
tkc
# This "input" configures a global authorization rule to enable public access to
# all models in this schema. Learn more about authorization rules here: https://docs.amplify.aws/cli/graphql/authorization-rules
input AMPLIFY {
globalAuthRule: AuthRule = { allow: public }
} # FOR TESTING ONLY!
type User @model @auth(rules: [{ allow: owner }]) {
id: ID!
username: String!
likes: [Like] @hasMany
descriptionLikes: [DescriptionLike] @hasMany
posts: [Post] @hasMany
owner: String @auth(rules: [{ allow: owner, operations: [read, delete] }])
twitch: String
discord: String
city: String
}
type Game @model {
id: ID!
name: String!
Characters: [Character] @hasMany
}
type Character @model {
id: ID!
name: String!
game: Game @belongsTo
commands: [Command] @hasMany
posts: [Post] @hasMany
}
type Like
@model
@auth(rules: [{ allow: public, operations: [read] }, { allow: owner }]) {
id: ID!
user: User! @belongsTo
command: Command! @belongsTo
owner: String @auth(rules: [{ allow: owner, operations: [read, delete] }])
}
type Post
@model
@auth(
rules: [
{ allow: owner, operations: [create, update, delete, read] }
{ allow: groups, groups: ["Admins"] }
{ allow: public, operations: [read] }
]
) {
id: ID!
title: String!
character: Character @belongsTo
user: User @belongsTo
comments: [Comment] @hasMany
owner: String @auth(rules: [{ allow: owner, operations: [read] }])
}
type Comment @model {
id: ID!
post: Post @belongsTo
content: String!
}
# Command types
type Command @model {
id: ID!
character: Character @belongsTo
name: String
description: Description @hasOne
input: String!
likes: [Like] @hasMany
frameProperties: FrameProperties
notes: String
}
type Description @model {
id: ID!
command: Command @belongsTo
text: String!
likes: [DescriptionLike] @hasMany
}
type DescriptionLike @model {
id: ID!
@auth(rules: [{ allow: private, operations: [read] }, { allow: owner }])
description: Description @belongsTo
user: User @belongsTo
owner: String @auth(rules: [{ allow: owner, operations: [read, delete] }])
}
type Frame {
operation: String
number: Int
status: Status
}
type Status {
knockdown: Boolean
launch: Boolean
wallSplat: Boolean
floorBreak: Boolean
wallBreak: Boolean
flip: Boolean
}
type FrameProperties {
startup: Int
active: Int
recovery: Int
onBlock: Frame
onHit: Frame
onCounterHit: Frame
notes: String
}
type GeneralProperties {
damage: [Int]
range: Int
hitLevel: [String]
launch: Boolean
homing: Boolean
natural: Boolean
wallSplat: Boolean
knockdown: Boolean
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment